Applying new viewState with a transitionDuration property causes sticky zoom/pan behaviour
See original GitHub issuePlease 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:
- Created 5 years ago
- Comments:9
It does indeed, works on my app too - thanks again for addressing this so promptly and for such a great library!
@oller
viewManager
- it is considered internal to deck and the implementation may change at any time.ViewManager
during viewport transition. We failed to catch it because we only tested the feature in React, in which view state is updated throughsetState
and always async. In pure-js, view state is updated synchronously. I’ll get a fix out soon.