@nextgis/leaflet-map-adapter 1.16.1 → 1.16.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/leaflet-map-adapter.esm-browser.js +3 -2
- package/lib/leaflet-map-adapter.esm-browser.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-browser.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.js +3 -2
- package/lib/leaflet-map-adapter.esm-bundler.js.map +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js +1 -1
- package/lib/leaflet-map-adapter.esm-bundler.prod.js.map +1 -1
- package/lib/leaflet-map-adapter.global.js +3 -2
- package/lib/leaflet-map-adapter.global.js.map +1 -1
- package/lib/leaflet-map-adapter.global.prod.js +1 -1
- package/lib/leaflet-map-adapter.global.prod.js.map +1 -1
- package/package.json +6 -6
|
@@ -8,5 +8,5 @@ var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
8
8
|
* A collection of Leaflet utilities for working with Web Mapping services.
|
|
9
9
|
* (c) 2014-2016, Houston Engineering, Inc.
|
|
10
10
|
* MIT License
|
|
11
|
-
*/function q(t){return function(t){function i(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=t.apply(this,e)||this;return n.options.setViewDelay&&(n._update=E((function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];(t=P.exports.GridLayer.prototype._update).call.apply(t,r([n],e,!1))}),n.options.setViewDelay)),n}return e(i,t),i.prototype.createTile=function(t,e){var i=this.getTileUrl(t),n=document.createElement("img");return n.abort=H(i,(function(t){n.src=t,e(null,n)}),this.options.headers),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),n.alt="",n.setAttribute("role","presentation"),n},i.prototype._abortLoading=function(){var t=this._tiles,e=this._tileZoom;for(var i in t)if(t[i].coords.z!==e){var n=t[i].el;n.onload=P.exports.Util.falseFn,n.onerror=P.exports.Util.falseFn,n.complete||(n.abort&&n.abort(),n.src=P.exports.Util.emptyImageUrl,P.exports.DomUtil.remove(n),delete t[i])}},i}(t)}var K=q(function(t){function i(e,i){var n=t.call(this,e,i)||this;return Object.assign(n.options,i),n}return e(i,t),i}(P.exports.TileLayer)),Y=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e(o,t),o.prototype.addLayer=function(t){if(this.options=Object.assign(this.options,t),t){var e=t.url,o=n(t,["url"]);if(e){var s=i({pane:this.pane,attribution:o.attribution,minZoom:o.minZoom,maxZoom:o.maxZoom},o.nativeOptions);o.subdomains&&(s.subdomains=o.subdomains);return o.headers?new K(e,i(i({},s),{headers:o.headers,setViewDelay:o.setViewDelay})):new P.exports.TileLayer(e,s)}}},o}(W),J=q(function(t){function i(e,i){return t.call(this,e,i)||this}return e(i,t),i}(P.exports.TileLayer.WMS)),X=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e(o,t),o.prototype.addLayer=function(t){Object.assign(this.options,t);var e=t.url,o=n(t,["url"]);if(e){var s=i({pane:this.pane,attribution:o.attribution,minZoom:o.minZoom,maxZoom:o.maxZoom,layers:t.layers,format:t.format},t.nativeOptions);return o.headers?new J(e,i(i({},s),{headers:o.headers})):new P.exports.TileLayer.WMS(e,s)}},o}(W),$=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.addLayer=function(e){return t.prototype.addLayer.call(this,i(i({name:"OpenStreetMap",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},e),{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}))},n}(Y);function Q(t){return[[t[3],t[0]],[t[1],t[2]]]}var tt=function(){function t(){this.options={target:"map"},this.layerAdapters=t.layerAdapters,this.controlAdapters=t.controlAdapters,this.emitter=new h.exports.EventEmitter,this._unselectCb=[],this._universalEvents=["move","zoom","zoomend","zoomstart","moveend","movestart"],this._positionEvents=["mousemove","mouseout","mouseover"]}return t.prototype.create=function(t){var e=this;if(this.options=i({},t),this.options.target){var n=this.options,o=n.zoom,s=n.center,r=n.maxZoom,a=n.minZoom,h=n.maxBounds,u=n.mapAdapterOptions;this.map=this.options.map||new P.exports.Map(this.options.target,i({attributionControl:!1,zoomControl:!1,maxBounds:h?Q(h):void 0,maxZoom:r,minZoom:a,center:s&&[s[1],s[0]],zoom:o},u));var l=this.map.createPane("order-0");this.map._addUnselectCb=function(t){e._addUnselectCb(t)},l.style.zIndex=String(0),this.emitter.emit("create",this),this._addMapListeners()}},t.prototype.destroy=function(){this.map&&this.map.remove(),this._stopWatchSizeChangeToUpdateMinZoom()},t.prototype.getContainer=function(){return this.map&&this.map.getContainer()},t.prototype.getControlContainer=function(){var t=this.map&&this.map._controlContainer;if(t)return t;throw new Error("Leaflet Map is not initialized yet")},t.prototype.setCursor=function(t){this.map&&(this.map.getContainer().style.cursor=t)},t.prototype.setView=function(t,e){var i=this.map;if(i)if(Array.isArray(t)){var n=t[0],o=t[1];this.map&&("number"==typeof e?this.map.setView([o,n],e,{animate:!1}):this.setCenter([n,o]))}else{var s=t.zoom,r=t.center,a=t.maxBounds,h=t.bounds,u=t.minZoom,l=t.maxZoom;if(r&&void 0!==s?this.setView(r,s):(void 0!==s&&this.setZoom(s),r&&this.setCenter(r)),h&&this.fitBounds(h),void 0!==a)if(a){var c=Q(a);i.setMaxBounds(c),i.setMinZoom(i.getBoundsZoom(c)),this._watchSizeChangeToUpdateMinZoom(c)}else i.setMaxBounds(null),this._stopWatchSizeChangeToUpdateMinZoom();void 0!==l&&i.setMaxZoom(l),void 0!==u&&(this._stopWatchSizeChangeToUpdateMinZoom(),i.setMinZoom(u))}},t.prototype.setCenter=function(t){this.map&&this.map.panTo([t[1],t[0]])},t.prototype.getCenter=function(){var t=this.map;if(t){var e=t.getBounds().getCenter();return[e.lng,e.lat]}},t.prototype.setZoom=function(t){this.map&&this.map.setZoom(t)},t.prototype.getZoom=function(){return this.map&&this.map.getZoom()
|
|
11
|
+
*/function q(t){return function(t){function i(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var n=t.apply(this,e)||this;return n.options.setViewDelay&&(n._update=E((function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];(t=P.exports.GridLayer.prototype._update).call.apply(t,r([n],e,!1))}),n.options.setViewDelay)),n}return e(i,t),i.prototype.createTile=function(t,e){var i=this.getTileUrl(t),n=document.createElement("img");return n.abort=H(i,(function(t){n.src=t,e(null,n)}),this.options.headers),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),n.alt="",n.setAttribute("role","presentation"),n},i.prototype._abortLoading=function(){var t=this._tiles,e=this._tileZoom;for(var i in t)if(t[i].coords.z!==e){var n=t[i].el;n.onload=P.exports.Util.falseFn,n.onerror=P.exports.Util.falseFn,n.complete||(n.abort&&n.abort(),n.src=P.exports.Util.emptyImageUrl,P.exports.DomUtil.remove(n),delete t[i])}},i}(t)}var K=q(function(t){function i(e,i){var n=t.call(this,e,i)||this;return Object.assign(n.options,i),n}return e(i,t),i}(P.exports.TileLayer)),Y=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e(o,t),o.prototype.addLayer=function(t){if(this.options=Object.assign(this.options,t),t){var e=t.url,o=n(t,["url"]);if(e){var s=i({pane:this.pane,attribution:o.attribution,minZoom:o.minZoom,maxZoom:o.maxZoom},o.nativeOptions);o.subdomains&&(s.subdomains=o.subdomains);return o.headers?new K(e,i(i({},s),{headers:o.headers,setViewDelay:o.setViewDelay})):new P.exports.TileLayer(e,s)}}},o}(W),J=q(function(t){function i(e,i){return t.call(this,e,i)||this}return e(i,t),i}(P.exports.TileLayer.WMS)),X=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return e(o,t),o.prototype.addLayer=function(t){Object.assign(this.options,t);var e=t.url,o=n(t,["url"]);if(e){var s=i({pane:this.pane,attribution:o.attribution,minZoom:o.minZoom,maxZoom:o.maxZoom,layers:t.layers,format:t.format},t.nativeOptions);return o.headers?new J(e,i(i({},s),{headers:o.headers})):new P.exports.TileLayer.WMS(e,s)}},o}(W),$=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return e(n,t),n.prototype.addLayer=function(e){return t.prototype.addLayer.call(this,i(i({name:"OpenStreetMap",attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},e),{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}))},n}(Y);function Q(t){return[[t[3],t[0]],[t[1],t[2]]]}var tt=function(){function t(){this.options={target:"map"},this.layerAdapters=t.layerAdapters,this.controlAdapters=t.controlAdapters,this.emitter=new h.exports.EventEmitter,this._unselectCb=[],this._universalEvents=["move","zoom","zoomend","zoomstart","moveend","movestart"],this._positionEvents=["mousemove","mouseout","mouseover"]}return t.prototype.create=function(t){var e=this;if(this.options=i({},t),this.options.target){var n=this.options,o=n.zoom,s=n.center,r=n.maxZoom,a=n.minZoom,h=n.maxBounds,u=n.mapAdapterOptions;this.map=this.options.map||new P.exports.Map(this.options.target,i({attributionControl:!1,zoomControl:!1,maxBounds:h?Q(h):void 0,maxZoom:r,minZoom:a,center:s&&[s[1],s[0]],zoom:o},u));var l=this.map.createPane("order-0");this.map._addUnselectCb=function(t){e._addUnselectCb(t)},l.style.zIndex=String(0),this.emitter.emit("create",this),this._addMapListeners()}},t.prototype.destroy=function(){this.map&&this.map.remove(),this._stopWatchSizeChangeToUpdateMinZoom()},t.prototype.getContainer=function(){return this.map&&this.map.getContainer()},t.prototype.getControlContainer=function(){var t=this.map&&this.map._controlContainer;if(t)return t;throw new Error("Leaflet Map is not initialized yet")},t.prototype.setCursor=function(t){this.map&&(this.map.getContainer().style.cursor=t)},t.prototype.setView=function(t,e){var i=this.map;if(i)if(Array.isArray(t)){var n=t[0],o=t[1];this.map&&("number"==typeof e?this.map.setView([o,n],e,{animate:!1}):this.setCenter([n,o]))}else{var s=t.zoom,r=t.center,a=t.maxBounds,h=t.bounds,u=t.minZoom,l=t.maxZoom;if(r&&void 0!==s?this.setView(r,s):(void 0!==s&&this.setZoom(s),r&&this.setCenter(r)),h&&this.fitBounds(h),void 0!==a)if(a){var c=Q(a);i.setMaxBounds(c),i.setMinZoom(i.getBoundsZoom(c)),this._watchSizeChangeToUpdateMinZoom(c)}else i.setMaxBounds(null),this._stopWatchSizeChangeToUpdateMinZoom();void 0!==l&&i.setMaxZoom(l),void 0!==u&&(this._stopWatchSizeChangeToUpdateMinZoom(),i.setMinZoom(u))}},t.prototype.setCenter=function(t){this.map&&this.map.panTo([t[1],t[0]])},t.prototype.getCenter=function(){var t=this.map;if(t){var e=t.getBounds().getCenter();return[e.lng,e.lat]}},t.prototype.setZoom=function(t){this.map&&this.map.setZoom(t)},t.prototype.getZoom=function(){var t;return null!==(t=this.map&&this.map.getZoom())&&void 0!==t?t:void 0},t.prototype.getBounds=function(){if(this.map){var t=this.map.getBounds(),e=t.getSouthWest(),i=t.getNorthEast();return[e.lng,e.lat,i.lng,i.lat]}},t.prototype.fitBounds=function(t,e){if(void 0===e&&(e={}),this.map){var i=e.maxZoom,n=e.offset,o=e.padding,s={};i&&(s.maxZoom=i),o&&(s.padding=[o,o]),n&&(s.padding=n),this.map.fitBounds(Q(t),s)}},t.prototype.getLayerAdapter=function(e){return t.layerAdapters[e]},t.prototype.createControl=function(t,e){return M(t,e,this)},t.prototype.createButtonControl=function(t){return function(t,e){var i=document.createElement("a"),n=t.title||"";i.href="#",i.title=n,i.setAttribute("role","button"),i.setAttribute("aria-label",n),t.addClass&&i.classList.add(t.addClass),P.exports.DomEvent.disableClickPropagation(i),P.exports.DomEvent.on(i,"click",P.exports.DomEvent.stop),t.html instanceof HTMLElement?i.appendChild(t.html):"string"==typeof t.html&&(i.innerHTML=t.html);var o=function(e){e.stopPropagation(),t.onClick()};return M({onAdd:function(){return void 0!==t.onClick&&i.addEventListener("click",o),i},onRemove:function(){var e=i.parentNode;e&&e.removeChild(i),void 0!==t.onClick&&i.removeEventListener("click",o)}},{bar:!0},e)}(t,this)},t.prototype.addControl=function(t,e){if(t.options.position=e.replace("-",""),this.map)return this.map.addControl(t),t},t.prototype.removeControl=function(t){this.map&&this.map.removeControl(t)},t.prototype.removeLayer=function(t){t&&t.remove&&t.remove()},t.prototype.showLayer=function(t){this.map&&t.addTo(this.map)},t.prototype.hideLayer=function(t){t.remove()},t.prototype.setLayerOpacity=function(t,e){"setOpacity"in t&&t.setOpacity(e)},t.prototype.setLayerOrder=function(t,e,i){},t.prototype.onMapClick=function(t){var e=T(t);this.emitter.emit("preclick",e),this.emitter.emit("click",e)},t.prototype.locate=function(t,e){var i=this.map;if(i&&(i.locate(t),e)){var n=e.locationfound,o=e.locationerror,s=function(t){n({lngLat:[t.latlng.lng,t.latlng.lat]})};void 0!==n&&i.on("locationfound",s,this),o&&i.on("locationerror",o,this);return{stop:function(){void 0!==n&&i.off("locationfound",s),o&&i.off("locationerror",o)}}}return{stop:function(){}}},t.prototype._addUnselectCb=function(t){for(var e=0,i=this._unselectCb;e<i.length;e++){(0,i[e])()}this._unselectCb.length=0,this._unselectCb.push(t)},t.prototype._watchSizeChangeToUpdateMinZoom=function(t){this._stopWatchSizeChangeToUpdateMinZoom();var e=this.getContainer(),i=this.map;e&&i&&window.ResizeObserver&&(this._resizeObserver=new ResizeObserver((function(){i.setMinZoom(i.getBoundsZoom(t))})),this._resizeObserver.observe(e))},t.prototype._stopWatchSizeChangeToUpdateMinZoom=function(){var t=this.map;t&&t.setMinZoom(0),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0)},t.prototype._addMapListeners=function(){var t=this,e=this.map;if(e){e.on("click",(function(e){t.onMapClick(e)}));for(var i=function(i){e.on(i,(function(){return t.emitter.emit(i,t)}),e)},n=0,o=this._universalEvents;n<o.length;n++){i(o[n])}for(var s=function(i){e.on(i,(function(e){return t.emitter.emit(i,T(e))}),e)},r=0,a=this._positionEvents;r<a.length;r++){s(a[r])}}},t.layerAdapters={GEOJSON:F,IMAGE:G,TILE:Y,WMS:X,OSM:$},t.controlAdapters={ZOOM:P.exports.Control.Zoom,ATTRIBUTION:C},t.Map=P.exports.Map,t}(),et=tt;export{et as default};
|
|
12
12
|
//# sourceMappingURL=leaflet-map-adapter.esm-browser.prod.js.map
|