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

How do I change viewState with pure-js? #3125

Open
dinglei92 opened this issue May 21, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@dinglei92
Copy link

commented May 21, 2019

I use setProps method to change the value of viewstate,but there are some problems.

deckgl.setProps({
       viewState: {
               longitude: 118.76218,
               latitude: 32.04358,
               zoom: 14
       }
})

But this method does not execute immediately, just only works if I'm manipulating the map。

@dinglei92 dinglei92 added the question label May 21, 2019

@Pessimistress

This comment has been minimized.

Copy link
Contributor

commented May 21, 2019

Can you provide more context?

There is a pure JS set viewState example

@dinglei92

This comment has been minimized.

Copy link
Author

commented May 22, 2019

@Pessimistress
I want to implement a method like mapbox jumpTo. No fly animation, just change viewState immediately.
This is my code:

jumpTo(option) {
        const viewStateDefault =  {
            transitionDuration: 0,
            transitionInterpolator: new FlyToInterpolator(),
        }
        this.deckgl.setProps({ viewState: { ...option, ...viewStateDefault } });
 }

It doesn't work well, but when I set transitionDuration to a very small value, like 10, It works well.

@Pessimistress

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

In the example I linked, if I comment out the transition settings, the camera jumps immediately. Can you share the rest of your code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.