Skip to content

Conversation

zbigniewmatysek-tomtom
Copy link
Contributor

@zbigniewmatysek-tomtom zbigniewmatysek-tomtom commented Mar 11, 2025

This PR adds a new map methods: setGlobalStateProperty() and getGlobalState() leveraging the new global-state expression.

Out of the scope: global-expression in layout properties (setGlobalStateProperty() will have no effect on those).

See the style spec update (needs to be merged first) and related issues:
maplibre/maplibre-style-spec#886
#4964

See example:

  • test/examples/filter-symbols-using-global-state.html

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@zbigniewmatysek-tomtom zbigniewmatysek-tomtom changed the title Global state expression [Draft] Global state expression Mar 12, 2025
@zbigniewmatysek-tomtom zbigniewmatysek-tomtom marked this pull request as ready for review May 8, 2025 11:15
@HarelM
Copy link
Collaborator

HarelM commented May 20, 2025

Can you resolve conflicts please? I'll merge this afterwards.

@HarelM
Copy link
Collaborator

HarelM commented May 20, 2025

Ok, one last question: are getLayoutAffectingGlobalStateRefs and _findGlobalStateAffectedSources well covered (>90%)?

@zbigniewmatysek-tomtom
Copy link
Contributor Author

@HarelM I ensured both methods have 100% coverage:

image
image

@HarelM HarelM merged commit 090c66a into maplibre:main May 20, 2025
23 checks passed
hiddewie added a commit to hiddewie/OpenRailwayMap-vector that referenced this pull request Jun 4, 2025
hiddewie added a commit to hiddewie/OpenRailwayMap-vector that referenced this pull request Jun 4, 2025
See https://github.com/maplibre/maplibre-gl-js/releases/tag/v5.6.0

This includes maplibre/maplibre-gl-js#5613
allowing for global map state (like theme and date). Uses
maplibre/maplibre-style-spec#1044,
maplibre/maplibre-style-spec#886,
maplibre/maplibre-gl-js#4964.

Changes: replace `date` with a global state property, to simplify map
rendering and dynamic date changes.
@HarelM HarelM linked an issue Jul 10, 2025 that may be closed by this pull request
@HarelM HarelM mentioned this pull request Jul 10, 2025
melitele pushed a commit to mapwhit/tilerenderer that referenced this pull request Jul 30, 2025
maplibre/maplibre-gl-js#5613

- adds a new map methods: `setGlobalStateProperty` and `getGlobalState`

- `global-state` expression won't work in layout properties
  (`setGlobalStateProperty` will have no effect on those)
melitele pushed a commit to mapwhit/tilerenderer that referenced this pull request Jul 30, 2025
maplibre/maplibre-gl-js#5613

- adds a new map methods: `setGlobalStateProperty` and `getGlobalState`

- `global-state` expression won't work in layout properties
  (`setGlobalStateProperty` will have no effect on those)
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 1, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 1, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 2, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 6, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 8, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Aug 8, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
HarelM pushed a commit that referenced this pull request Aug 9, 2025
* add unit tests checking that sources are reloaded only when necessary on changes of global state rferenced by layout properties

* `global-state` expression support in layout properties

complements `global-state` expression support in filter and paint properties

#5613

* changelog

---------

Co-authored-by: Natalia Kowalczyk <[email protected]>
melitele pushed a commit to melitele/maplibre-gl-js that referenced this pull request Sep 5, 2025
complements `global-state` expression support in filter and paint properties

maplibre#5613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support global map state
2 participants