mapbox-gl-directions icon indicating copy to clipboard operation
mapbox-gl-directions copied to clipboard

Debounce `fetchDirections` to prevent firing handlers while dragging markers

Open xivk opened this issue 8 years ago • 3 comments

dragging-issue

This behaviour is still there, don't know if it's still the same underlying cause as #36

xivk avatar Apr 24 '17 12:04 xivk

@xivk I just came across the same behavior and @anandthakker helped me understand what's going on there. It seems like we generate events while dragging markers instead of waiting until we're done with dragging here

https://github.com/mapbox/mapbox-gl-directions/blob/46cd036bcce32ac1b6d6db0ae63de5cadb6b40c5/src/actions/index.js#L53

There should be a check for the dragging behavior here

https://github.com/mapbox/mapbox-gl-directions/blob/02e3145560978d3fc6990c0831ed097099fdba36/src/directions.js#L289

but it seems like it's not working.

daniel-j-h avatar Jun 15 '17 08:06 daniel-j-h

Thanks for having a look!

I'll try and figure out why the check is not working but I'm not sure if I will be able to fix this myself in way that's acceptable (as in pull-request)...

xivk avatar Jun 15 '17 09:06 xivk

I had the same issue when dragging custom markers and how I fixed this was during drag I had to set the style.transform to none.

drag: function (e) {
    $(this.hint)[0].style.transform = "none";
}

For our drag and drop we use Kendo UI so the "hint" above is a clone of the marker.

Playing with the transform setting in your drag method may be worth a shot.

keyofj avatar Aug 09 '17 15:08 keyofj