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

Map link custom element implementation #916

Merged
merged 3 commits into from
Mar 8, 2024

Commits on Mar 8, 2024

  1. Create map-link custom element

    - change map-extent._templatedLayer to map-extent._extentLayer
    - add map-extent.getMetaExtent() function to return closest map-meta extent
    - add comments where code should be in map-input for moved code from map-extent etc
    - get rid of map-link `title` attribute, we think never used
    - add comment and methods for map-select custom element in layer control
    - move map-select code from map-extent module to map-select.js
    
    - add comments to attributes to associate them with rel
    
    - remove call to _initTemplateVars from map-extent connectedCallback;
    - set the M.templatedLayer templateVars param to null in map-extent connectedCallback
    - work on map-link _initTemplateVars to get partially working
    - TODO; revisit how the bounds are established for map-link._templateVars
    - prettier formatting...
    
    - add map-link.getBase() function, relies on / supports map-base which
    should simulate how <base> works for remote content.
    - update copyRemoteContentToShadowRoot to copy all children of <map-head>
    to shadow root.
    - use parentElement instead of parentExtent in _initTemplateVars, which
    allows it to not have to wait on connectedCallback to be runnable
    
    - change TemplatedLayer to extend LayerGroup
    - remove TemplatedLayer templates parameter
    - move TemplatedLayer._setupQueryVars to map-link
    - get crs option for TemplatedLayer from map-extent units attribute
    - move creation of MapMLLayer._properties._queries array from map-extent
    into map-link
    - change map-extent._validateDisabled to iterate over querySelectorAll
    over child map-links of selected rel values (image,tile,features,query)
    - delete map-extent.redraw method, corresponding TemplatedLayer.redraw;
    that was needed to redraw the layer when the map-select change event
    happened.  TODO we need to migrate that to map-select.
    - create map-link.mapEl property during connectedCallback
    
    - create map-link.getExtent that incorporates (refactors move + rename
    of) M._extractInputBounds(...)
    - create and use map-link.whenReady() for content links. Used by
    map-extent._calculateBounds when iterating child links.
    
    - create private _getZoomBounds(zoomInput) that is used during template
    / element initialization
    - create public getZoomBounds() which reads the bounds from the result\
    of the above _getZoomBounds(zoomInput), but doesn't require to sift
    through the inputs for linked/non-linked zoom input that might not exist
    - simplify boundsFallback field of _templateVars; remove object props,
    return simple L.Bounds object type
    - add map-link._validateDisabled function which is used by
    map-extent._validateDisabled()
    - refactor map-extent._calculateBounds to use new map-link.getBounds and
    map-link.getZoomBounds API methods
    - update TemplatedTileLayer - pass zoomBounds and extentBounds as
    required options
    
    WIP: add the linkEl.templatedLayer to the
    extentLayerGroup when it is initialized;
    add leaflet.LayerGroup's prototyped initialize function call
    to properly init extentLayerGroup; add image as fallback
    linkEl.type if no type attribute is specified
    
    - non-functional source change: don't use L.extend(options, {}) when
    unnecessary, just pass the options
    
    - Refactor TemplatedImageLayer:
    - replace isVisible property with isVisible methods that will be
    invoked during validateDisabled process
    - add MapExtent.whenLinksReady, use it in Layer._validateDisabled
    - remove MapmlLayer._imageLayer
    - add leaflet FeatureGroup.prototype.initialize
    function call in FeatureLayer.js
    
    - make TemplatedTileLayer use minZoom,minNativeZoom,maxZoom,maxNativeZoom
    calculated and stored as map-link._templateVars.zoomBounds property,
    instead of calculating and usin those values itself (remove duplication)
    - add .zoom property to map-link._templateVars for use by
    TemplatedTileLayer (that layer was doing that itself before breaking
    readability and source code coherence).
    - remove creation of _templateVars.zoom by TemplatedTileLayer
    ._setUpTileTemplateVars initialize sub-process
    - use map-input[type=zoom].initialValue via
    _templateVars.zoom.initialValue when calculating (creating)
    _templateVars.pcrs.bounds property during  TemplatedTileLayer
    ._setUpTileTemplateVars initialize sub-process
    - create map-link._templateVars.inputsReady Promise-valued property
    which returns the Promise.allSettled(child-map-inputs) value
    - make map-link.connectedCallback wait on _templateVars.inputsReady
    promise before using map-input[type=zoom].initialValue
    - move creation of map-input[type=zoom].initialValue property into
    map-input.connectedCallback to avoid map-input.whenReady() promise
    chain for attributChangedCallback on value attribute which prevented
    map-input[type=zoom].initialValue from being available even though the
    map-input was ready for use
    
    - Revert deletion of TemplatedTileLayer.options.minZoom,.maxZoom,
    .minNativeZoom,..maxNativeZoom
    
    - Get map-select quasi working (at least, add it to the layer control)
    
    TemplatedFeaturesLayer:
    
    - Temporary fix for map-link.getFallbackBounds by adding projection as parameter
    - Get map-select working better
    - Create remote templated features in the shadow root of map-link (instead
    of map-extent)
    - Add TemplatedLayer.redraw function in order to delegate map-select
    change event handling across templated layers that may share the variable
    
    map-link[rel=query]:
    
    - get rid of MapMLLayer.queryable property, replace with dynamic
    layer-.queryable() method, which looks for map-link[rel=query] and
    other properties that determine if a layer is queryable
    - create shadowRoot in linkEl for queried features
    - remove shadowRoot from extentEl, since it no longer needs it
    - MapMLLayer.getQueryTemplates radically simplified
    - map-feature now uses shadow root of map-link, not map-extent
    
    - change the order of defines for  map-input and map-select, so that
    they have parentElement.whenReady available to them when booting up.
    
    - delete MapMLLayer._imageContainer
    
    - layer-.queryable only considers a map-link[rel=query]
    if it is in a layer-[checked] in a map-extent[checked]
    - update map-link.getBase to use the (resolved) layer-.src as a base
    against which to resolve any map-base.href, unless it's in local
    content, in which case it uses the map-link.baseURI value as base to
    resolve against
    - restore erroneously removed check for query location to be within
    bounds of the queryable link
    - ensure that the TemplatedLayer.onAdd and .onRemove CALL THE INHERITED
    METHOD OF THE SAME NAME INSTEAD OF SIMPLY OVERRIDING THAT FUNCTION
    This was the cause of much confusion!
    
    - add getMapEl(), getLayerEl() API to map-link
    - add mapEl reference to options for FeatureLayer wherever created
    - update TemplatedFeaturesLayer, TemplatedTileLayer, TemplatedImageLayer
    FeatureLayer .isVisible method so that it doesn't require the layer to be on the
    map when it is run; will use reference to mapEl._map in order to run
    - update DebugOverlay to use linkEl reference to get layerEl ref
    
    - delete map-link._templateVars.boundsFallbackPCRS, unused, problematic
    - change implementation of map-link.getBounds() to use getFallbackBounds
    when necessary, which gets those bounds from the CRS.  map-link.getBounds()
    is called during connectedCallback, so usually the CRS is defined by then.
    - make map-extent.units getter fall back to M.FALLBACK_PROJECTION if no units
    attribute is present
    
    - add 'zoomchangesrc' internal event which can happen during zoom
    animations and when the layer is added to the map. Like its name
    suggests, it changes the layer-.src when called upon based on presence
    of map-link rel=zoom(in|out), changing the source of the layer as
    required
    - small change to FeatureLayer.onAdd to use the passed map parameter
    - get rid of duplicate options.zoomBounds info on Templated(Content)Layer
    
    - re-write logic of map-link.getMapEl and map-link.getLayerEl
    - create _createSelfOrStyleLink() function from part of logic from
    MapMLLayer.getAlternateStyles... the part that applies to a single
    link (generates an option for it).
    - re-code / generalize map-link.whenReady so that it works according
    to the rel value of the link
    - move MapMLLayer.getAlternateStyles() to layer-.getAlternateStyles(links)
    - call it from createLayerControlForLayer
    - try to wrap layer control generation in layer-.connectedCallback in a
    promise for links being ready when generating the layer control.
    Formerly, they didn't have to be ready, just the markup had to be
    available. To be continued...
    
    - working on getting layer control HTML to be part
    of defining whenReady() for layer... tbd, seems never created!
    
    - layer.js: probably want to keep: return shadowRoot from then, not resolve it
    - map-link.js: use L.stamp on just-created div instead of layer, will
    make it more whenReady-independent, if it works
    - map-link.js bind changeStyle listener to layer element; use
    addEventListener instead of L.on
    - comment out _createLicenseLink() for now, reduce console noise
    - createLayerControlForLayer.js: correct typo that meant the styles
    fieldset was not available or being appended to with self style etc links
    
    - get map-link.getLayerControlOption() working for templated links
    - make layer-.connectedCallback wait on map-link.whenReady()
    - add layer-._layerControlHTML to whenReady criteria for readiness
    
    - add extentsReady as a criteria for layer initialization to proceed.
    the problem encountered is that the `checked` attr. change callback
    does a layer-.whenReady() which happens much earlier and doesn't take
    into account the extents' readiness, so some properties of _extentLayer
    aren't set up when the layer-._layer is added to the map, resulting in
    console errors.
    - the MapMLLayer.copyContentToShadowRoot method was setting the href
    attribute of map-link elements erroneously.  Remove that code,
    replaced the map-link.href getter with a better approach.
    - remove code from MapMLLayer that sets up the zoomin/zoomout links,
    move it to map-link href getter, essentially.
    - change MapMLLayer._validateLayerZoom() to use map-link, and
    not _properties.zoomin / zoomout
    - comment out map-link._createZoominOrZoomoutLink() since it isn't
    necessary (perhaps), being handled by the href getter.
    
    - move copyRemoteContentToShadowRoot from MapMLLayer to layer.js
    - remove parentLayer.whenReady() from map-extent.connectedCallback
    - add parentLayer.whenReady() to map-extent.attributeChangedCallback
    for `checked` and `hidden`
    - remove _leafletLayer option from construction of TemplatedLayer
    - move access to _layer pane from TemplatedLayer initialize option to
    onAdd
    - eliminate use of map-extent._DOMnode by map-extent and TemplatedLayer,
    use only map-extent (this) element itself
    - refactor map-extent._projectionMatch() to use the mapEl._map.options.projection
    value instead of that value passed via the MapMLLayer.options.mapprojection
    - update MapMLLayer.selectMatchingAlternateProjection() to use the version
    of mapml content that is saved to shadowRoot, which is now sort of
    unstructured, similar to the way it's expected to be as local content
    of the <layer-> element.
    
    - move attributeChangedCallback
    - select matching alternate projection in fetching of layer.js
    - modify copyRemoteContentToShadowRoot to use documentFragment, to move
    all elements to shadowRoot at once
    - add getBase + selectMatchingAlternateProjection + getProjection method for layer.js
    - map-input, remove dependency from _layer
    - map-link - add temporary _createAlternateLink(), not being USED
    - QueryHandler.js - replace layer._properties with alternate
    
    - MapMLLayer - move out getProjection, selectMatchingAlternateProjection(),
    determineLayerProjection() to layer.js
    - MapMLLayer - get rid of properties object
    
    - refactor promise resolution on mapml-viewer.attributeChangedCallback
    for `projection`.  (To Do: do same to web-map).
    - remove call to mapml-viewer._updateMapCenter() from _map event listeners for:
    'move','movestart','zoom','zoomstart' (To Do: do same to web-map)
    - remove MapMLLayer.copyRemoteContentToShadowRoot
    - update map-input getters for min, max
    - update layer-.extent getter tbd if it breaks tests, but it avoids some
    problems with the layer not being ready
    
    - update layer.-src attributeChangedCallback to not do side effects on
    first pass through lifecylcle callback for remote layer (with src).
    - refactor / rename layer-.selectMatchingAlternateProjection to
    selectAlternateOrChangeProjection. Make it throw when condition(s)
    detected, use it on both remote **and local** content (new behaviour).
    
    - add layer.#hasConnected private so that can avoid attributeChangedCallback
    calls queued by browser on upgrade etc.  Allows to remove individual
    this.whenReady() calls and consequent microtask queue enlargement
    - remove use of inducing layer.connectedCallback by the
    layer.src.attributeChangedCallback - only do the side effects which
    means calling the functions that layer.src.connectedCallback calls,
    seems to prevent inadvertent duplication of content in layer.shadowRoot
    - per advice from HTML Standard, create layer.shadowRoot in constructor
    as well as initialization of opacity.
    - unconditionally purge layer.shadowRoot during onRemove
    - move selectAlternateOrChangeProjection() to after copying content
    to shadow root, insert into next then in promise chain which waits
    on all that contents' whenReady() to settle which can only be done
    there because it needs access to the map-link.getBase() instance
    function to determine the correct URL to load, which isn't a function
    until the map-link and all its "sibling" content becomes ready.
    - add changeprojection messaging to fetch catch block, but don't call
    it a "_fetchError" because that's confusing (not really a fetch error).
    Also, the overall promise should fulfill, just not until after changing the src
    or mapml-viewer.projection as selected.
    - get rid of copy of getBase() on layer, which was cut-and-pasted from
    map-link, and can't work on layer because the document context of
    the map-link is element instance-based and not available to layer.
    - remove the parameter from layer.getProjection(), make it detect whether
    the content is remote (.src exists, so .shadowRoot should contain stuff)
    - change other stuff that relies on layer.shadowRoot to use layer.src
    to detect if layer *should* have a shadowRoot
    - make map-link.whenReady() reject if rel=alternate but no href nor
    projection
    - attempt to map-link.whenReady() to reject with message when await
    used on parentExtent.whenReady() and _templateVars.inputsReady
    
    - validate and update map-link.getBounds(), map-link.getFallbackBounds()
    - add map-link.media attribute, with the idea of prototyping `prefers-map-content`
    proposed media feature
    - update layer on one side of connectedCallback to show where handling
    of map-link.media attribute may go see layer-.checkForPreferredContent()
    - add and use #hasConnected field to map-extent
    - tentatively add mapml-viewer._map.options.minZoom, .maxZoom to allow
    map to use all zoom levels in crs
    - update TemplatedTileLayer.initialize to remove .options.zoomBounds
    property which is / would be information triplication (already have
    TemplatedTileLayer.zoomBounds, .options.minZoom etc, don't need a third)
    
    - add media attribute to map-link, work towards media query support for
    prefers-map-content
    - re-organize promise then/catch for fetches
    - adopt consistent style of detecting projection, prefers-map-content
    etc to throw during loading, triggering src changes
    
    - Convert MapMLLayer to a Layer group + map-feature independence
    - layer- mutation observer to initialize map-features
    - move validateLayerZoom from MapMLLayer -> layer-, and move to validateDisabled, removed from zoomAnim handler
    - remove zoom-in/zoom-out workaround for map projection change #2553
    - remove map-feature's dependency on MapMLLayer, to create it's own layer independently
    - map-feature - rerender feature on min, max, zoom attributes
    - queryHandler no longer appends directly to the map, appends itself to mapmlvectors
    - for templatedFeatures - we move everything from the mapml file's head and body to the shadowroot of map-link
    - layer- always has a shadowRoot, but it is not always used - used based on src attribute
    - map-extent handleChange is not dependent on the parentLayer.checked
    
    - adapt FeatureLayer so that it doesn't expect feature data
    during initialization.  Change options.static to be options.tiles and
    let it be false by default: FeatureLayer is used only for its addData
    function by TemplatedTileLayer, in which case and only in that case
    options.tiles is passed as true;
    
    - adapt TemplatedTileLayer only uses M.featureLayer for access to
    the addData function, which it now calls once for each feature found
    in the fetched MapML vector tile response; map-feature elements are not
    added to the DOM for each feature, only their geometry is rendered as
    SVG <g> and <path> elements.
    
    - adapt TemplatedFeaturesLayer - remove use of options.static which now
    has a default of false
    
    - remove use of M.featureLayer.options.static by MapMLLayer._mapmlvectors,
    because it now has a default of false (and is more correctly called
    options.tiles).
    
    - remove QueryHandler.featureLayer.options.static, because that option
    is false by default and has been renamed to options.tiles
    
    - update map-feature to extend the bounds of the M.featureLayer to which
    it is added, since the bounds of the Leaflet layers are harvested to
    calculate the extent / bounds of the parent <layer-> element.
    
    - add console log of document that causes parser error, useful for
    debugging in geoserver query layers, which serves errors as xml documents
    
    - change layer-.zoomTo() use of whenElemsReady() to use this.whenReady()
    because the layer is only ready after the elements are ready, so
    whenElemsReady() doesn't wait long enough in some cases.
    
    - add M.geometry.layerBounds and M.geometry.zoomBounds via passed options
    of the same name.  Necessary so that the M.featureLayer._layers hash
    table has a value of these properties for every layer it holds, which
    is necessary when setting the bounds of the overall <layer->
    
    - make map-feature getters for zoom,min, max return fallback values if
    the attribute isn't set
    
    - map-feature disconnectedCallback can happen when ancestor elements
    are disconnected, which may have cleaned up  resources used by map-feature,
    so the disconnectedCallback should test if they've been dealt with
    already and not throw errors if so.
    
    - rename-refactor M.FeatureLayer.addData to M.FeatureLayer.renderToLeaflet
    
    - fix bug in map-feature._updateExtent (used non-uppercased comparison
    for tagName value, which returns uppercase always)
    
    - add map-feature.extent.zoom property to match that of layer-.extent
    
    - add map-feature.getMeta API which returns the appropriate map-meta
    element in the ancestors of the map-feature, if any
    
    - update M.FeatureLayer:
    
    - add addLayer(layerToAdd) which conforms to L.LayerGroup API
    - update removeLayer(layerToRemove) to maintain internal structures of
    M.FeatureLayer, including .layerBounds, .zoomBounds and ._layers
    - make removeLayer return this, conforming to L.LayerGroup API
    
    - refactor geometryToLayer to tag it as 'private': _geometryToLayer
    
    - when feature is queried or static, we need to extend the M.featureLayer
    layerBounds and zoomBounds
    
    - for QueryHandler:
    
    - synthesize a <map-geometry><map-point> for all features returned by
    query if they do not posses a <map-geomtry>. Uses :has() because this
    was recently deemed fit for use across browsers, with FF 121
    
    - change approach to parsing: text/mapml documents are handled the same
    way, but mapml documents returned under a different media type should
    get handled ok.  text/html documents will get parsed and appended to
    a synthesized map-feature>map-properties element, which should display
    them as parsed HTML.  Other text documents or unrecognized stuff will
    display as text in the popup, hopefully.
    
    - Updated DebugOverlay: make access to  options._leafletLayer conditional
    on its existence, because it is actually iterating leaflet layers on the
    map and some of them are debug overlay artifacts and don't have a
    _leafletLayer (if _leafletLayer is taken to mean an "M.MapMLLayer"
    instance) tbd
    
    axisInferring.test.js
    
    - update map-feature.js - when calculating extent, don't use the zoom
     fallback value unless no zoom attribute exists. map-feature.zoom
     looks for map-meta in the parentage of the element, but falls back
    to the projection, which is not suitable for calculating extents when
    the coordinates require a zoom value for calculation
    
    - rename M.getBounds to M.getBoundsFromMeta
    
    - add map-meta[name=extent]-based bounds as default layer bounds for
    MapMLLayer._calculateBounds, so that map-meta, _mapmlvectors,
    static tiles and map-extent -generated bounds are additive
    
    - update Util.pointToPCRSPoint and Util.boundsToPCRSBounds logic so
    that zoom parameter is optional for points that don't require a zoom
    to transform i.e. gcrs to pcrs, pcrs to pcrs don't need a zoom value
    
    - update Util.getBoundsFromMeta to throw where it is invoked without
    a zoom where a zoom value is required to convert coordinate system
    i.e. tile,tcrs,tilematrix
    
    - remove fallback cs from Util.getBoundsFromMeta since it could be
    wrong
    
    - remove fallback to zoom = 0 where zoom parameter is not provided,
    throw instead where it could cause a problem
    
    - update axisInferring.html and .test.js.  Add (commented) features
    that represent the bounding box of the map-meta[name=extent], for
    debugging purposes
    
    - update the expectations to expect that the extents of the layers
    involved should include the map-meta[name=extent] bounds AND the
    contents of the layers.
    
    Fix Layer zoomBounds
    - Fix zoomBounds initialization in FeatureLayer.js removeLayer, as
    an empty object is truthy
    - MapMLLayer.js - CalculateBounds() extend zoombounds for staticTileLayer
    and mapmlvectors
    
    - update tests to instead of using the old _templatedLayer, to use
    _extentLayer (renamed).
    
    - update multipleExtentsOpacity.test to slow it down a little, also
    simplify selector for assertion that may have been taking too long
    to evaluate
    
    - Add grunt 'geoserver' task which copies the viewer to the geoserver
    MapML extension 'widget' directory.  Could be improved, as it clobbers
    the license headers in each of the geoserver copies of the file.
    
    - fix kbdAttribution.test.js, add timeout
    - temporarily add test-results.txt for reference of what's failing
    
    - fix markup in featureIndexOverlay.html which used XML self-closing
    syntax for <map-input/>, resulting in incorrect parentElement.
    
    - change '/>' to '>' and close tag where applicable in test/*.html
    where applicable
    
    - fix thrown error during layerContextMenu.test.js due to untested
    map-tile refactoring
    
    - synchronize applicable diff/updates mapml-viewer.js -> web-map.js
    - update a few things to get mapContextMenu.test.js passing
    
    - fix mapElement.test.js
    
    Dynamic layer bounds/zoombounds:
    - layer.js - layercontrol / Hidden API + controls API bug fix
    - map-extent.js - calculateBounds - finish implementation for zoombounds (naitiveZoom)
    - map-feature.js - min/max API - integrate search for map-meta zoom - bug fix
    - Util.js
    - add a new function -> getZoomBoundsFromMeta
    - Revert truncation of extent tcrs and Tilematrix coordinates
    - Reverted tests - axisInferring.test.js, mapContextMenu.test.js, mapElement.test.js,
    - FeatureLayer.js
    - rename renderToLeaflet->createGeometry and _resetFeatures->_validateRendering
    - addLayer - maintain featuresList - moved from createGeometry + recalculates bounds/zoomBounds
    - addRendering/removeRendering - new function to only add/remove geometries from DOM/Leaflet, without recalculating bounds, etc.
    - removeLayer - remove feature from featureslist + recalculate bounds/zoomBounds
    - _validateRendering -> refactor function variable names
    - MapMLLayer.js
    - _calculateBounds - change algorithm to incorporate map-meta and (_staticTileLayer, _mapmlvectors, _extentlayer) to be add together, add same functionality for zoombounds
    - _calculateBounds - merge the _mapmlvectors and _staticTileLayer blocks into one block
    - _calculateBounds - zoombounds and bounds are not treated independently
    - _calculateBounds - extend zoombounds for _staticTileLayer and _mapmlvectors
    - mapFeature.data.js - add zoom object to reflect code
    - mapFeature.test.js - rename use of private property which was changed from _featureGroup -> _geometry
    
    - add map-feature._initialZoom, which captures the zoom of the map
    when the feature is first connected. Used by getter for zoom instead
    of map-meta or projection zoom for static features only.
    
    - refactor rename map-feature.getMaxZoom() to getZoomToZoom()
    
    - change mapFeature test data (expectations) so that the map-feature
    default zoom value for no-zoom-attribute static features is that of
    the map viewer when the feature is first connected.
    
    - change mapFeature.test expectations around zooming to the bounds of
    a map-feature that has no zoom attribute - now it will zoom to the
    zoom value or pretty close to the zoom value of the map when the
    feature was first connected (the bounds of a point feature is based
    on the size of a tile at the zoom level of its zoom value, so
    depending on the size of the map it might zoom to a lower zoom than
    that of the point when it was connected).
    
    - eliminate "fallbackZoom" method and argument for creating geometry.
    FeatureLayer factory method createGeometry uses map-feature.zoom now
    
    - FeatureLayer._validateRendering checks to see if the layer is on
    the map
    
    - geometry _checkRender() now uses map-feature.zoom instead of
    attribute
    
    - for map-feature.zoom: in templated features case, eliminate use of
    projection max zoom, use attribute, map-meta.value, .max or else
    initial zoom.
    
    - for FeatureLayer.isVisible, use .zoomBounds || .options.zoomBounds
    and .layerBounds || .options.layerBounds to determine visibility (was
    using only .zoomBounds and .layerBounds, which didn't cover the
    templated features use case.
    
    - map-link: add conditions for drag/drop 'data-moving' on ancestor
    extent and layer
    
    - featureLayer
     - ensure zoomBounds property has min/maxNativeZoom property which
       reflects the min/maxNativeZoom value range of member map-features
     - add back a zoom parameter to the createGeometry method, because
       it's necessary for templated mapml vector tiles' features for
       which the map-feature is discarded and just the rendered geometry
       is used; in that case the zoom parameter is used to do coordinate
       transformations for the geometry, using the zoom of the tile to
       which the feature belongs.
    
    - globally, remove call to _map._addZoomLimit, replace with _map
    event handler for layeradd, layerremove to call _map.setZoomLimit
    with the zoomBounds for the map at that moment
    (assuming mapml-viewer.extent.zoom is kept up to date with layer
    changes.  Some layers 'unpacked' their zoomBounds object onto their
    options object via L.extend(options, this.zoomBounds), which added
    the individual properties of zoomBounds to the options object for
    the layer. For subclasses of L.GridLayer, that information was used
    to constrain the zoom values to which the map would zoom. That is no
    longer used because of the layeradd/layerremove event handler
    discussed above, so those statements were  globally deleted as well.
    
    - templatedImageLayer
     - get rid of options.minZoom, options.maxZoom (see comment above)
     - get rid of _map._addZoomLimit call (see comment above)
    
    - layer.js
     - add else if block for when a fetch fails due to CORS or other
       fetchy issues. The block adds a _fetchError flag to the layer so
       that whenReady can cut short its timer loop in such a case, as
       the tests for bad layer were taking 5 seconds to fail.
    
    - mapml-viewer.js / web-map.js
     - amend the algorithm for extent.min/maxZoom to use the layers'
       .extent property instead of the _map.getMin/MaxZoom()
     - update _setupEvents; add event handler for layeradd / layerremove
       which calls _map.setMin/MaxZoom(zoom) based on the extent.zoom
       values for min/maxZoom. The addition of the event handler must
       be delayed until whenLayersReady() promise is fulfilled, and
       the event handlers themselves must defer handling the event until
       the whenLayersReady() promise fulfills (layeradd/layerremove
       occur very frequently and don't correlate only to <layer-> layers
      - make disconnectedCallback remove event handlers too
    
    - QueryHandler.js
     - update so that tests pass: there needn't be nodes inside the body
       of an HTML response to a query; this may have changed due to a
       change in chrome behviour.
    
    - map-extent.js
     - separate handling of bounds zoomBounds, so it's easier to
       understand
    
    - TemplatedTileLayer.js
     -  add tile.z to call to M.FeatureLayer.createGeometry per comment
    above
     - maintain TemplatedTileLayer.options.min/maxZoom, because
       L.TileLayer, which this is a subclass of, depends on /requires it
    
    - map-link.js
     - create (empty) _createStylesheetLink() which will need to be
     implemented in next commit, as the styleParing test is failing
     due to lack of implementation here
    
    - TemplatedFeaturesLayer.js
     - create .zoomBounds, .extentBounds properties, delete options.
       zoomBounds, extentBounds
     - remove unpacking of zoomBounds onto options, per global
      discussion above. Remove call to _map._addZoomLimit per above.
     - update onAdd/onRemove handler functions so that it adds/removes
       the added (geometry) layer to the ._features contained / child
       layer used to render the feature geometries for the layer.
     - replace triggering of _map 'moveend' event, replace with call to
       moveend handler function, per longstanding comment.
    
    - path.js
     - replace call to markup.getAttribute('zoom') with markup.zoom,
       in case that is ever called with a map-feature as the markup,
       which seems unlikely now - the zoom seems to be passed as an
       option property always.
    
    - get styleParsing.test.js working:
     - create (and remove) a <link rel=stylesheet> in the templated
       feature container so that styles loaded that way apply to the renderer-generated
       svg <g> elements in the container.
     - update test-results.txt
    
    - recover tileloadstart event functionality
    - get clientTemplatedTileLayer.test.js working
    
    - fix templatedFeaturesLayerStep test
    - fix templatedImageLayer test
    - fix customTCRS test
    
    - fix mapScale.test.js
    
    - update map-feature connected/disconnected callback to look at the
    ancestor layer- or map-extent for data-moving attribute and forego
    doing that in that case (supports drag and drop).
    
    - Get touchDevice.test.js working on linux
    
    Update ci-test.yml - remove --legacy-peer-deps argument to npm install
    
    - add very narrow map-style custom implementation
    - add mutation observer cases for map-link, map-style
    - move M._parseStylesheetAsHTML from Utils to TemplatedTileLayer,
    since that is the only place it is now used from, eventually to be
    removed altogether (see inline TO DO items)
    - remove use of M._parseStylesheetAsHTML from MapMLLayer
    - remove unnecessary _processContent function from MapMLLayer
    - Update TemplatedFeaturesLayer appendStyleLink,
    add complementary appendStyleElement function.  This layer loads
    text/mapml documents dynamically, so it should propagate stylesheets
    and links to same into the shadow root container of the layer.
    - similar updates for TemplatedTileLayer need to be done, as the
    <map-link> element for TemplatedTileLayer does not have a shadow
    root and perhaps it should tbd. Anyway, it needs one if only
    for map-link and map-style elements loaded with the tile text/mapml
    data get connected to the DOM, similar to how it's done with
    TemplatedFeaturesLayer.
    - update some tests that failed because they formerly didn't take
    the map-link and map-style effects into account (because that
    wasn't implemented)
    
    - MapMLLayer._calculateBounds: set .bounds and .zoomBounds to default
    (corresponding property of the layer projection) for empty layers.
    - delete <layer->._layer.bounds in mutation observer when/before
    adding feature, so that the next time something uses <layer->.extent,
    it will be recalculated
    - map-feature: ensure that disconnectedCallback does not throw when
    following links etc.
    
    - update .extent property so that for rel=query it returns an value
    - add map-link.zoomTo() method
    - update map-link._validateDisabled() to account for the fact that
    map-link rel=query link now has an extent
    
    - add elements/map-link test directory, add it to server.js:
    - create locally hosted tiles for osm for zoom=3 to zoom=3
    - add test html file (work in progress, not finished)
    - add empty map-link.test.js wip
    
    MapMLLayer.js:
    - update getQueryTemplates method, add a zoom parameter to make
    behaviour slightly more _map-independent. Affects call to this
    from QueryHandler.js
    -
    
    Refactor rename TemplatedLayer -> ExtentLayer to avoid layer confusion
    - affects: map-extent.js, index.js, renames TemplatedLayer.js to
    ExtentLayer.js, mapSpan.test.js, styleParsing.test.js,
    multipleExtents.test.js, imageStep.test.js,
    templatedImageLayer.test.js, templatedTileLayer.test.js,
    
    QueryHandler.js:
    - remove duplicate test to verify if click location is within the
    bounds of the selected query template (this step was already done
    in MapMLLayer.getQueryTemplates(location, zoom), which was called
    immediately prior).
    
    FeatureLayer.js:
    - rename refactor the this._mapmlFeatures -> this._queryFeatures
    property, so as to read a little less ambiguously
    
    TemplatedImageLayer.js
    - update _scaleImage method, which is invoked repeatedly during
    movend handling.  The main behaviour is wrapped in a setTimeout,
    and the delay sometimes seems to cause the layer's ._map property
    to disappear (removed from map on zoom end due to zoom bounds
    constraint?).  Return / do nothing if obj._map doesn't exist.
    
    map-extent.js:
    
    - copy refactor map-link API methods for .extent, .zoomTo(),
    .getMapEl(), .getLayerEl()
    
    fix bug in map-extent.js getMeta:
    
    - was over-scoping the selection of map-meta elements in parent layer
    to include map-meta elements in sibling map-extent. Fixed using :scope
    > selector.
    
    - add map-link.extent tests for inline and remote
    content. Limitation is that the tests only test
    map-link.rel=image and rel=query so far.
    
    - some tests started failing because they used http:, not https: today.
    Update so that they pass now.
    
    - add <g>._featureEl reference to map-feature from its rendered self
    
    - de-flake new map-link.test.js by reloading the page before testing
    disabled-ness, which is done in a loop, complicating matters
    
    - fix bug in first added or removed map-feature
    
    - fix bug in "Focus Controls" popup navigation button
    - closes Maps4HTML#828
    
    - enable switching from remote to local / inline content
    - closes Maps4HTML#898
    
    - add required tests, all pre-failing
    
    - add tests for map-extent extent
    
    - update selectors for map-meta related to extent
    - add failing tests with comments as reminders
    - next step (besides tests): resolve map-extent use of map-meta
    
    - fix bug in map-extent.getMeta()
    
    - fix min/maxNativeZoom bug in MapMLLayer._calculateBounds
    - update featureLayer.test.js to make it pass with bug fix, add comment
    explaining why
    
    - add _calculateBounds to map-extent
    - add Mutation Observer to map-extent, layer-
    - add Mutation Observer to map-extent, update layer-'s to listen for
    map-meta name=zoom / extent
    - prettier formatting in featureLayer.test.js
    - remove unwritten test from layer-src.test.js (updated extent test in featureLayer.test.js)
    - update / add tests for layer-extent.test that validate the
    effects of the MutationObservers (on layer- and map-extent listening
    for map-meta) on layer-.extent results
    
    - update map-extent.disconnectedCallback to delete the MapMLLayer.bounds
    so that bounds are recalculated
    - get tests working for map-extent
    
    - tests for map-extent api methods zoomTo(), getMapEl(), getLayerEl()
    local and remote and for web-map, where warranted
    - add empty map-feature-extent test to remind of need
    
    - tests for map-link api .extent and zoomTo()
    
    - add map-feature-extent.test.js
    - add map-feature test subdirectory to server.js config
    
    - add test for layer- .extent bounds change with added / removed
    child map-features
    
    - test case for svg tile rendering bug discovered by Andrea
    
    - update test page for render bug
    
    - select only map-feature with actual geometry for tile rendering
    - perttier formating on layer-extent.js
    
    - add "reftest" for 'zinger' rendering bug
    
    Co-authored-by: Aliyan Haq <aliyan.haq@nrcan-rncan.gc.ca>
    Co-authored-by: Hanyu Yao <97408822+yhy0217@users.noreply.github.com>
    3 people authored and prushfor committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    fc17dd8 View commit details
    Browse the repository at this point in the history
  2. Update package.json version -> 0.13.0

    prushfor authored and prushfor committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    182e3b6 View commit details
    Browse the repository at this point in the history
  3. Update package.json version -> 0.13.0

    prushfor authored and prushfor committed Mar 8, 2024
    Configuration menu
    Copy the full SHA
    25678e3 View commit details
    Browse the repository at this point in the history