-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix emitting event "plotly_relayouting" with wrong data #3977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Although a new update is computed it is not applied until zooming using the zoombox is finished.
To fix the test I could remove them or set the expected relayouting count to zero. An alternative would be to change the event to something else, eg "plotly_zoombox-resized". This would be enable tests like ('handles y-only to xy back to y-only in single zoombox drag motion'). What would you suggest? |
@alexcjohnson I implemented my own range slider and wanted to synchronise the movement with the panning on the graph. This works by using |
@alexcjohnson I would agree with @maun that this behavior is a bit surprising. The main usecase that I've had in mind for Is there anything in the event data to help distinguish between pan and box zoom? |
@jonmmease Unfortunately not, the event is the same. If you agree to change this somehow by renaming the zoombox event or adding another property I would update my PR. |
That makes sense, thanks for clarifying. I don't think we want to remove zoombox from this event entirely, I can still imagine uses for it. But labeling it so you could choose to ignore zoombox or whichever ones you don't want seems like a good solution. It's a little weird as we only have the relayout object, but can we just add an |
How about |
Wouldn't gd.on('plotly_relayouting', function(d) {
gd._fullLayout.dragmode // => 'pan' or 'zoom'
}) also give you the right answer? |
@etpinard Just tried this, for me always "pan" is returned. Probably because I set the default dragmode to panning. |
Currently "plotly_relayouting" events are emitted when creating a zoombox. These events use the updates to the layout which would be applied when zooming. Since no relayouting takes place until the zoombox is applied I removed the event.