Skip to content

Conversation

prushforth
Copy link
Member

@prushforth prushforth commented Aug 1, 2025

The four use cases in which MapFeatureLayer operates include:

  1. "static" inline <map-feature> child elements of the light DOM <map-layer> node,
    which are potentially siblings of and elements, (among others
    but those are the elements that are renderable as Leaflet layers or parts of
    Leaflet layers, OR "static" remote <map-feature> children fetched from the <map-layer src>
    and re-parented to the shadow root of <map-layer>.
  2. <map-feature> elements that are found in fetched text/mapml documents that are
    rendered and removed as part of the map movement processing handled by
    <map-extent> child <map-link rel="features"> and TemplatedFeaturesOrTilesLayer.
    Typically such features have interactive behaviour (popups) and navigation buttons.
  3. <map-feature> elements returned by <map-link rel="query"> elements that are part
    of <map-extent> contents. The popups created by these features are tricky and
    have popup navigation button controls in the popup content, created by code
    in this repository.
  4. <map-feature> elements that are fetched and rendered as part of the processing
    of <map-extent> child <map-link rel="tile" type="text/mapml">. These features
    are not interactive; they are rendered according to provided styles,
    but they don't have popups, relying instead on query links per 3, above.

This PR mostly affects use cases 1 & 2 above:

Refactor FeatureLayer as MapFeatureLayer
map-feature.js custom elements create a MapFeatureLayer when they connect.
and share it between adjacent map-feature elements if applicable.
The FeatureRenderer is also shared among elements of sequences of adjacent <map-feature>s.
Ensure that empty <svg> elements are not left over on moveend by
TemplatedFeaturesOrTilesLayer, by using FeatureRenderer.remove() in the
disconnectedCallback for the last feature in a sequence of <map-feature> elements
to be removed. Add test.
Remove MapLayer.processFeatures function.
Remove MapLayer._mapmlvectors property.
Remove map-layer's map-feature mutation observer (layer.js).
Exclude map-extent from elements that are loaded when fetched by templated content
i.e. a map-extent can't load another map-extent via its map-link(s).

@prushforth prushforth force-pushed the static-features branch 3 times, most recently from 56cd1f7 to 98d9c10 Compare August 13, 2025 16:35
@prushforth prushforth force-pushed the static-features branch 3 times, most recently from 9174611 to d2c4806 Compare September 17, 2025 16:47
@prushforth prushforth marked this pull request as ready for review September 17, 2025 16:49
@prushforth prushforth requested a review from AliyanH September 17, 2025 17:28
Fix tile clean up in MapTileLayer esp for CBMTILE <map-tile>s

Add calculatePosition function to be shared by
  map-extent, -tile, -feature to determine zIndex positioning in parent
  based on how Leaflet layers are created and shared among sibling
  elements in a sequence
Add red/green/blue-tile.png
Add setZIndex function to MapFeatureLayer, MapTileLayer, copied from
MapExtentLayer.
Update MapFeatureLayer, MapExtentLayer, MapTileLayer initialize
constructors to set the zIndex if there's an option present for it

Replace map-extent way of setting zIndex to use map-extent.position
Adapt calculatePosition to working within either shadow root or light DOM

add map-tile tests

make map-tile attributes row,col,zoom immutable; add tests for that

Fix a few small issues with map-tile attributes
Clean up map-feature connectedCallback (remove unused bind)

Add timeouts to decrease flakiness

Replace page screenshots with viewer screenshots

When you remove the src attribute from a layer, it's now empty, and
should NOT be disabled.

Remove test dependency on external services

If this is the last feature or tile to be removed from a static layer
context, i.e. as child of a <map-layer>, the container for the MapFeatureLayer
or the MapTileLayer should be removed from the layer rendered dom;
includes basic tests of this for both types of static content.

Add code+test to ensure that TemplatedFeaturesOrTilesLayer.js does not
allow dynamic content loaded by a <map-link rel=features> to contain a
map-extent

Update map-feature.disconnectedCallback to clean up when it's the last
feature in a MapFeatureLayer being disconnected, make it remove the
<svg> (_container) element created by the renderer.  Because Renderer
inherits from Layer, we can run its remove() method to do this.

Because `disabled` is an observed attribute on <map-linK>, purge the
shadowRoot contents when the link is disabled.

Add test for <svg> count when panning and zooming the map to prevent
regressions hopefully.

Keep count of logged messages by map-layer.getProjection(), limit to 1

Change playwright config which was causing problems locally, will
hopefully not affect CI

Make nodeName dep on returning all CAPS equal by map-tile, map-feature

Remove unused method parameter
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.

1 participant