question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Applying new viewState with a transitionDuration property causes sticky zoom/pan behaviour

See original GitHub issue

Please find a stripped down example at : https://codepen.io/anon/pen/QBGKmY

Hit the toggle pitch button in the top left, and you’ll see the behaviour once you try to interact with the map, if you comment out line 45, the transitionDuration property of the viewState, everything will behave as expected (the pitch toggle works and all map interaction behaves as expected), of course at the cost of the transition.

 currentViewState.transitionDuration = 300; //This is the offending line, comment me out for more predictable behaviour

Detail

I have a map and data layer, all working perfectly. I have a button which toggles a “3D” mode, in this case changes the viewState.pitch and redraws the data layer with extruded: true. In the above example, I’m just toggling the pitch between 0 and 40,

This works as expected, I get the current viewState from viewManager.viewState, update the viewState with the new pitch, thensetProps on the map and deck layers and the changes are seen, this state is persisted as a user interacts with the map (pan,zoom etc.), and reverts back when the button is pressed again.

As soon as I add a transitionDuration property to the viewState when toggling the 3D mode, the behaviour breaks. The transition is animated (in this case the change in pitch). But once this transition is completed, any attempted interaction with the map, (a pan or zoom) results in the map snapping back to the state before the toggle button was clicked, as if that cached viewState is overriding any of the viewState values set by the onViewState event.

I’m not sure if this is an implementation issue on my side, but it seems odd adding this one property to the viewState so drastically changes the behaviour.

Many Thanks!

Code Example

To Do List

  • Add label and assign to milestone
  • Coding
  • Test

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
ollercommented, Aug 1, 2018

It does indeed, works on my app too - thanks again for addressing this so promptly and for such a great library!

1reaction
Pessimistresscommented, Jul 31, 2018

@oller

  • I advise against accessing the viewManager - it is considered internal to deck and the implementation may change at any time.
  • I spent some more time looking into this. Looks like there is another bug in the ViewManager during viewport transition. We failed to catch it because we only tested the feature in React, in which view state is updated through setState and always async. In pure-js, view state is updated synchronously. I’ll get a fix out soon.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Applying new viewState with a transitionDuration property ...
Applying new viewState with a transitionDuration property causes sticky zoom/pan behaviour #2102. Closed. 3 tasks.
Read more >
nvd3 js - OSCHINA - 中文开源技术交流社区
SETUP and USAGE The steps below will take you through cloning your own fork, installing dependencies and building: Fork and/or clone our repository....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found