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eACL,EAAI,IAAI,WAAY,KAAK,aAAc,MAG3C,EAAI,IAAI,YAAa,KAAK,SAC1B,EAAI,IAAI,wBAAyB,KAAK,UAEtC,KAAK,cACL,KAAK,eAET,IAGJ,EAAE,aAAa,QAAQ,CACnB,QAAS,EAAE,OAAO,UAAU,QAC5B,YAAa,EAAE,OAAO,UAAU,YAChC,SAAU,EAAE,OAAO,UAAU,WAGjC,EAAE,aAAa,aAAY,WACvB,KAAK,GAAG,OAAQ,KAAK,YAAa,KACtC,GAEH,CA9KD","file":"/npm/leaflet-moving-rotated-marker@0.0.1/leaflet.movingRotatedMarker.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/leaflet-moving-rotated-marker@0.0.1/leaflet.movingRotatedMarker.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function() {\r\n    // save these original methods before they are overwritten\r\n    var proto_initIcon = L.Marker.prototype._initIcon;\r\n    var proto_setPos = L.Marker.prototype._setPos;\r\n\r\n    var oldIE = (L.DomUtil.TRANSFORM === 'msTransform');\r\n\r\n    L.Marker.addInitHook(function () {\r\n        var iconOptions = this.options.icon && this.options.icon.options;\r\n        var iconAnchor = iconOptions && this.options.icon.options.iconAnchor;\r\n        if (iconAnchor) {\r\n            iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px');\r\n        }\r\n        this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom';\r\n        this.options.rotationAngle = this.options.rotationAngle || 0;\r\n\r\n        // Ensure marker keeps rotated during dragging\r\n        this.on('drag', function(e) { e.target._applyRotation(); });\r\n\r\n        this.on('move', this.slideCancel, this);\r\n    });\r\n\r\n    L.Marker.include({\r\n        _slideToUntil:    undefined,\r\n        _slideToDuration: undefined,\r\n        _slideToLatLng:   undefined,\r\n        _slideFromLatLng: undefined,\r\n\r\n        _initIcon: function() {\r\n            proto_initIcon.call(this);\r\n        },\r\n\r\n        _setPos: function (pos) {\r\n            proto_setPos.call(this, pos);\r\n            this._applyRotation();\r\n        },\r\n\r\n        _applyRotation: function () {\r\n            if(this.options.rotationAngle) {\r\n                this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin;\r\n\r\n                if(oldIE) {\r\n                    // for IE 9, use the 2D rotation\r\n                    this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)';\r\n                } else {\r\n                    // for modern browsers, prefer the 3D accelerated version\r\n                    this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)';\r\n                }\r\n            }\r\n        },\r\n\r\n        _onZoom: function(){\r\n            this._isZooming = true;\r\n        },\r\n\r\n        _offZoom: function(){\r\n            this._isZooming = false;\r\n        },\r\n\r\n        _slideTo: function() {\r\n            if (!this._map) return;\r\n            if(this._isZooming) {\r\n                this._slideFrame = L.Util.requestAnimFrame(this._slideTo, this);\r\n                return;\r\n            }\r\n\r\n            this._remaining = this._slideToUntil - performance.now();\r\n\r\n            if (this._remaining < 0) {\r\n                this.setLatLng(this._slideToLatLng);\r\n                this.fire('moveend');\r\n\r\n                return this;\r\n            }\r\n\r\n            var startPoint = this._map.latLngToContainerPoint(this._slideFromLatLng);\r\n            var endPoint   = this._map.latLngToContainerPoint(this._slideToLatLng);\r\n            var percentDone = (this._slideToDuration - this._remaining) / this._slideToDuration;\r\n\r\n            var currPoint = endPoint.multiplyBy(percentDone).add(\r\n                startPoint.multiplyBy(1 - percentDone)\r\n            );\r\n            var currLatLng = this._map.containerPointToLatLng(currPoint)\r\n            this.setLatLng(currLatLng);\r\n\r\n            this.fire('move', {latlng: currLatLng});\r\n\r\n            this._slideFrame = L.Util.requestAnimFrame(this._slideTo, this);\r\n        },\r\n\r\n        setRotationAngle: function(angle) {\r\n            this.options.rotationAngle = angle;\r\n            this.update();\r\n            return this;\r\n        },\r\n\r\n        setRotationOrigin: function(origin) {\r\n            this.options.rotationOrigin = origin;\r\n            this.update();\r\n            return this;\r\n        },\r\n\r\n        // 🍂method slideTo(latlng: LatLng, options: Slide Options): this\r\n        // Moves this marker until `latlng`, like `setLatLng()`, but with a smooth\r\n        // sliding animation. Fires `movestart` and `moveend` events.\r\n        slideTo: function slideTo(latlng, options) {\r\n            if (!this._map) return;\r\n            this._isZooming = false;\r\n            this._slideToDuration = options.duration;\r\n            this._slideToUntil    = performance.now() + options.duration;\r\n            this._slideFromLatLng = this.getLatLng();\r\n            this._slideToLatLng   = latlng;\r\n\r\n            if(options.rotationAngle) {\r\n                this.options.rotationAngle= options.rotationAngle\r\n            }\r\n\r\n            this.fire('movestart');\r\n            this._slideTo();\r\n\r\n            return this;\r\n        },\r\n\r\n        // 🍂method slideCancel(): this\r\n        // Cancels the sliding animation from `slideTo`, if applicable.\r\n        slideCancel: function slideCancel() {\r\n            L.Util.cancelAnimFrame(this._slideFrame);\r\n        },\r\n\r\n        onAdd: function(map){\r\n            this._zoomAnimated = this._zoomAnimated && map.options.markerZoomAnimation;\r\n\r\n            if (this._zoomAnimated) {\r\n                map.on('zoomanim', this._animateZoom, this);\r\n            }\r\n\r\n            // Fix for skipping the marker calculation when zooming\r\n            map.on('zoomstart', this._onZoom, this);\r\n            map.on('zoomend reset moveend', this._offZoom, this);\r\n\r\n            this._initIcon();\r\n            this.update();\r\n\r\n        },\r\n\r\n        onRemove: function(map){\r\n            if (this.dragging && this.dragging.enabled()) {\r\n                this.options.draggable = true;\r\n                this.dragging.removeHooks();\r\n            }\r\n\r\n            if (this._zoomAnimated) {\r\n                map.off('zoomanim', this._animateZoom, this);\r\n            }\r\n\r\n            map.off('zoomstart', this._onZoom);\r\n            map.off('zoomend reset moveend', this._offZoom);\r\n\r\n            this._removeIcon();\r\n            this._removeShadow();\r\n\r\n        },\r\n    });\r\n\r\n    L.CircleMarker.include({\r\n        slideTo: L.Marker.prototype.slideTo,\r\n        slideCancel: L.Marker.prototype.slideCancel,\r\n        _slideTo: L.Marker.prototype._slideTo\r\n    });\r\n\r\n    L.CircleMarker.addInitHook(function(){\r\n        this.on('move', this.slideCancel, this);\r\n    });\r\n\r\n})();"]}