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

Calling setData on geojson sources causes flickering #973

Closed
edenh opened this issue Jan 30, 2015 · 8 comments
Closed

Calling setData on geojson sources causes flickering #973

edenh opened this issue Jan 30, 2015 · 8 comments
Assignees

Comments

@edenh
Copy link
Contributor

edenh commented Jan 30, 2015

source.setData is being called on mousemove in this example:

draw

@mourner
Copy link
Member

mourner commented Jan 30, 2015

@edenh yes, because on every setData, you need to send it to the worker, process it and send back. We could make this a bit better by not removing the line until the main thread gets new processed data.

For a smoother experience on specific use cases like this where data is very small and coordinates don't get away from the current tile too much, but needs to be rendered fast, we could implement an alternative code path that completely avoids worker communication and tiling. It would need a different API though. @ansis what do you think?

@robschley
Copy link

This would also help us. We have some use cases that require manipulating a very small amount of data via the setData API and flickering/lag is noticeable.

@jfirebaugh jfirebaugh modified the milestone: v0.6.0 Feb 4, 2015
@mourner
Copy link
Member

mourner commented Feb 11, 2015

Grabbing this today.

@mourner
Copy link
Member

mourner commented Feb 13, 2015

@robschley try now!

@robschley
Copy link

@mourner The flicker is gone when using the setData() API, it is still a little jumpy if the setData API is called frequently but it does not flicker all the data which is a huge improvement. I wonder if it would be possible to animate/transition when using setData()? I suspect that would be a lot of work but it might be something to add to the backlog. Thanks for tackling this issue!

@mourner
Copy link
Member

mourner commented Feb 16, 2015

@robschley hmm, can you demonstrate the jumpiness with a JSFiddle? I haven't seen that.

@samarth1sharma
Copy link

Instead of using icon, use mapbox marker.
Dynamically vary the latLng of the marker by requesting animation with the help of requestAnimationFrame() function and a very smooth animation can be produced.
Works perfectly fine for me!.

The problem with mapbox icon is that its custom setData() method takes sometime to update the source and so the next animation frame is requested before the data is updated in the source.This causes flickering.
Using mapbox marker, this can be solved.
And then background-image css property can be used to assign a custom image to the marker.

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

Successfully merging a pull request may close this issue.

6 participants