Skip to content
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

Smart layer update not updating layer properties for existing layers #1241

Open
santilland opened this issue Sep 5, 2024 · 4 comments
Open
Assignees
Labels
bug Something isn't working map

Comments

@santilland
Copy link
Member

We use the layercontrol element in parallel to the map element in a framework.
We make sure the ids for the same layer sources stay the same so that when we pass a new eox-map config the tiles do not need to be reloaded.
The problem is if any of the properties of the layer change, such as visible, opacity, (and i imagine others) through interaction in the layer control, and then a new map config is loaded, it will update the layer control but not the state of the layer in OL.
So e.g. it will show layers as full opacity (although they are not as previously they were configured to half opacity with layer control), or as visible (although they are not as previously it was toggled off) and similar things.
Sometimes properties like "visible" will actually be set in the config, but sometimes not (which should assume the default value is being considered).
Not sure how we want to address this taking into account the current map refactoring.

@santilland santilland added bug Something isn't working map labels Sep 5, 2024
@RobertOrthofer
Copy link
Contributor

To summarize, steps to reproduce:

  • have a tile layer with no special opacity set in the config
  • reduce the opacity in the EOx LayerControl to 50%
  • load a new layer config with the same layer ID, but let's say a different source
    => Expected behaviour: layer has 50% opacity
    => actual behaviour: layer goes back to default (100%) opacity

is this correct?

@santilland
Copy link
Member Author

santilland commented Sep 6, 2024

Not quite, i think the main issue is the disparity of layer control and actual layer state.
So steps to reproduce should be (have not tested this in a "vanilla" environment):

  • load eox-map config with a layer
  • change opacity of layer to 50% in layer controls
  • re-apply same eox-map config
    • expected behavior: layer control and map have the same state (either both show opacity 50% or both are reset to opacity 100%)
    • actual behavior: layer control shows slider set to 100% opacity, map shows layer with 50% opacity

@RobertOrthofer
Copy link
Contributor

@srijitcoder do you reckon this to be a good time for me to look into this? Depending on the state of the refactoring and the urgency of this issue I could look into this right now or after the refactoring

@santilland
Copy link
Member Author

Currently as a remedy i am setting the layers configuration back to an empty array and then to the new configuration. It is not the most efficient, as it reloads all base layers and overlays every time, but i think for now is acceptable, so it is not terribly urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working map
Projects
None yet
Development

No branches or pull requests

2 participants