Skip to content
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

plotly_relayouting event: live updates during panning/zooming #3888

Merged
merged 11 commits into from
May 23, 2019

Conversation

antoinerg
Copy link
Contributor

@antoinerg antoinerg commented May 22, 2019

This closes #2082 by adding a plotly_relayouting event to emit live updates of coordinates change when panning and zooming.

  • cartesian
  • geo
    • clipped
    • non-clipped
    • scoped
  • mapbox
  • polar
    • angular drag
    • radial drag
    • rotation drag
  • gl3d
  • ternary

I used the abandoned PR #2606 for guidance but I had to modify it and write tests.

Tests could probably be DRYed up significantly but it gets the job done. I now need to investigate why they fail on CircleCI .

src/plots/geo/zoom.js Outdated Show resolved Hide resolved
@etpinard
Copy link
Contributor

etpinard commented May 22, 2019

Nicely done @antoinerg ! Thanks very much for taking this (not so fun) task on!

You're almost there. Let me know if I can help out with anything.

@etpinard etpinard added this to the v1.48.0 milestone May 23, 2019
@etpinard
Copy link
Contributor

@antoinerg looks good! Thanks very (very) for the PR!

One cartesian_interact test is failing on CI and on my machine:

image

is it passing on your setup?

@antoinerg
Copy link
Contributor Author

@antoinerg looks good! Thanks very (very) for the PR!

One cartesian_interact test is failing on CI and on my machine:

image

is it passing on your setup?

I don't remember it failing before but it does fail at the moment on my desktop.

@antoinerg
Copy link
Contributor Author

@etpinard It seems like the test that currently fails is affected by the timing of events. It checks the axis range right after starting to drag. I suspect that now that we emit a plotly_relayouting event, right after is at a different time:

.then(function() {
var drag = makeDragFns('xy', 'nsew', 30, 0);
return drag.start()
.then(_assert('just after start of zoombox', {
nodeCnt: 4,
xrng: [-0.1927, 3.1927],
hasDragData: true,
zoombox: 'M269.5,114.5h-3v41h3ZM300.5,114.5h3v41h-3Z',
clipTranslate: [0, 0]
}))
.then(delay(step))
.then(_assert('during zoombox drag', {
nodeCnt: 5,
xrng: [-0.257, 4.257],
hasDragData: true,
zoombox: 'M269.5,114.5h-3v41h3ZM300.5,114.5h3v41h-3Z',
clipTranslate: [0, 0]
}))
.then(drag.end);
})

A workaround is to update those "assert values". Doing so in commit a76a52a makes the tests pass both locally and on the CI. Does that seem like a reasonable modification?

@etpinard
Copy link
Contributor

etpinard commented May 23, 2019

It checks the axis range right after starting to drag. I suspect that now that we emit a plotly_relayouting event, right after is at a different time:

That makes perfect sense. So adding plotly_relayouting does affect perf (by a little bit) it looks like.

A workaround is to update those "assert values". Doing so in commit a76a52a makes the tests pass both locally and on the CI. Does that seem like a reasonable modification?

Yep, nicely done. Could you just manually check that zoom-drag https://codepen.io/etpinard/pen/eaVQze?editors=1111 works correctly on your branch?

@antoinerg
Copy link
Contributor Author

Yep, nicely done. Could you just manually check that zoom-drag https://codepen.io/etpinard/pen/eaVQze?editors=1111 works correctly on your branch?

It looks fine as far as I can tell: https://codepen.io/antoinerg/pen/Jqpebm?editors=0001

@etpinard
Copy link
Contributor

Awesome work 💃 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an event for panning and zooming that show live details as the range changes
2 participants