File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 7
7
8
8
const { map } = getOlContext ()
9
9
10
- map .on (' click' , async (e ) => {
10
+ const LONG_PRESS_THRESHOLD = 500 ;
11
+
12
+ let mouseDownAt: number ;
13
+ map .getTargetElement ().addEventListener (' mousedown' , e => {
14
+ mouseDownAt = Date .now ();
15
+ });
16
+
17
+ map .on (' singleclick' , async (e ) => {
18
+ const pressDuration = Date .now () - mouseDownAt
19
+ if (pressDuration < LONG_PRESS_THRESHOLD ) {
20
+ return
21
+ }
22
+
11
23
const [lng, lat] = toLonLat (e .coordinate )
12
24
const closestPoint = await findPlace (lat , lng )
13
25
$fragment .label = {
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export const linzTopo: TileLayerDefinition =
33
33
} ,
34
34
} ;
35
35
36
+ const LINZ_BASEMAPS = 'd01fbtg0ar3v159zx4e0ajt0n09'
36
37
export const layerDefinitions : TileLayerDefinition [ ] = [
37
38
linzTopo ,
38
39
{
@@ -52,16 +53,15 @@ export const layerDefinitions: TileLayerDefinition[] = [
52
53
description : "High resolution imagery of New Zealand, provided by LINZ" ,
53
54
type : 'base' ,
54
55
url : ( [ z , x , y ] : TileCoord ) => {
55
- return `https://basemaps.linz.govt.nz/v1/tiles/aerial/EPSG:3857/${ z } /${ x } /${ y } .webp?api=d01fbtg0ar3v159zx4e0ajt0n09 ` ;
56
+ return `https://basemaps.linz.govt.nz/v1/tiles/aerial/EPSG:3857/${ z } /${ x } /${ y } .webp?api=${ LINZ_BASEMAPS } ` ;
56
57
}
57
58
} ,
58
59
{
59
- name : "Hillshade " ,
60
+ name : "Hill shade " ,
60
61
description : "Terrain relief overlay" ,
61
62
type : 'overlay' ,
62
63
defaultVisible : true ,
63
- prerender : e => e . context ! . canvas . getContext ( '2d' ) ! . globalCompositeOperation = 'multiply' ,
64
64
minZoom : 10 ,
65
- url : ' https://tiles-cdn.koordinates.com/services;key=d0772bed2204423f87157f7fb1223389 /tiles/v4/layer=50765/EPSG:3857/ {z}/{x}/{y}.png'
66
- }
65
+ url : ` https://basemaps.linz.govt.nz/v1 /tiles/geographx-nz-dem-2012-8m/WebMercatorQuad/ {z}/{x}/{y}.webp?api= ${ LINZ_BASEMAPS } ` ,
66
+ } ,
67
67
]
You can’t perform that action at this time.
0 commit comments