Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Readded style layers lose all paint properties #7437

Closed
1ec5 opened this issue Dec 14, 2016 · 3 comments · Fixed by #8626
Closed

Readded style layers lose all paint properties #7437

1ec5 opened this issue Dec 14, 2016 · 3 comments · Fixed by #8626
Assignees
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Dec 14, 2016

If you remove a layer from a style and add it back in, all its former paint properties are reset to the default values.

To reproduce this issue in macosapp:

  1. Change the style to Streets.
  2. In the Layers sidebar, right-click a symbol layer such as country-layer-lg and go to Delete.
  3. Go to Edit ‣ Undo.

The layer comes back with the right layout properties but the wrong paint properties. For example, the readded symbol layer has the right textField, textSize, textFont, etc. but the wrong textHaloBlur:

before
after

Essentially what macosapp does is to hold onto the selected layers for later insertion before removing them from the style. Given that the layout properties are persisted, I’d imagine the problem lies in core rather than at the SDK or application level.

/cc @boundsj

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling labels Dec 14, 2016
@1ec5 1ec5 added this to the ios-3.4.1 milestone Dec 14, 2016
@1ec5 1ec5 modified the milestones: ios-v3.5.0, ios-v3.4.1 Jan 24, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Jan 24, 2017

Moving to v3.5.0 because mbgl changes are needed.

@1ec5 1ec5 modified the milestones: ios-v3.5.0, ios-v3.6.0 Mar 9, 2017
@jfirebaugh jfirebaugh added the Core The cross-platform C++ core, aka mbgl label Mar 29, 2017
@jfirebaugh
Copy link
Contributor

-[MGLStyle layerFromMBGLLayer:] calls [MGL*StyleLayer initWithIdentifier:source:], which sets _pendingLayer to a new mbgl::style::*Layer. This seems like a bug. Among other things rawLayer and _pendingLayer will wind up pointing to different objects, which appears to be the cause of this bug.

@jfirebaugh jfirebaugh removed the Core The cross-platform C++ core, aka mbgl label Apr 3, 2017
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 3, 2017

Basically

styleLayer.rawLayer = mbglLayer;
needs to be folded into the initializers for the various style layers. We did this more correctly in
- (MGLSource *)sourceFromMBGLSource:(mbgl::style::Source *)source {
for wrapping sources.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling
Projects
None yet
2 participants