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

Readded style layers lose all paint properties #7437

Closed

Description

@1ec5

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

Activity

  1. added
    iOS
    macOS
    on Dec 14, 2016
  2. added this to the milestone on Dec 14, 2016
  3. modified the milestones: ios-v3.5.0, ios-v3.4.1 on Jan 24, 2017
  4. 1ec5 commented on Jan 24, 2017

    @1ec5
    ContributorAuthor

    Moving to v3.5.0 because mbgl changes are needed.

  5. modified the milestones: ios-v3.5.0, ios-v3.6.0 on Mar 9, 2017
  6. added
    Core
    on Mar 29, 2017
  7. jfirebaugh commented on Apr 3, 2017

    @jfirebaugh
    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.

  8. removed
    Core
    on Apr 3, 2017
  9. 1ec5 commented on Apr 3, 2017

    @1ec5
    ContributorAuthor

    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.

  10. self-assigned this
    on Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugiOSmacOSruntime styling

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions