@zia_leung/leaflet.canvaslayer 1.0.0 → 1.0.1

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.
@@ -1,2 +1 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a=e();for(var n in a)("object"==typeof exports?exports:t)[n]=a[n]}}(globalThis,(()=>(()=>{"use strict";var t={d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CanvasLayer:()=>a,default:()=>n}),L.DomUtil.setTransform||(L.DomUtil.setTransform=function(t,e,a){var n=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(a?" scale("+a+")":"")});var a=(L.Layer?L.Layer:L.Class).extend({initialize:function(t){this._map=null,this._canvas=null,this._frame=null,this._delegate=null,this._paneBak=null,L.setOptions(this,t)},delegate:function(t){return this._delegate=t,this},needRedraw:function(){return this._frame||(this._frame=L.Util.requestAnimFrame(this.drawLayer,this)),this},_onLayerDidResize:function(t){this._canvas.width=t.newSize.x,this._canvas.height=t.newSize.y},_onLayerDidMove:function(){if(this._map){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t),this.drawLayer()}},getEvents:function(){var t={resize:this._onLayerDidResize,moveend:this._onLayerDidMove};return this._map.options.zoomAnimation&&L.Browser.any3d&&(t.zoomanim=this._animateZoom),t},onAdd:function(t){this._map=t,this._canvas=L.DomUtil.create("canvas","leaflet-layer"),this.tiles={};var e=this._map.getSize();this._canvas.width=e.x,this._canvas.height=e.y;var a=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(this._canvas,"leaflet-zoom-"+(a?"animated":"hide")),this._paneBak=this._map.getPane(this.options.pane)||this._map._panes.overlayPane,this._paneBak.appendChild(this._canvas),t.on(this.getEvents(),this);var n=this._delegate||this;n.onLayerDidMount&&n.onLayerDidMount();var i=this;setTimeout((function(){i._onLayerDidMove()}),0)},onRemove:function(t){var e=this._delegate||this;e.onLayerWillUnmount&&e.onLayerWillUnmount(),this._paneBak.removeChild(this._canvas),t.off(this.getEvents(),this),this._canvas=null},addTo:function(t){return t.addLayer(this),this},LatLonToMercator:function(t){return{x:6378137*t.lng*Math.PI/180,y:6378137*Math.log(Math.tan((90+t.lat)*Math.PI/360))}},drawLayer:function(){var t=this._map.getSize(),e=this._map.getBounds(),a=this._map.getZoom(),n=this.LatLonToMercator(this._map.getCenter()),i=this.LatLonToMercator(this._map.containerPointToLatLng(this._map.getSize())),o=this._delegate||this;o.onDrawLayer&&o.onDrawLayer({layer:this,canvas:this._canvas,bounds:e,size:t,zoom:a,center:n,corner:i}),this._frame=null},_setTransform:function(t,e,a){var n=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(a?" scale("+a+")":"")},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),a=L.Layer?this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),t.zoom,t.center):this._map._getCenterOffset(t.center)._multiplyBy(-e).subtract(this._map._getMapPanePos());L.DomUtil.setTransform(this._canvas,a,e)}});const n=a;return"undefined"!=typeof window&&window.L&&(window.L.CanvasLayer=a),e})()));
2
- //# sourceMappingURL=canvaslayer-browser.js.map
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var a in i)("object"==typeof exports?exports:t)[a]=i[a]}}(globalThis,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var a in i)t.o(i,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:i[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CanvasLayer:()=>i,default:()=>a}),L.DomUtil.setTransform||(L.DomUtil.setTransform=function(t,e,i){var a=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+a.x+"px,"+a.y+"px)":"translate3d("+a.x+"px,"+a.y+"px,0)")+(i?" scale("+i+")":"")});var i=(L.Layer?L.Layer:L.Class).extend({initialize:function(t){this._map=null,this._canvas=null,this._frame=null,this._delegate=null,this._paneBak=null,L.setOptions(this,t)},delegate:function(t){return this._delegate=t,this},needRedraw:function(){return this._frame||(this._frame=L.Util.requestAnimFrame(this.drawLayer,this)),this},_onLayerDidResize:function(t){var e=this._map.getSize(),i=window.devicePixelRatio||1;this._canvas.width=e.x*i,this._canvas.height=e.y*i,this._canvas.style.width=e.x+"px",this._canvas.style.height=e.y+"px"},_onLayerDidMove:function(){if(this._map){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t),this._zooming||this.drawLayer()}},getEvents:function(){var t={resize:this._onLayerDidResize,moveend:this._onLayerDidMove,zoomstart:this._onZoomStart,zoomend:this._onZoomEnd,move:this._onMove};return this._map.options.zoomAnimation&&L.Browser.any3d&&(t.zoomanim=this._animateZoom),t},onAdd:function(t){this._map=t,this._canvas=L.DomUtil.create("canvas","leaflet-layer"),this.tiles={},this._zooming=!1,this._moving=!1;var e=this._map.getSize(),i=window.devicePixelRatio||1;this._canvas.width=e.x*i,this._canvas.height=e.y*i,this._canvas.style.width=e.x+"px",this._canvas.style.height=e.y+"px";var a=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(this._canvas,"leaflet-zoom-"+(a?"animated":"hide")),this._paneBak=this._map.getPane(this.options.pane)||this._map._panes.overlayPane,this._paneBak.appendChild(this._canvas),t.on(this.getEvents(),this);var n=this._delegate||this;n.onLayerDidMount&&n.onLayerDidMount();var o=this;setTimeout((function(){o._onLayerDidMove()}),0)},onRemove:function(t){var e=this._delegate||this;e.onLayerWillUnmount&&e.onLayerWillUnmount(),this._paneBak.removeChild(this._canvas),t.off(this.getEvents(),this),this._canvas=null},addTo:function(t){return t.addLayer(this),this},LatLonToMercator:function(t){return{x:6378137*t.lng*Math.PI/180,y:6378137*Math.log(Math.tan((90+t.lat)*Math.PI/360))}},drawLayer:function(){var t=this._map.getSize(),e=this._map.getBounds(),i=this._map.getZoom(),a=this.LatLonToMercator(this._map.getCenter()),n=this.LatLonToMercator(this._map.containerPointToLatLng(this._map.getSize())),o=this._delegate||this;o.onDrawLayer&&o.onDrawLayer({layer:this,canvas:this._canvas,bounds:e,size:t,zoom:i,center:a,corner:n}),this._frame=null},_setTransform:function(t,e,i){var a=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+a.x+"px,"+a.y+"px)":"translate3d("+a.x+"px,"+a.y+"px,0)")+(i?" scale("+i+")":"")},_onZoomStart:function(){this._zooming=!0},_onZoomEnd:function(){this._zooming=!1,this.drawLayer()},_onMove:function(){this._moving=!0},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=L.Layer?this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),t.zoom,t.center):this._map._getCenterOffset(t.center)._multiplyBy(-e).subtract(this._map._getMapPanePos());L.DomUtil.setTransform(this._canvas,i,e)}});const a=i;return"undefined"!=typeof window&&window.L&&(window.L.CanvasLayer=i),e})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zia_leung/leaflet.canvaslayer",
3
- "version": "1.0.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C,EAAQC,GAClC,IAAIC,EAAMF,GAAU,IAAIJ,EAAEO,MAAM,EAAG,GAEnCJ,EAAGK,MAAMR,EAAEC,QAAQQ,YAAcT,EAAEU,QAAQC,KAAO,aAAeL,EAAIM,EAAI,MAAQN,EAAIO,EAAI,MAAQ,eAAiBP,EAAIM,EAAI,MAAQN,EAAIO,EAAI,UAAYR,EAAQ,UAAYA,EAAQ,IAAM,GAC1L,EAGA4C,aAAc,SAAS4C,GACrB,IAAIxF,EAAQe,KAAKC,KAAKyE,aAAaD,EAAEV,MACjC/E,EAASJ,EAAEe,MACXK,KAAKC,KAAK0E,uBAAuB3E,KAAKC,KAAK6D,YAAYc,eAAgBH,EAAEV,KAAMU,EAAER,QACjFjE,KAAKC,KAAK4E,iBAAiBJ,EAAER,QAAQa,aAAa7F,GAAO8F,SAAS/E,KAAKC,KAAK+E,kBAEhFpG,EAAEC,QAAQC,aAAakB,KAAKE,QAASlB,EAAQC,EAC/C,IAEF,U,MACsB,oBAAXgG,QAA0BA,OAAOrG,IAE1CqG,OAAOrG,EAAEc,YAAcA,G","sources":["webpack://@zia_leung/leaflet.canvaslayer/webpack/universalModuleDefinition","webpack://@zia_leung/leaflet.canvaslayer/webpack/bootstrap","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/define property getters","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/hasOwnProperty shorthand","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/make namespace object","webpack://@zia_leung/leaflet.canvaslayer/./src/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(globalThis, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","if (!L.DomUtil.setTransform) {\n L.DomUtil.setTransform = function(el, offset, scale) {\n var pos = offset || new L.Point(0, 0)\n\n el.style[L.DomUtil.TRANSFORM] = (L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '')\n }\n}\n\n\nexport var CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({\n initialize: function(options) {\n this._map = null\n this._canvas = null\n this._frame = null\n this._delegate = null\n this._paneBak = null\n L.setOptions(this, options)\n },\n\n delegate: function(del) {\n this._delegate = del\n return this\n },\n\n needRedraw: function() {\n if (!this._frame) {\n this._frame = L.Util.requestAnimFrame(this.drawLayer, this)\n }\n return this\n },\n\n _onLayerDidResize: function(resizeEvent) {\n this._canvas.width = resizeEvent.newSize.x\n this._canvas.height = resizeEvent.newSize.y\n },\n \n _onLayerDidMove: function() {\n if (this._map) {\n var topLeft = this._map.containerPointToLayerPoint([0, 0])\n L.DomUtil.setPosition(this._canvas, topLeft)\n this.drawLayer()\n }\n },\n \n getEvents: function() {\n var events = {\n resize: this._onLayerDidResize,\n moveend: this._onLayerDidMove\n }\n if (this._map.options.zoomAnimation && L.Browser.any3d) {\n events.zoomanim = this._animateZoom\n }\n\n return events\n },\n \n onAdd: function(map) {\n this._map = map\n this._canvas = L.DomUtil.create('canvas', 'leaflet-layer')\n this.tiles = {}\n\n var size = this._map.getSize()\n this._canvas.width = size.x\n this._canvas.height = size.y\n\n var animated = this._map.options.zoomAnimation && L.Browser.any3d\n L.DomUtil.addClass(this._canvas, 'leaflet-zoom-' + (animated ? 'animated' : 'hide'))\n this._paneBak = this._map.getPane(this.options.pane) || this._map._panes.overlayPane\n this._paneBak.appendChild(this._canvas)\n map.on(this.getEvents(), this)\n\n var del = this._delegate || this\n del.onLayerDidMount && del.onLayerDidMount() \n // this.needRedraw()\n\n var self = this\n setTimeout(function() {\n self._onLayerDidMove()\n }, 0)\n },\n\n \n onRemove: function(map) {\n var del = this._delegate || this\n del.onLayerWillUnmount && del.onLayerWillUnmount()\n\n this._paneBak.removeChild(this._canvas)\n\n map.off(this.getEvents(), this)\n\n this._canvas = null\n },\n\n \n addTo: function(map) {\n map.addLayer(this)\n return this\n },\n \n LatLonToMercator: function(latlon) {\n return {\n x: (latlon.lng * 6378137 * Math.PI) / 180,\n y: Math.log(Math.tan(((90 + latlon.lat) * Math.PI) / 360)) * 6378137\n }\n },\n\n \n drawLayer: function() {\n var size = this._map.getSize()\n var bounds = this._map.getBounds()\n var zoom = this._map.getZoom()\n\n var center = this.LatLonToMercator(this._map.getCenter())\n var corner = this.LatLonToMercator(this._map.containerPointToLatLng(this._map.getSize()))\n\n var del = this._delegate || this\n del.onDrawLayer &&\n del.onDrawLayer({\n layer: this,\n canvas: this._canvas,\n bounds: bounds,\n size: size,\n zoom: zoom,\n center: center,\n corner: corner\n })\n this._frame = null\n },\n \n _setTransform: function(el, offset, scale) {\n var pos = offset || new L.Point(0, 0)\n\n el.style[L.DomUtil.TRANSFORM] = (L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '')\n },\n\n \n _animateZoom: function(e) {\n var scale = this._map.getZoomScale(e.zoom)\n var offset = L.Layer\n ? this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(), e.zoom, e.center)\n : this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos())\n\n L.DomUtil.setTransform(this._canvas, offset, scale)\n }\n})\nexport default CanvasLayer;\nif (typeof window !== \"undefined\" && window.L) {\n // @ts-expect-error exporting it to window\n window.L.CanvasLayer = CanvasLayer;\n}"],"names":["root","factory","exports","module","define","amd","a","i","globalThis","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","L","DomUtil","setTransform","el","offset","scale","pos","Point","style","TRANSFORM","Browser","ie3d","x","y","CanvasLayer","Layer","Class","extend","initialize","options","this","_map","_canvas","_frame","_delegate","_paneBak","setOptions","delegate","del","needRedraw","Util","requestAnimFrame","drawLayer","_onLayerDidResize","resizeEvent","width","newSize","height","_onLayerDidMove","topLeft","containerPointToLayerPoint","setPosition","getEvents","events","resize","moveend","zoomAnimation","any3d","zoomanim","_animateZoom","onAdd","map","create","tiles","size","getSize","animated","addClass","getPane","pane","_panes","overlayPane","appendChild","on","onLayerDidMount","self","setTimeout","onRemove","onLayerWillUnmount","removeChild","off","addTo","addLayer","LatLonToMercator","latlon","lng","Math","PI","log","tan","lat","bounds","getBounds","zoom","getZoom","center","getCenter","corner","containerPointToLatLng","onDrawLayer","layer","canvas","_setTransform","e","getZoomScale","_latLngToNewLayerPoint","getNorthWest","_getCenterOffset","_multiplyBy","subtract","_getMapPanePos","window"],"sourceRoot":""}
@@ -1,2 +0,0 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var a=e();for(var n in a)("object"==typeof exports?exports:t)[n]=a[n]}}(globalThis,(()=>(()=>{"use strict";var t={d:(e,a)=>{for(var n in a)t.o(a,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:a[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CanvasLayer:()=>a,default:()=>n}),L.DomUtil.setTransform||(L.DomUtil.setTransform=function(t,e,a){var n=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(a?" scale("+a+")":"")});var a=(L.Layer?L.Layer:L.Class).extend({initialize:function(t){this._map=null,this._canvas=null,this._frame=null,this._delegate=null,this._paneBak=null,L.setOptions(this,t)},delegate:function(t){return this._delegate=t,this},needRedraw:function(){return this._frame||(this._frame=L.Util.requestAnimFrame(this.drawLayer,this)),this},_onLayerDidResize:function(t){this._canvas.width=t.newSize.x,this._canvas.height=t.newSize.y},_onLayerDidMove:function(){if(this._map){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t),this.drawLayer()}},getEvents:function(){var t={resize:this._onLayerDidResize,moveend:this._onLayerDidMove};return this._map.options.zoomAnimation&&L.Browser.any3d&&(t.zoomanim=this._animateZoom),t},onAdd:function(t){this._map=t,this._canvas=L.DomUtil.create("canvas","leaflet-layer"),this.tiles={};var e=this._map.getSize();this._canvas.width=e.x,this._canvas.height=e.y;var a=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(this._canvas,"leaflet-zoom-"+(a?"animated":"hide")),this._paneBak=this._map.getPane(this.options.pane)||this._map._panes.overlayPane,this._paneBak.appendChild(this._canvas),t.on(this.getEvents(),this);var n=this._delegate||this;n.onLayerDidMount&&n.onLayerDidMount();var i=this;setTimeout((function(){i._onLayerDidMove()}),0)},onRemove:function(t){var e=this._delegate||this;e.onLayerWillUnmount&&e.onLayerWillUnmount(),this._paneBak.removeChild(this._canvas),t.off(this.getEvents(),this),this._canvas=null},addTo:function(t){return t.addLayer(this),this},LatLonToMercator:function(t){return{x:6378137*t.lng*Math.PI/180,y:6378137*Math.log(Math.tan((90+t.lat)*Math.PI/360))}},drawLayer:function(){var t=this._map.getSize(),e=this._map.getBounds(),a=this._map.getZoom(),n=this.LatLonToMercator(this._map.getCenter()),i=this.LatLonToMercator(this._map.containerPointToLatLng(this._map.getSize())),o=this._delegate||this;o.onDrawLayer&&o.onDrawLayer({layer:this,canvas:this._canvas,bounds:e,size:t,zoom:a,center:n,corner:i}),this._frame=null},_setTransform:function(t,e,a){var n=e||new L.Point(0,0);t.style[L.DomUtil.TRANSFORM]=(L.Browser.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(a?" scale("+a+")":"")},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),a=L.Layer?this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),t.zoom,t.center):this._map._getCenterOffset(t.center)._multiplyBy(-e).subtract(this._map._getMapPanePos());L.DomUtil.setTransform(this._canvas,a,e)}});const n=a;return"undefined"!=typeof window&&window.L&&(window.L.CanvasLayer=a),e})()));
2
- //# sourceMappingURL=canvaslayer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canvaslayer.js","mappings":"CAAA,SAA2CA,EAAMC,GAChD,GAAsB,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,SACb,GAAqB,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,OACP,CACJ,IAAIK,EAAIL,IACR,IAAI,IAAIM,KAAKD,GAAuB,iBAAZJ,QAAuBA,QAAUF,GAAMO,GAAKD,EAAEC,EACvE,CACA,CATD,CASGC,YAAY,I,mBCRf,IAAIC,EAAsB,CCA1BA,EAAwB,CAACP,EAASQ,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAEV,EAASS,IAC5EE,OAAOC,eAAeZ,EAASS,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF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IAE1CqG,OAAOrG,EAAEc,YAAcA,G","sources":["webpack://@zia_leung/leaflet.canvaslayer/webpack/universalModuleDefinition","webpack://@zia_leung/leaflet.canvaslayer/webpack/bootstrap","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/define property getters","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/hasOwnProperty shorthand","webpack://@zia_leung/leaflet.canvaslayer/webpack/runtime/make namespace object","webpack://@zia_leung/leaflet.canvaslayer/./src/index.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(globalThis, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","if (!L.DomUtil.setTransform) {\n L.DomUtil.setTransform = function(el, offset, scale) {\n var pos = offset || new L.Point(0, 0)\n\n el.style[L.DomUtil.TRANSFORM] = (L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '')\n }\n}\n\n\nexport var CanvasLayer = (L.Layer ? L.Layer : L.Class).extend({\n initialize: function(options) {\n this._map = null\n this._canvas = null\n this._frame = null\n this._delegate = null\n this._paneBak = null\n L.setOptions(this, options)\n },\n\n delegate: function(del) {\n this._delegate = del\n return this\n },\n\n needRedraw: function() {\n if (!this._frame) {\n this._frame = L.Util.requestAnimFrame(this.drawLayer, this)\n }\n return this\n },\n\n _onLayerDidResize: function(resizeEvent) {\n this._canvas.width = resizeEvent.newSize.x\n this._canvas.height = resizeEvent.newSize.y\n },\n \n _onLayerDidMove: function() {\n if (this._map) {\n var topLeft = this._map.containerPointToLayerPoint([0, 0])\n L.DomUtil.setPosition(this._canvas, topLeft)\n this.drawLayer()\n }\n },\n \n getEvents: function() {\n var events = {\n resize: this._onLayerDidResize,\n moveend: this._onLayerDidMove\n }\n if (this._map.options.zoomAnimation && L.Browser.any3d) {\n events.zoomanim = this._animateZoom\n }\n\n return events\n },\n \n onAdd: function(map) {\n this._map = map\n this._canvas = L.DomUtil.create('canvas', 'leaflet-layer')\n this.tiles = {}\n\n var size = this._map.getSize()\n this._canvas.width = size.x\n this._canvas.height = size.y\n\n var animated = this._map.options.zoomAnimation && L.Browser.any3d\n L.DomUtil.addClass(this._canvas, 'leaflet-zoom-' + (animated ? 'animated' : 'hide'))\n this._paneBak = this._map.getPane(this.options.pane) || this._map._panes.overlayPane\n this._paneBak.appendChild(this._canvas)\n map.on(this.getEvents(), this)\n\n var del = this._delegate || this\n del.onLayerDidMount && del.onLayerDidMount() \n // this.needRedraw()\n\n var self = this\n setTimeout(function() {\n self._onLayerDidMove()\n }, 0)\n },\n\n \n onRemove: function(map) {\n var del = this._delegate || this\n del.onLayerWillUnmount && del.onLayerWillUnmount()\n\n this._paneBak.removeChild(this._canvas)\n\n map.off(this.getEvents(), this)\n\n this._canvas = null\n },\n\n \n addTo: function(map) {\n map.addLayer(this)\n return this\n },\n \n LatLonToMercator: function(latlon) {\n return {\n x: (latlon.lng * 6378137 * Math.PI) / 180,\n y: Math.log(Math.tan(((90 + latlon.lat) * Math.PI) / 360)) * 6378137\n }\n },\n\n \n drawLayer: function() {\n var size = this._map.getSize()\n var bounds = this._map.getBounds()\n var zoom = this._map.getZoom()\n\n var center = this.LatLonToMercator(this._map.getCenter())\n var corner = this.LatLonToMercator(this._map.containerPointToLatLng(this._map.getSize()))\n\n var del = this._delegate || this\n del.onDrawLayer &&\n del.onDrawLayer({\n layer: this,\n canvas: this._canvas,\n bounds: bounds,\n size: size,\n zoom: zoom,\n center: center,\n corner: corner\n })\n this._frame = null\n },\n \n _setTransform: function(el, offset, scale) {\n var pos = offset || new L.Point(0, 0)\n\n el.style[L.DomUtil.TRANSFORM] = (L.Browser.ie3d ? 'translate(' + pos.x + 'px,' + pos.y + 'px)' : 'translate3d(' + pos.x + 'px,' + pos.y + 'px,0)') + (scale ? ' scale(' + scale + ')' : '')\n },\n\n \n _animateZoom: function(e) {\n var scale = this._map.getZoomScale(e.zoom)\n var offset = L.Layer\n ? this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(), e.zoom, e.center)\n : this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos())\n\n L.DomUtil.setTransform(this._canvas, offset, scale)\n }\n})\nexport default CanvasLayer;\nif (typeof window !== \"undefined\" && window.L) {\n // @ts-expect-error exporting it to window\n window.L.CanvasLayer = CanvasLayer;\n}"],"names":["root","factory","exports","module","define","amd","a","i","globalThis","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","L","DomUtil","setTransform","el","offset","scale","pos","Point","style","TRANSFORM","Browser","ie3d","x","y","CanvasLayer","Layer","Class","extend","initialize","options","this","_map","_canvas","_frame","_delegate","_paneBak","setOptions","delegate","del","needRedraw","Util","requestAnimFrame","drawLayer","_onLayerDidResize","resizeEvent","width","newSize","height","_onLayerDidMove","topLeft","containerPointToLayerPoint","setPosition","getEvents","events","resize","moveend","zoomAnimation","any3d","zoomanim","_animateZoom","onAdd","map","create","tiles","size","getSize","animated","addClass","getPane","pane","_panes","overlayPane","appendChild","on","onLayerDidMount","self","setTimeout","onRemove","onLayerWillUnmount","removeChild","off","addTo","addLayer","LatLonToMercator","latlon","lng","Math","PI","log","tan","lat","bounds","getBounds","zoom","getZoom","center","getCenter","corner","containerPointToLatLng","onDrawLayer","layer","canvas","_setTransform","e","getZoomScale","_latLngToNewLayerPoint","getNorthWest","_getCenterOffset","_multiplyBy","subtract","_getMapPanePos","window"],"sourceRoot":""}