* Return BOTH min/max(Display)Zoom AND min/maxNativeZoom which * are options that can be passed to GridLayer... * https://leafletjs.com/reference.html#gridlayer-minzoom * * @param {Object} zoomInput - is an element reference to a map-input[type=zoom] * @returns {Object} - returns {min
(zoomInput)
| 943 | * @returns {Object} - returns {minZoom: n,maxZoom: n,minNativeZoom: n,maxNativeZoom: n} |
| 944 | */ |
| 945 | _getZoomBounds(zoomInput) { |
| 946 | // native variables should ONLY come from map-input min/max attributes |
| 947 | // BUT they should fall back to map-meta or projection values for min/max (display) zoom |
| 948 | // display zoom variables should be EQUAL to native unless specified differently |
| 949 | // via map-meta name=zoom |
| 950 | // in particular minNativeZoom being > minZoom can be problematic because |
| 951 | // you fetch tiles at larger scales (i.e. many many small tiles) and render |
| 952 | // them at smaller scale (i.e. little postage stamps), which can freez your |
| 953 | // browser and bury a tile cache in requests, getting you banned/blocked |
| 954 | // |
| 955 | // minZoom = map-meta name=zoom min || input type=zoom min || projection minZoom |
| 956 | // minNativeZoom = input type=zoom min || minZoom |
| 957 | // maxZoom = map-meta name=zoom max || input type=zoom max || projection maxZoom |
| 958 | // maxNativeZoom = input type=zoom max || maxZoom |
| 959 | |
| 960 | let zoomBounds = {}; |
| 961 | // search document from here up, using closest source of zoom bounds info |
| 962 | let meta = this.parentElement.getMeta('zoom'); |
| 963 | let metaMin = meta |
| 964 | ? +Util._metaContentToObject(meta.getAttribute('content'))?.min |
| 965 | : null; |
| 966 | zoomBounds.minZoom = |
| 967 | metaMin || (zoomInput ? +zoomInput.getAttribute('min') : 0); |
| 968 | zoomBounds.minNativeZoom = zoomInput |
| 969 | ? +zoomInput.getAttribute('min') |
| 970 | : zoomBounds.minZoom; |
| 971 | let metaMax = meta |
| 972 | ? +Util._metaContentToObject(meta.getAttribute('content'))?.max |
| 973 | : null; |
| 974 | zoomBounds.maxZoom = |
| 975 | metaMax || |
| 976 | (zoomInput |
| 977 | ? +zoomInput.getAttribute('max') |
| 978 | : M[this.parentElement.units].options.resolutions.length - 1); |
| 979 | zoomBounds.maxNativeZoom = zoomInput |
| 980 | ? +zoomInput.getAttribute('max') |
| 981 | : zoomBounds.maxZoom; |
| 982 | |
| 983 | return zoomBounds; |
| 984 | } |
| 985 | isVisible() { |
| 986 | if (this.disabled) return false; |
| 987 | let isVisible = false, |
no test coverage detected