-
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
Remove paint class support #3643
Conversation
Hmm... what is the right thing to do in Issue: Options:
|
I guess now that I've written that, I'm leaning towards option 2 |
Also TODO: remove |
b7634e1
to
52c95ee
Compare
Rebased off of master instead of being branched off an open PR |
52c95ee
to
fe40f72
Compare
Rebased onto master to fixup minor merge conflict |
@jfirebaugh @lucaswoj updated top of ticket w/ the prerequisites we discussed. |
I use paint classes quite extensively and just stumbled across this. Do you think it's justified to mention in the documentation that paint class support will be deprecated so that we who use it start migrating away from it and new users stay away from it? |
Absolutely @averas. I'll do that ASAP. |
Deprecation flagged here: #4038 |
At this point, all of the technical blockers for merging this have been cleared -- that is, I believe it is now possible to losslessly replace 100% of the use cases of paint classes with So, question: should we look to merge this now (after a rebase/resolve), or should we consider adding setStyle examples to the docs (https://github.com/mapbox/mapbox-gl-js/issues/3660) to be a prerequisite for merging this PR? |
I support considering adding Doing so will give us more confidence that our proposed alternative is sound, give our users more resources to make the transition, and give support more materials to reference. |
I am currently migrating away from paint classes in my own applications so I thought I'd share the challenges that I've hit with the new smart Keeping GeoJSON sources in sync when the user switches styleI would say that it's fairly common that you have "base layers" that constitute the backdrop of your map, and on top of that you have some "custom layers" containing data that you visualise on your map. Sometimes different backdrops, such as with higher contrast, or with a satellite raster fits better, and a common use case is allowing the user to flip the backdrop while retaining the custom layers. I used to fulfil this use case quite straightforwardly using paint classes. Any mutations to my "custom layers" would only require that I updated a single set of sources which allowed me to easily implement tons of filtering etc. With smart Except that copying sources is tedious I think it may become a performance issue as well. It isn't currently so for me, but if you copy a 70-80MB GeoJSON back and fourth between styles it may become one (even if you pass the GeoJSON by reference and really don't copy it per se, I would imagine Mapbox GL JS still would have to parse it every time). It's not just sources, sometimes you want to keep custom layers in sync as wellSome of the layers I have in my applications have their paint properties set dynamically based on user interaction (for example the color stops of a fill). This requires me to copy such layers much like with the sources described above. When I had paint classes I simply let such multi-style-layers have paint properties defined without classes (so they were active regardless of class). |
Thanks for this helpful feedback, @averas !
Interesting point -- I agree that this is an issue that isn't well addressed by the current |
Followed up on the GeoJSON source syncing issue here: #4006 (comment) |
fe40f72
to
93c40fd
Compare
The deprecation of paint classes hit me hard and for me the new setStyle is not a sufficient replacement when you deal with toggleable layers and realtime data at the same time. |
Sorry to hear that, @indus. Our intention was for "smart setStyle" to be sufficient (thus our waiting until it supported changes to |
Prerequisites:
-test-suite
: merge Ignore paint-class tests in gl-js mapbox-gl-test-suite#178 (Ignore paint class tests in gl-js)-style-spec
: merge Drop paint classes mapbox-gl-style-spec#576 (update docs and spec)UPDATE: Removed #3662 (comment) from the prerequisites, in light of
setSprite
being (a) orthogonal to paint classes, and (b) a pretty complicated / significant lift.