mouseDown event sets isDragging to true
@autobind _onMouseDown({pos}) {
const map = this._getMap();
const lngLat = unprojectFromTransform(map.transform, pos);
this._callOnChangeViewport(map.transform, {
isDragging: true, // **** HERE
startDragLngLat: [lngLat.lng, lngLat.lat],
startBearing: map.transform.bearing,
startPitch: map.transform.pitch
});
}
Currently, clicking the map causes isDragging to be set to true. I'm not sure why mouseDown should be considered a drag, especially when there's a specific mouseDrag handler that also sets isDragging to true. To me they're fundamentally different actions.
A use case supporting this is if you use isDragging to decide whether to render an overlay (e.g. for performance). It's impossible to have click events on elements in your overlay (since they disappear on mouseDown).
Would it be more appropriate to only set isDragging = true on mouseDrag rather than mouseDown?
(or, is there another way to handle this altogether?)
Edit: I'm also happy to submit a PR changing this
Not sure about this too, will investigate.
The isDragging prop is really a state internal to the MapGL component, not meant to be consumed by the user. The reason it is exposed has to do with the original design intent to keep MapGL a stat-less component.
It'd be less confusing if this prop was named isMouseDown.
The whole Map component has been moved to the deprecate folder, so closing.