Closed clementmas closed 1 year ago
Thanks for the reproduction.
Can confirm the bug, but only if you call destroy
without manually panning the map after adding a waypoint.
If you add a waypoint, then pan the map, then destroy directions, then everything's fine for some reason.
I'll try to check it out once I have time.
Indeed. The issue only happens if the map isn't moved after creating or dragging a waypoint.
I temporarily fixed it on my app by manually calling map.dragPan.enable()
after destroy()
.
@clementmas do you still have the issue? For some reason I can't reproduce it anymore even using the same attached repro from the OP :confused:
No, now it's back. Strange...
It only happens if the touchstart
event is triggered. So the devtools responsive mode needs to simulate a touchscreen device. Then the issue is there.
On a touchscreen device, if you drag the the line or a vertex, then remove the directions (call
destroy()
), it will freeze the map and it won't pan anymore.Here's the reproduction link: https://codesandbox.io/s/maplibre-gl-directions-pan-error-s1giw7
I think this has to do with with line: https://github.com/maplibre/maplibre-gl-directions/blob/main/src/directions/main.ts#L483
Somehow it stays disabled and creates this bug.