You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my application I want to do certain things only after I am certain that the user intents to do a drag, e.g.:
Adding the styles for dragged elements. If I would do it on the drag start event then it the style would be added on every mousedown which is not what I want.
.raise() the element being dragged. If I would do it right away it might cause the click event to not be triggered (at least in some browsers) if the element got removed from the DOM.
The way I solved it is to simply use the delta x and y inside the drag event handler to calculate whether the click stance threshold has been breached or not.
Now d3 already does the same calculation already, I wondered whether it couldn't just simply tell me about whether the distance has been overstepped in the drag event, e.g. using d3.event.isOutsideClickDistance.
On a side note, an alternative idea would be a .dragDistance() which would cause the start events to only appear after a certain distance. This would cause the elements to appear a bit sticky though and it depends on the specific use case whether that's what you want or not.
The text was updated successfully, but these errors were encountered:
In my application I want to do certain things only after I am certain that the user intents to do a drag, e.g.:
Adding the styles for dragged elements. If I would do it on the drag
start
event then it the style would be added on everymousedown
which is not what I want..raise()
the element being dragged. If I would do it right away it might cause theclick
event to not be triggered (at least in some browsers) if the element got removed from the DOM.The way I solved it is to simply use the delta x and y inside the
drag
event handler to calculate whether the click stance threshold has been breached or not.Now d3 already does the same calculation already, I wondered whether it couldn't just simply tell me about whether the distance has been overstepped in the
drag
event, e.g. usingd3.event.isOutsideClickDistance
.On a side note, an alternative idea would be a
.dragDistance()
which would cause thestart
events to only appear after a certain distance. This would cause the elements to appear a bit sticky though and it depends on the specific use case whether that's what you want or not.The text was updated successfully, but these errors were encountered: