Skip to content

Commit 83ff46b

Browse files
committed
fix context menu bahavior on touch screen
1 parent 2d1f9c2 commit 83ff46b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/javascript/maplibre/map.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ export async function initializeMap (divId = 'maplibre-map') {
181181
preventDefault: () => {}
182182
})
183183
map.longPressTriggered = true
184-
setTimeout(() => { map.longPressTriggered = false }, 100)
185184
cancelLongPress()
186185
}, 500)
187186
})
@@ -193,7 +192,10 @@ export async function initializeMap (divId = 'maplibre-map') {
193192
if (dx > 10 || dy > 10) cancelLongPress()
194193
})
195194

196-
map.on('touchend', cancelLongPress)
195+
map.on('touchend', () => {
196+
cancelLongPress()
197+
setTimeout(() => { map.longPressTriggered = false }, 0)
198+
})
197199
}
198200

199201
// map.on('error', (err) => {

0 commit comments

Comments
 (0)