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 https://observablehq.com/d/7a912fba32fbe641 we've noticed that, when we dblclick to zoom (or shift-dblclick to zoom out), the value of d3.mouse() is [NaN,NaN], which resulted in spurious rotations.
I've fixed it by relying on the previously recorded mouse position (the one from the first click), but it seems wrong that d3.mouse returns NaNs.
(I'm not sure if this belongs to d3-zoom or d3-selection)
The text was updated successfully, but these errors were encountered:
I think this is the expected behavior, unfortunately. The problem is that when you dblclick, the zoom behavior schedules a transition to start on the next animation frame. By the time the transition starts, and the zoom start event is dispatched, the dblclick event has expired and so the sourceEvent on the zoom start event is null causing d3.mouse to return [NaN, NaN].
If you want to get the mouse coordinates of the dblclick, you need to listen to the dblclick, not just the start event on the zoom behavior.
Alternatively, the zoom behavior would somehow need to set the sourceEvent of the zoom start event to the expired dblclick event.
In https://observablehq.com/d/7a912fba32fbe641 we've noticed that, when we dblclick to zoom (or shift-dblclick to zoom out), the value of d3.mouse() is [NaN,NaN], which resulted in spurious rotations.
I've fixed it by relying on the previously recorded mouse position (the one from the first click), but it seems wrong that d3.mouse returns NaNs.
(I'm not sure if this belongs to d3-zoom or d3-selection)
The text was updated successfully, but these errors were encountered: