-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
set an interim paint in style_layer #9658
Conversation
a71261a
to
7899787
Compare
@asheemmamoowala there is a good use case and a fiddle on https://github.com/mapbox/ibm-cognos-collab/issues/153 |
@asheemmamoowala I'm working on the idea that the race is between:
This really happens for us because we have a dynamic map... users can change the data slot mapping, essentially choosing different data to visualise, our code then removes layers and adds new ones and waits for the map to tell us its loaded I have not found a reliable fiddle for this yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good apart from two nits.
|
||
if (properties.paint) { | ||
// init default paint to cover until recalculate is called | ||
// see https://github.com/mapbox/ibm-cognos-collab/issues/154 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this is not a public issue so it shoudn't be included.
@@ -101,6 +102,13 @@ class StyleLayer extends Evented { | |||
|
|||
this._transitioningPaint = this._transitionablePaint.untransitioned(); | |||
} | |||
|
|||
if (properties.paint) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can remove this if
because there's the same condition above.
Merged as ef0884e, will be part of v1.10.1. Thanks @mannnick24 ! |
this is in place of pr #9574
when a StyleLayer is created its paint member is undefined untill recalculate is called. there are render scenarios where paint is accessed between construction and recalculate being called first time
see https://github.com/mapbox/ibm-cognos-collab/issues/154
Instead of checking whether paint is undefined in a layer when it is used, set an interim possiblyEvaluated value if there are any paint properties.
There is a very simple test for this