This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Implement 'smart' setStyle using diff-and-patch technique #7893
Labels
Core
The cross-platform C++ core, aka mbgl
GL JS parity
For feature parity with Mapbox GL JS
performance
Speed, stability, CPU usage, memory usage, or power usage
tl;dr: port smart setStyle from GL JS.
@jfirebaugh @lucaswoj @mapbox/gl here's my thinking after my (very) initial digging around the gl-native world. Feedback of course very welcome -- my hope is to dive in and start making a mess mid-next week.
Motivation
mbgl::Style
independent ofmbgl::Map
Plan
Introduce 'nested styles', or some alternative.Reason: on its own, a smooth setStyle implementation is not a complete replacement for paint classes. The problem is that the Style can accumulate state--e.g., by way of runtime styling orGeoJSONSource#setData()
/mbgl::GeoJSONSource::setGeoJSON
. With paint classes, it's very easy to have a set of basemap layers with alternative styling for, say, 'day' and 'night' and some interactive layers on top of it. Nested styles doesn't address the GeoJSON source part, but see below under "Design mbgl::Map::setStyle".mbgl::Map::setStyle(Style, ...?)
mbgl::Map::setStyle()
using diff-and-patch method and expose it in SDKsStyle
against themap
's current one, and then apply the necessary operations to the current one. But doing it this way, it might be weird that after callingmap->setStyle(nextStyle)
,nextStyle
won't refer to the map's actual style object.Related: Efficiently apply style changes #2445
The text was updated successfully, but these errors were encountered: