File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
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 @@ -56,7 +56,7 @@ export const layerDefinitions: TileLayerDefinition[] = [
56
56
}
57
57
} ,
58
58
{
59
- name : "Hillshade " ,
59
+ name : "Hill shade " ,
60
60
description : "Terrain relief overlay" ,
61
61
type : 'overlay' ,
62
62
defaultVisible : true ,
You can’t perform that action at this time.
0 commit comments