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

Fix unstable symbol rendering order #1774

Merged
merged 1 commit into from
Dec 1, 2015
Merged

Fix unstable symbol rendering order #1774

merged 1 commit into from
Dec 1, 2015

Conversation

lucaswoj
Copy link
Contributor

@lucaswoj lucaswoj commented Dec 1, 2015

The order of the layers we pass to WorkerTile is related to the order that they were added to the stylesheet, not their logical order.

fixes #1558

cc @scothis @samanpwbb

@lucaswoj
Copy link
Contributor Author

lucaswoj commented Dec 1, 2015

We also do a for ... in iteration over an object in worker_tile.js:101 but I don't think that'll cause any problems (in the browsers that we support)

@scothis
Copy link
Contributor

scothis commented Dec 1, 2015

Doing a for-in over bucketsById is ok as long as the resulting arrays are treated like sets instead of ordered arrays.


for (var id in this._layers) {
ordered.push(this._layers[id].json());
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While not in the official spec, all major JS interpreters will iterate over objects in the order that the keys were added.

If a call to addLayer specifies a before parameter, it'll end up at the end of this array, even though it was intended for elsewhere. Then, during label placement in the worker, the layer will not be ordered correctly, leading to the "unstable symbol layer order" bug.

@mcwhittemore
Copy link
Contributor

Using _order looks safe to me. 👍

@jfirebaugh
Copy link
Contributor

Good catch. 👍

@lucaswoj lucaswoj merged commit d3cca07 into master Dec 1, 2015
@lucaswoj lucaswoj deleted the red-black branch December 1, 2015 18:37
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 this pull request may close these issues.

draw priority is unstable in gl js
4 participants