File tree Expand file tree Collapse file tree 6 files changed +80
-1
lines changed
Expand file tree Collapse file tree 6 files changed +80
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,10 @@ To get the `<map-layer>`'s opacity value:
124124let layer = document .querySelector (' map-layer' );
125125let opacity = layer .opacity ;
126126```
127+ ---
128+ ### media
129+
130+ Reflects the [ media] ( ../elements/layer#media ) attribute of the ` <layer-> ` element.
127131
128132### extent
129133
Original file line number Diff line number Diff line change @@ -4,6 +4,21 @@ title: HTMLLinkElement
44slug : /api/map-link-api
55---
66
7+ # HTMLLinkElement
8+
9+ The ` <map-link> ` element is intended to implement an extension of the HTML ` <link> `
10+ element and ` HTMLLinkElement ` API. This document reflects proposed changes to that
11+ API and is a work in progress.
12+
13+
14+ ## Properties
15+
16+ ### media
17+
18+ Reflects the [ media] ( ../elements/link#media ) attribute of the ` <map-link> ` element.
19+
20+ ---
21+
722This document is copied from the old "Custom Rendering API" page, and is under
823construction. It will eventually describe the API of the map-link custom element;
924the "Custom Rendering API" is currently sourced from the map-link custom element,
Original file line number Diff line number Diff line change @@ -222,6 +222,7 @@ let zoom = map.zoom;
222222| [ defineCustomProjection(options)] ( #definecustomprojectionoptions ) | Define a custom projection for use by the page. |
223223| [ zoomTo(lat, lon, zoom)] ( #zoomtolat-lon-zoom ) | Fly or pan the map to a (new) location and zoom level.|
224224| [ geojson2mapml(json, options)] ( #zoomtolat-lon-zoom ) | Add a GeoJSON Layer to the map. |
225+ | [ matchMedia(mediaQueryString)] ( #matchmediamediaquerystring ) | Returns a [ MediaQueryList] ( https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList ) object.
225226
226227
227228### back()
@@ -358,6 +359,20 @@ Check out [this application](https://maps4html.org/experiments/api/custom-map-ui
358359
359360---
360361
362+ ### matchMedia(mediaQueryString)
363+
364+ Returns a [ MediaQueryList object] ( https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList ) .
365+ The ` matches ` property of the MediaQueryList object can be used for an instantaneous
366+ determination of if the map meets the media conditions. To react to changes in
367+ the map media conditions, use MediaQueryList.addEventListener('change', callbackFn)
368+ to add an event listener for ` change ` events that are triggered by changes in the
369+ state of the queried map properties (projection, zoom, extent); any change to the
370+ map that results in a change in state of the
371+ [ MediaQueryListEvent ` matches ` boolean property] ( https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/change_event )
372+ triggers the ` change ` event and calls the callbackFn.
373+
374+ ---
375+
361376## Events
362377
363378| Event name | Description |
Original file line number Diff line number Diff line change @@ -63,6 +63,21 @@ and the fetched `<map-title>` element is used.
6363
6464---
6565
66+ ### ` media `
67+
68+ The ` media ` attribute is used to express media conditions under which the layer
69+ content should be used / loaded from ` src ` . Media conditions evaluate to ` true ` or ` false ` .
70+ A layer for which the media condition evaluates to ` false ` is by default hidden.
71+ A layer for which the media condition evaluates to ` true ` is added to the map
72+ according to its ` checked ` attribute, and is added to the layer control according
73+ to its ` hidden ` attribute.
74+
75+ Map media queries can include extended CSS map properties including:
76+ [ projection] ( ../../api/mapml-viewer-api#projection ) , [ zoom] ( ../../api/mapml-viewer-api#zoom ) ,
77+ and [ extent] ( ../../api/mapml-viewer-api#extent ) .
78+
79+ ---
80+
6681### ` opacity `
6782
6883The ` opacity ` attribute is used to set the initial opacity of the ` <map-layer> ` element.
@@ -113,4 +128,4 @@ The following example sets the initial `opacity` for a `<map-layer>`.
113128---
114129
115130> - [ Edit this page on ** Github** ] ( https://github.com/Maps4HTML/web-map-doc/edit/main/docs/elements/layer.md )
116- > - [ Chat with us on ** Gitter** ] ( https://gitter.im/Maps4HTML/chat )
131+ > - [ Chat with us on ** Gitter** ] ( https://gitter.im/Maps4HTML/chat )
Original file line number Diff line number Diff line change @@ -130,6 +130,20 @@ Projection values [defined by the polyfill](../mapml-viewer#projection) include:
130130| Permitted ARIA roles | No roles permitted. |
131131| DOM Interface | [ HTMLLinkElement] ( https://developer.mozilla.org/en-US/docs/Web/API/HTMLLinkElement ) |
132132
133+ ---
134+ ### ` media `
135+
136+ The ` media ` attribute is used to express media conditions under which the linked
137+ content should be loaded from its ` href ` attribute. Media conditions evaluate to ` true ` or ` false ` .
138+ A map-link for which the media condition evaluates to ` false ` is not loaded / unloaded.
139+ Content linked via a map-link for which the media condition evaluates to ` true `
140+ is loaded from its ` href ` attribute; when the condition subsequently evaluates to
141+ ` false ` , the content is unloaded.
142+
143+ Map media queries can include extended CSS map properties including:
144+ [ projection] ( ../../api/mapml-viewer-api#projection ) , [ zoom] ( ../../api/mapml-viewer-api#zoom ) ,
145+ and [ extent] ( ../../api/mapml-viewer-api#extent ) .
146+
133147---
134148
135149## Examples
Original file line number Diff line number Diff line change @@ -6,6 +6,22 @@ slug: /elements/style/
66
77The ` <map-style> ` element allows map authors to embed CSS into map layers. The CSS can be used to style the geometry of the layer using [ ` <map-span> ` ] ( ../../elements/span/ ) , and by setting the class attribute to the [ child elements] ( ../geometry/#child-elements ) of the geometry.
88
9+ ## Attributes
10+
11+ ### ` media `
12+
13+ The ` media ` attribute is used to express media conditions under which the contained
14+ styles should be applied. Media conditions evaluate to ` true ` or ` false ` . A map-style
15+ for which the media condition evaluates to ` false ` is not loaded / removed. Styles
16+ contained in a ` <map-style> ` for which the media condition evaluates to ` true `
17+ are applied; when the condition subsequently evaluates to ` false ` , the styles are removed.
18+
19+ Map media queries can include extended CSS map properties including:
20+ [ projection] ( ../../api/mapml-viewer-api#projection ) , [ zoom] ( ../../api/mapml-viewer-api#zoom ) ,
21+ and [ extent] ( ../../api/mapml-viewer-api#extent ) .
22+
23+ ---
24+
925::: note
1026
1127All the Demo's on the documentation pages contain a "CSS" tab which adds the CSS using the ` <map-style> ` element dynamically.
You can’t perform that action at this time.
0 commit comments