MCPcopy Create free account
hub / github.com/Maps4HTML/MapML.js / zoom

Method zoom

src/map-feature.js:17–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 #hasConnected; // prevents attributeChangedCallback before connectedCallback
16 /* jshint ignore:end */
17 get zoom() {
18 // for templated or queried features ** native zoom is only used for zoomTo() **
19 let meta = {},
20 metaEl = this.getMeta('zoom');
21 if (metaEl)
22 meta = Util._metaContentToObject(metaEl.getAttribute('content'));
23 if (this._parentEl.nodeName === 'MAP-LINK') {
24 // nativeZoom = zoom attribute || (sd.map-meta zoom 'value' || 'max') || this._initialZoom
25 return +(this.hasAttribute('zoom')
26 ? this.getAttribute('zoom')
27 : meta.value
28 ? meta.value
29 : meta.max
30 ? meta.max
31 : this._initialZoom);
32 } else {
33 // for "static" features
34 // nativeZoom zoom attribute || this._initialZoom
35 // NOTE we don't use map-meta here, because the map-meta is the minimum
36 // zoom bounds for the layer, and is extended by additional features
37 // if added / removed during layer lifetime
38 return +(this.hasAttribute('zoom')
39 ? this.getAttribute('zoom')
40 : this._initialZoom);
41 }
42 }
43
44 set zoom(val) {
45 var parsedVal = parseInt(val, 10);

Callers

nothing calls this directly

Calls 3

getMetaMethod · 0.95
getAttributeMethod · 0.80
setAttributeMethod · 0.80

Tested by

no test coverage detected