Skip to content

Commit 1e507b2

Browse files
committed
fix drag freeze on mobile
1 parent e3162a3 commit 1e507b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

app/javascript/maplibre/edit.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ export async function initializeEditMode () {
161161
(draw.getMode() === 'simple_select' || draw.getMode().startsWith('directions_'))) {
162162
map.fire('click', e) // attach original event for coordinates
163163
}
164+
// Fix for mapbox-gl-draw issue #650: after a touch-drag, the draw library's
165+
// state machine can fail to re-enable dragPan, freezing the map.
166+
// Run after draw's own touchend handler via setTimeout to restore it.
167+
const mode = draw.getMode()
168+
if (mode === 'simple_select' || mode === 'direct_select') {
169+
setTimeout(() => map.dragPan.enable(), 0)
170+
}
164171
})
165172

166173
map.on('online', (_e) => { enableEditControls() })

0 commit comments

Comments
 (0)