派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-01-05 1820aef3fb5c926664de1d4d484f64a5c9ba7099
优化逻辑
9个文件已修改
1439 ■■■■ 已修改文件
src/components/plugin/CanvasMarkers.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/CustomPopup.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/Editable.js 161 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/MagicMarker.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/PathDashFlow.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/PathDrag.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/cluster-layer/leaflet.markercluster-src.js 1111 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/wmts_plugins.js 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/tools.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/plugin/CanvasMarkers.js
@@ -75,7 +75,7 @@
            var self = this
            // If we are removed point
            if (marker['minX']) marker = marker.data
      if (marker.minX) marker = marker.data
            var latlng = marker.getLatLng()
            var isDisplaying = self._map.getBounds().contains(latlng)
src/components/plugin/CustomPopup.js
@@ -4,12 +4,12 @@
    L.CustomPopup = L.Popup.extend({
        _initLayout: () => {
            // 此处生成的容器,Leaflet会根据其类名自动适配Transform,匹配样式,所以如果要自定义的话,该部分样式要自己重写,我这里只解决了自适应容器的问题,以下采用原生容器,所以后面我会加上样式覆盖。
            let prefix = 'leaflet-popup'
            let container = (this._container = L.DomUtil.create(
      const prefix = 'leaflet-popup'
      const container = (this._container = L.DomUtil.create(
                    'div',
                    prefix + ' ' + (this.options.className || '') + ' leaflet-zoom-animated'
                ))
            let wrapper = container
      const wrapper = container
            this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper)
            L.DomEvent.disableClickPropagation(wrapper)
                .disableScrollPropagation(this._contentNode)
@@ -26,16 +26,16 @@
            if (!this._map) {
                return
            }
            let pos = this._map.latLngToLayerPoint(this._latlng)
      const pos = this._map.latLngToLayerPoint(this._latlng)
            let offset = L.point(this.options.offset)
            let anchor = [0, 0]
      const anchor = [0, 0]
            if (this._zoomAnimated) {
                setPosition(this._container, pos.add(anchor))
            } else {
                offset = offset.add(pos).add(anchor)
            }
            let bottom = (this._containerBottom = -offset.y)
            let left = (this._containerLeft =
      const bottom = (this._containerBottom = -offset.y)
      const left = (this._containerLeft =
                    -Math.round(this._containerWidth / 2) + offset.x)
            // bottom position the popup in case the height of the popup changes (images loading etc)
            this._container.style.bottom = bottom + 'px'
@@ -43,15 +43,15 @@
        },
        // 重写层级变化触发更新
        _animateZoom: (e) => {
            let pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center)
            let anchor = [0, 0]
      const pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center)
      const anchor = [0, 0]
            setPosition(this._container, pos.add(anchor))
        }
    })
// 重写setTransform,由于不再固定宽度,所以增加translateX(-50%)水平居中
    const setTransform = (el, offset, scale) => {
        let pos = offset || new L.Point(0, 0)
    const pos = offset || new L.Point(0, 0)
        el.style[L.DomUtil.TRANSFORM] =
            (L.Browser.ie3d
                ? 'translate(' + pos.x + 'px,' + pos.y + 'px,0) translateX(-50%)'
src/components/plugin/Editable.js
@@ -142,7 +142,7 @@
            },
            createLineGuide: function() {
                let options = L.extend({
        const options = L.extend({
                    dashArray: '5,10',
                    weight: 1,
                    interactive: false
@@ -259,13 +259,13 @@
            onMouseup: function(e) {
                if (this._mouseDown) {
                    let editor = this._drawingEditor
                    let mouseDown = this._mouseDown
          const editor = this._drawingEditor
          const mouseDown = this._mouseDown
                    this._mouseDown = null
                    editor.onDrawingMouseUp(e)
                    if (this._drawingEditor !== editor) return // onDrawingMouseUp may call unregisterFromDrawing.
                    let origin = L.point(mouseDown.originalEvent.clientX, mouseDown.originalEvent.clientY)
                    let distance = L.point(e.originalEvent.clientX, e.originalEvent.clientY).distanceTo(origin)
          const origin = L.point(mouseDown.originalEvent.clientX, mouseDown.originalEvent.clientY)
          const distance = L.point(e.originalEvent.clientX, e.originalEvent.clientY).distanceTo(origin)
                    if (Math.abs(distance) < 9 * (window.devicePixelRatio || 1)) this._drawingEditor.onDrawingClick(e)
                }
            },
@@ -303,7 +303,7 @@
            // Start drawing a Polyline. If `latlng` is given, a first point will be added. In any case, continuing on user click.
            // If `options` is given, it will be passed to the Polyline class constructor.
            startPolyline: function(latlng, options) {
                let line = this.createPolyline([], options)
        const line = this.createPolyline([], options)
                line.enableEdit(this.map).newShape(latlng)
                return line
            },
@@ -312,7 +312,7 @@
            // Start drawing a Polygon. If `latlng` is given, a first point will be added. In any case, continuing on user click.
            // If `options` is given, it will be passed to the Polygon class constructor.
            startPolygon: function(latlng, options) {
                let polygon = this.createPolygon([], options)
        const polygon = this.createPolygon([], options)
                polygon.enableEdit(this.map).newShape(latlng)
                return polygon
            },
@@ -323,7 +323,7 @@
            // If `options` is given, it will be passed to the Marker class constructor.
            startMarker: function(latlng, options) {
                latlng = latlng || this.map.getCenter().clone()
                let marker = this.createMarker(latlng, options)
        const marker = this.createMarker(latlng, options)
                marker.enableEdit(this.map).startDrawing()
                return marker
            },
@@ -332,9 +332,9 @@
            // Start drawing a Rectangle. If `latlng` is given, the Rectangle anchor will be added. In any case, continuing on user drag.
            // If `options` is given, it will be passed to the Rectangle class constructor.
            startRectangle: function(latlng, options) {
                let corner = latlng || L.latLng([0, 0])
                let bounds = new L.LatLngBounds(corner, corner)
                let rectangle = this.createRectangle(bounds, options)
        const corner = latlng || L.latLng([0, 0])
        const bounds = new L.LatLngBounds(corner, corner)
        const rectangle = this.createRectangle(bounds, options)
                rectangle.enableEdit(this.map).startDrawing()
                return rectangle
            },
@@ -344,7 +344,7 @@
            // If `options` is given, it will be passed to the Circle class constructor.
            startCircle: function(latlng, options) {
                latlng = latlng || this.map.getCenter().clone()
                let circle = this.createCircle(latlng, options)
        const circle = this.createCircle(latlng, options)
                circle.enableEdit(this.map).startDrawing()
                return circle
            },
@@ -355,7 +355,7 @@
            createLayer: function(Klass, latlngs, options) {
                options = L.Util.extend({ editOptions: { editTools: this } }, options)
                let layer = new Klass(latlngs, options)
        const layer = new Klass(latlngs, options)
                // 🍂namespace Editable
                // 🍂event editable:created: LayerEvent
                // Fired when a new feature (Marker, Polyline…) is created.
@@ -508,13 +508,13 @@
            onDrag: function(e) {
                e.vertex = this
                this.editor.onVertexMarkerDrag(e)
                let iconPos = L.DomUtil.getPosition(this._icon)
                let latlng = this._map.layerPointToLatLng(iconPos)
        const iconPos = L.DomUtil.getPosition(this._icon)
        const latlng = this._map.layerPointToLatLng(iconPos)
                this.latlng.update(latlng)
                this._latlng = this.latlng // Push back to Leaflet our reference.
                this.editor.refresh()
                if (this.middleMarker) this.middleMarker.updateLatLng()
                let next = this.getNext()
        const next = this.getNext()
                if (next && next.middleMarker) next.middleMarker.updateLatLng()
            },
@@ -562,7 +562,7 @@
            // 🍂method delete()
            // Delete a vertex and the related LatLng.
            delete: function() {
                let next = this.getNext() // Compute before changing latlng
        const next = this.getNext() // Compute before changing latlng
                this.latlngs.splice(this.getIndex(), 1)
                this.editor.editLayer.removeLayer(this)
                this.editor.onVertexDeleted({ latlng: this.latlng, vertex: this })
@@ -587,10 +587,10 @@
            // Get the previous VertexMarker in the same LatLngs group.
            getPrevious: function() {
                if (this.latlngs.length < 2) return
                let index = this.getIndex()
        const index = this.getIndex()
                let previousIndex = index - 1
                if (index === 0 && this.editor.CLOSED) previousIndex = this.getLastIndex()
                let previous = this.latlngs[previousIndex]
        const previous = this.latlngs[previousIndex]
                if (previous) return previous.__vertex
            },
@@ -598,10 +598,10 @@
            // Get the next VertexMarker in the same LatLngs group.
            getNext: function() {
                if (this.latlngs.length < 2) return
                let index = this.getIndex()
        const index = this.getIndex()
                let nextIndex = index + 1
                if (index === this.getLastIndex() && this.editor.CLOSED) nextIndex = 0
                let next = this.latlngs[nextIndex]
        const next = this.latlngs[nextIndex]
                if (next) return next.__vertex
            },
@@ -613,9 +613,9 @@
            addMiddleMarkers: function() {
                if (!this.editor.hasMiddleMarkers()) return
                let previous = this.getPrevious()
        const previous = this.getPrevious()
                if (previous) this.addMiddleMarker(previous)
                let next = this.getNext()
        const next = this.getNext()
                if (next) next.resetMiddleMarker()
            },
@@ -635,7 +635,7 @@
            // Continue the vertex LatLngs from this vertex. Only active for first and last vertices of a Polyline.
            continue: function() {
                if (!this.editor.continueBackward) return // Only for PolylineEditor
                let index = this.getIndex()
        const index = this.getIndex()
                if (index === 0) this.editor.continueBackward(this.latlngs)
                else if (index === this.getLastIndex()) this.editor.continueForward(this.latlngs)
            }
@@ -672,9 +672,9 @@
            },
            setVisibility: function() {
                let leftPoint = this._map.latLngToContainerPoint(this.left.latlng)
                let rightPoint = this._map.latLngToContainerPoint(this.right.latlng)
                let size = L.point(this.options.icon.options.iconSize)
        const leftPoint = this._map.latLngToContainerPoint(this.left.latlng)
        const rightPoint = this._map.latLngToContainerPoint(this.right.latlng)
        const size = L.point(this.options.icon.options.iconSize)
                if (leftPoint.distanceTo(rightPoint) < size.x * 3) this.hide()
                else this.show()
            },
@@ -693,10 +693,10 @@
            },
            computeLatLng: function() {
                let leftPoint = this.editor.map.latLngToContainerPoint(this.left.latlng)
                let rightPoint = this.editor.map.latLngToContainerPoint(this.right.latlng)
                let y = (leftPoint.y + rightPoint.y) / 2
                let x = (leftPoint.x + rightPoint.x) / 2
        const leftPoint = this.editor.map.latLngToContainerPoint(this.left.latlng)
        const rightPoint = this.editor.map.latLngToContainerPoint(this.right.latlng)
        const y = (leftPoint.y + rightPoint.y) / 2
        const x = (leftPoint.x + rightPoint.x) / 2
                return this.editor.map.containerPointToLatLng([x, y])
            },
@@ -714,8 +714,8 @@
            },
            onMouseDown: function(e) {
                let iconPos = L.DomUtil.getPosition(this._icon)
                let latlng = this.editor.map.layerPointToLatLng(iconPos)
        const iconPos = L.DomUtil.getPosition(this._icon)
        const latlng = this.editor.map.layerPointToLatLng(iconPos)
                e = {
                    originalEvent: e,
                    latlng: latlng
@@ -726,11 +726,11 @@
                if (e._cancelled) return
                this.latlngs.splice(this.index(), 0, e.latlng)
                this.editor.refresh()
                let icon = this._icon
                let marker = this.editor.addVertexMarker(e.latlng, this.latlngs)
        const icon = this._icon
        const marker = this.editor.addVertexMarker(e.latlng, this.latlngs)
                this.editor.onNewVertex(marker)
                /* Hack to workaround browser not firing touchend when element is no more on DOM */
                let parent = marker._icon.parentNode
        const parent = marker._icon.parentNode
                parent.removeChild(marker._icon)
                marker._icon = icon
                parent.appendChild(marker._icon)
@@ -1083,7 +1083,7 @@
                this.fireAndForward('editable:vertex:click', e)
                if (e._cancelled) return
                if (this.tools.drawing() && this.tools._drawingEditor !== this) return
                let index = e.vertex.getIndex()
        const index = e.vertex.getIndex()
                let commit
                if (e.originalEvent.ctrlKey) {
                    this.onVertexMarkerCtrlClick(e)
@@ -1256,7 +1256,7 @@
                if (this._drawing === L.Editable.FORWARD) this._drawnLatLngs.push(latlng)
                else this._drawnLatLngs.unshift(latlng)
                this.feature._bounds.extend(latlng)
                let vertex = this.addVertexMarker(latlng, this._drawnLatLngs)
        const vertex = this.addVertexMarker(latlng, this._drawnLatLngs)
                this.onNewVertex(vertex)
                this.refresh()
            },
@@ -1324,7 +1324,7 @@
            // Add a new shape (Polyline, Polygon) in a multi, and setup up drawing tools to draw it;
            // if optional `latlng` is given, start a path at this point.
            newShape: function(latlng) {
                let shape = this.addNewEmptyShape()
        const shape = this.addNewEmptyShape()
                if (!shape) return
                this.setDrawnLatLngs(shape[0] || shape) // Polygon or polyline
                this.startDrawingForward()
@@ -1337,7 +1337,7 @@
            },
            deleteShape: function(shape, latlngs) {
                let e = { shape: shape }
        const e = { shape: shape }
                L.Editable.makeCancellable(e)
                // 🍂namespace Editable
                // 🍂section Shape events
@@ -1361,13 +1361,13 @@
            _deleteShape: function(shape, latlngs) {
                latlngs = latlngs || this.getLatLngs()
                if (!latlngs.length) return
                let self = this
                let inplaceDelete = function(latlngs, shape) {
        const self = this
        const inplaceDelete = function (latlngs, shape) {
                    // Called when deleting a flat latlngs
                    shape = latlngs.splice(0, Number.MAX_VALUE)
                    return shape
                }
                let spliceDelete = function(latlngs, shape) {
        const spliceDelete = function (latlngs, shape) {
                    // Called when removing a latlngs inside an array
                    latlngs.splice(latlngs.indexOf(shape), 1)
                    if (!latlngs.length) self._deleteShape(latlngs)
@@ -1384,7 +1384,7 @@
            // 🍂method deleteShapeAt(latlng: L.LatLng): Array
            // Remove a path shape at the given `latlng`.
            deleteShapeAt: function(latlng) {
                let shape = this.feature.shapeAt(latlng)
        const shape = this.feature.shapeAt(latlng)
                if (shape) return this.deleteShape(shape)
            },
@@ -1476,7 +1476,7 @@
            addNewEmptyShape: function() {
                if (this.feature._latlngs.length) {
                    let shape = []
          const shape = []
                    this.appendShape(shape)
                    return shape
                } else {
@@ -1494,10 +1494,10 @@
            splitShape: function(shape, index) {
                if (!index || index >= shape.length - 1) return
                this.ensureMulti()
                let shapeIndex = this.feature._latlngs.indexOf(shape)
        const shapeIndex = this.feature._latlngs.indexOf(shape)
                if (shapeIndex === -1) return
                let first = shape.slice(0, index + 1)
                let second = shape.slice(index)
        const first = shape.slice(0, index + 1)
        const second = shape.slice(index)
                // We deal with reference, we don't want twice the same latlng around.
                second[0] = L.latLng(second[0].lat, second[0].lng, second[0].alt)
                this.feature._latlngs.splice(shapeIndex, 1, first, second)
@@ -1522,9 +1522,9 @@
            addNewEmptyHole: function(latlng) {
                this.ensureNotFlat()
                let latlngs = this.feature.shapeAt(latlng)
        const latlngs = this.feature.shapeAt(latlng)
                if (!latlngs) return
                let holes = []
        const holes = []
                latlngs.push(holes)
                return holes
            },
@@ -1532,7 +1532,7 @@
            // 🍂method newHole(latlng?: L.LatLng, index: int)
            // Set up drawing tools for creating a new hole on the Polygon. If the `latlng` param is given, a first point is created.
            newHole: function(latlng) {
                let holes = this.addNewEmptyHole(latlng)
        const holes = this.addNewEmptyHole(latlng)
                if (!holes) return
                this.setDrawnLatLngs(holes)
                this.startDrawingForward()
@@ -1541,7 +1541,7 @@
            addNewEmptyShape: function() {
                if (this.feature._latlngs.length && this.feature._latlngs[0].length) {
                    let shape = []
          const shape = []
                    this.appendShape(shape)
                    return shape
                } else {
@@ -1560,8 +1560,8 @@
            },
            vertexCanBeDeleted: function(vertex) {
                let parent = this.feature.parentShape(vertex.latlngs)
                let idx = L.Util.indexOf(parent, vertex.latlngs)
        const parent = this.feature.parentShape(vertex.latlngs)
        const idx = L.Util.indexOf(parent, vertex.latlngs)
                if (idx > 0) return true // Holes can be totally deleted without removing the layer itself.
                return L.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this, vertex)
            },
@@ -1593,12 +1593,12 @@
            },
            extendBounds: function(e) {
                let index = e.vertex.getIndex()
                let next = e.vertex.getNext()
                let previous = e.vertex.getPrevious()
                let oppositeIndex = (index + 2) % 4
                let opposite = e.vertex.latlngs[oppositeIndex]
                let bounds = new L.LatLngBounds(e.latlng, opposite)
        const index = e.vertex.getIndex()
        const next = e.vertex.getNext()
        const previous = e.vertex.getPrevious()
        const oppositeIndex = (index + 2) % 4
        const opposite = e.vertex.latlngs[oppositeIndex]
        const bounds = new L.LatLngBounds(e.latlng, opposite)
                // Update latlngs by hand to preserve order.
                previous.latlng.update([e.latlng.lat, opposite.lng])
                next.latlng.update([opposite.lat, e.latlng.lng])
@@ -1609,11 +1609,11 @@
            onDrawingMouseDown: function(e) {
                L.Editable.PathEditor.prototype.onDrawingMouseDown.call(this, e)
                this.connect()
                let latlngs = this.getDefaultLatLngs()
        const latlngs = this.getDefaultLatLngs()
                // L.Polygon._convertLatLngs removes last latlng if it equals first point,
                // which is the case here as all latlngs are [0, 0]
                if (latlngs.length === 3) latlngs.push(e.latlng)
                let bounds = new L.LatLngBounds(e.latlng, e.latlng)
        const bounds = new L.LatLngBounds(e.latlng, e.latlng)
                this.updateBounds(bounds)
                this.updateLatLngs(bounds)
                this.refresh()
@@ -1655,8 +1655,8 @@
            },
            updateLatLngs: function(bounds) {
                let latlngs = this.getDefaultLatLngs()
                let newLatlngs = this.feature._boundsToLatLngs(bounds)
        const latlngs = this.getDefaultLatLngs()
        const newLatlngs = this.feature._boundsToLatLngs(bounds)
                // Keep references.
                for (let i = 0; i < latlngs.length; i++) {
                    latlngs[i].update(newLatlngs[i])
@@ -1679,7 +1679,7 @@
                L.Editable.PathEditor.prototype.initialize.call(this, map, feature, options)
                // C.Y.B Modify
                let latlng = this.computeResizeLatLng()
        const latlng = this.computeResizeLatLng()
                // latlng.lat = latlng.lat-0.007855;
                // latlng.lng= latlng.lng-0.1;
@@ -1691,8 +1691,8 @@
            computeResizeLatLng: function() {
                // While circle is not added to the map, _radius is not set.
                // let delta = (this.feature._radius || this.feature._mRadius) * Math.cos(Math.PI / 4)
                let delta = (this.feature._radius || this.feature._mRadius)
                let point = this.map.project(this.feature._latlng)
        const delta = (this.feature._radius || this.feature._mRadius)
        const point = this.map.project(this.feature._latlng)
                // return this.map.unproject([point.x + delta, point.y - delta])
                return this.map.unproject([point.x + delta, point.y])
            },
@@ -1717,7 +1717,7 @@
            },
            resize: function(e) {
                let radius = this.feature._latlng.distanceTo(e.latlng)
        const radius = this.feature._latlng.distanceTo(e.latlng)
                this.feature.setRadius(radius)
            },
@@ -1756,13 +1756,13 @@
        // and `L.Marker`. It adds some methods to them.
        // *When editing is enabled, the editor is accessible on the instance with the
        // `editor` property.*
        let EditableMixin = {
    const EditableMixin = {
            createEditor: function(map) {
                map = map || this._map
                let tools = (this.options.editOptions || {}).editTools || map.editTools
        const tools = (this.options.editOptions || {}).editTools || map.editTools
                if (!tools) throw Error('Unable to detect Editable instance.')
                let Klass = this.options.editorClass || this.getEditorClass(tools)
        const Klass = this.options.editorClass || this.getEditorClass(tools)
                return new Klass(map, this, this.options.editOptions)
            },
@@ -1802,7 +1802,7 @@
        }
        let PolylineMixin = {
    const PolylineMixin = {
            getEditorClass: function(tools) {
                return (tools && tools.options.polylineEditorClass) ? tools.options.polylineEditorClass : L.Editable.PolylineEditor
@@ -1824,11 +1824,10 @@
                if (!latlngs) return false
                let i, k, len
                let part = []
                let p
                let w = this._clickTolerance()
        const w = this._clickTolerance()
                this._projectLatlngs(latlngs, part, this._pxBounds)
                part = part[0]
                p = this._map.latLngToLayerPoint(l)
        const p = this._map.latLngToLayerPoint(l)
                if (!this._pxBounds.contains(p)) {
                    return false
@@ -1843,7 +1842,7 @@
        }
        let PolygonMixin = {
    const PolygonMixin = {
            getEditorClass: function(tools) {
                return (tools && tools.options.polygonEditorClass) ? tools.options.polygonEditorClass : L.Editable.PolygonEditor
@@ -1896,7 +1895,7 @@
        }
        let MarkerMixin = {
    const MarkerMixin = {
            getEditorClass: function(tools) {
                return (tools && tools.options.markerEditorClass) ? tools.options.markerEditorClass : L.Editable.MarkerEditor
@@ -1904,7 +1903,7 @@
        }
        let RectangleMixin = {
    const RectangleMixin = {
            getEditorClass: function(tools) {
                return (tools && tools.options.rectangleEditorClass) ? tools.options.rectangleEditorClass : L.Editable.RectangleEditor
@@ -1912,7 +1911,7 @@
        }
        let CircleMixin = {
    const CircleMixin = {
            getEditorClass: function(tools) {
                return (tools && tools.options.circleEditorClass) ? tools.options.circleEditorClass : L.Editable.CircleEditor
@@ -1920,12 +1919,12 @@
        }
        let keepEditable = function() {
    const keepEditable = function () {
            // Make sure you can remove/readd an editable layer.
            this.on('add', this._onEditableAdd)
        }
        let isFlat = L.LineUtil.isFlat || L.LineUtil._flat || L.Polyline._flat // <=> 1.1 compat.
    const isFlat = L.LineUtil.isFlat || L.LineUtil._flat || L.Polyline._flat // <=> 1.1 compat.
        if (L.Polyline) {
            L.Polyline.include(EditableMixin)
src/components/plugin/MagicMarker.js
@@ -1,8 +1,8 @@
const init = (L) => {
    (function(window) {
        console.log(window)
        let setOptions = function(obj, options) {
            for (let i in options) {
    const setOptions = function (obj, options) {
      for (const i in options) {
                obj[i] = options[i]
            }
            return obj
@@ -21,9 +21,9 @@
                }
            }
            delete options.html
            let magicIconOpts = setOptions(opts, options)
      const magicIconOpts = setOptions(opts, options)
            // console.log(magicIconOpts)
            let magicIcon = L.divIcon(magicIconOpts)
      const magicIcon = L.divIcon(magicIconOpts)
            return magicIcon
        }
src/components/plugin/PathDashFlow.js
@@ -1,7 +1,7 @@
// @class PolyLine
import * as L from 'leaflet'
let DashFlow = () => {
const DashFlow = () => {
    L.Path.mergeOptions({
        // @option dashSpeed: Number
        // The speed of the dash array, in pixels per second
src/components/plugin/PathDrag.js
@@ -7,17 +7,17 @@
        initialize: function(path) {
            this._path = path
            this._canvas = (path._map.getRenderer(path) instanceof L.Canvas)
            let element = this._canvas ? this._path._map.getRenderer(this._path)._container : this._path._path
      const element = this._canvas ? this._path._map.getRenderer(this._path)._container : this._path._path
            L.Draggable.prototype.initialize.call(this, element, element, true)
        },
        _updatePosition: function() {
            let e = { originalEvent: this._lastEvent }
      const e = { originalEvent: this._lastEvent }
            this.fire('drag', e)
        },
        _onDown: function(e) {
            let first = e.touches ? e.touches[0] : e
      const first = e.touches ? e.touches[0] : e
            this._startPoint = new L.Point(first.clientX, first.clientY)
            if (this._canvas && !this._path._containsPoint(this._path._map.mouseEventToLayerPoint(first))) {
                return
@@ -67,10 +67,10 @@
        },
        _onDrag: function(e) {
            let path = this._path
            let event = (e.originalEvent.touches && e.originalEvent.touches.length === 1 ? e.originalEvent.touches[0] : e.originalEvent)
            let newPoint = L.point(event.clientX, event.clientY)
            let latlng = path._map.layerPointToLatLng(newPoint)
      const path = this._path
      const event = (e.originalEvent.touches && e.originalEvent.touches.length === 1 ? e.originalEvent.touches[0] : e.originalEvent)
      const newPoint = L.point(event.clientX, event.clientY)
      const latlng = path._map.layerPointToLatLng(newPoint)
            this._offset = newPoint.subtract(this._startPoint)
            this._startPoint = newPoint
@@ -93,14 +93,14 @@
        latLngToLayerPoint: function(latlng) {
            // Same as map.latLngToLayerPoint, but without the round().
            let projectedPoint = this._path._map.project(L.latLng(latlng))
      const projectedPoint = this._path._map.project(L.latLng(latlng))
            return projectedPoint._subtract(this._path._map.getPixelOrigin())
        },
        updateLatLng: function(latlng) {
            let oldPoint = this.latLngToLayerPoint(latlng)
      const oldPoint = this.latLngToLayerPoint(latlng)
            oldPoint._add(this._offset)
            let newLatLng = this._path._map.layerPointToLatLng(oldPoint)
      const newLatLng = this._path._map.layerPointToLatLng(oldPoint)
            latlng.lat = newLatLng.lat
            latlng.lng = newLatLng.lng
        },
@@ -118,7 +118,7 @@
        eachLatLng: function(callback, context) {
            context = context || this
            let loop = function(latlngs) {
      const loop = function (latlngs) {
                for (let i = 0; i < latlngs.length; i++) {
                    if (L.Util.isArray(latlngs[i])) loop(latlngs[i])
                    else callback.call(context, latlngs[i])
src/components/plugin/cluster-layer/leaflet.markercluster-src.js
@@ -1,4 +1,4 @@
'use strict';
'use strict'
function init(L) {
    /*
     * L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within
@@ -48,176 +48,173 @@
        },
        initialize: function(options) {
            L.Util.setOptions(this, options);
      L.Util.setOptions(this, options)
            if (!this.options.iconCreateFunction) {
                this.options.iconCreateFunction = this._defaultIconCreateFunction;
        this.options.iconCreateFunction = this._defaultIconCreateFunction
            }
            this._featureGroup = L.featureGroup();
            this._featureGroup.addEventParent(this);
      this._featureGroup = L.featureGroup()
      this._featureGroup.addEventParent(this)
            this._nonPointGroup = L.featureGroup();
            this._nonPointGroup.addEventParent(this);
      this._nonPointGroup = L.featureGroup()
      this._nonPointGroup.addEventParent(this)
            this._inZoomAnimation = 0;
            this._needsClustering = [];
            this._needsRemoving = []; // Markers removed while we aren't on the map need to be kept track of
      this._inZoomAnimation = 0
      this._needsClustering = []
      this._needsRemoving = [] // Markers removed while we aren't on the map need to be kept track of
            // The bounds of the currently shown area (from _getExpandedVisibleBounds) Updated on zoom/move
            this._currentShownBounds = null;
      this._currentShownBounds = null
            this._queue = [];
      this._queue = []
            this._childMarkerEventHandlers = {
                'dragstart': this._childMarkerDragStart,
                'move': this._childMarkerMoved,
                'dragend': this._childMarkerDragEnd,
            };
        dragstart: this._childMarkerDragStart,
        move: this._childMarkerMoved,
        dragend: this._childMarkerDragEnd
      }
            //  Hook the appropriate animation methods.
            var animate = L.DomUtil.TRANSITION && this.options.animate;
            L.extend(this, animate ? this._withAnimation : this._noAnimation);
      var animate = L.DomUtil.TRANSITION && this.options.animate
      L.extend(this, animate ? this._withAnimation : this._noAnimation)
            //  Remember which MarkerCluster class to instantiate (animated or not).
            this._markerCluster = animate ? L.MarkerCluster : L.MarkerClusterNonAnimated;
      this._markerCluster = animate ? L.MarkerCluster : L.MarkerClusterNonAnimated
        },
        addLayer: function(layer) {
            if (layer instanceof L.LayerGroup) {
                return this.addLayers([layer]);
        return this.addLayers([layer])
            }
            // Don't cluster non point data
            if (!layer.getLatLng) {
                this._nonPointGroup.addLayer(layer);
                this.fire('layeradd', {layer: layer});
                return this;
        this._nonPointGroup.addLayer(layer)
        this.fire('layeradd', { layer: layer })
        return this
            }
            if (!this._map) {
                this._needsClustering.push(layer);
                this.fire('layeradd', {layer: layer});
                return this;
        this._needsClustering.push(layer)
        this.fire('layeradd', { layer: layer })
        return this
            }
            if (this.hasLayer(layer)) {
                return this;
        return this
            }
            // If we have already clustered we'll need to add this one to a cluster
            if (this._unspiderfy) {
                this._unspiderfy();
        this._unspiderfy()
            }
            this._addLayer(layer, this._maxZoom);
            this.fire('layeradd', {layer: layer});
      this._addLayer(layer, this._maxZoom)
      this.fire('layeradd', { layer: layer })
            //  Refresh bounds and weighted positions.
            this._topClusterLevel._recalculateBounds();
      this._topClusterLevel._recalculateBounds()
            this._refreshClustersIcons();
      this._refreshClustersIcons()
            // Work out what is visible
            var visibleLayer = layer,
                currentZoom = this._zoom;
      var visibleLayer = layer
      var currentZoom = this._zoom
            if (layer.__parent) {
                while (visibleLayer.__parent._zoom >= currentZoom) {
                    visibleLayer = visibleLayer.__parent;
          visibleLayer = visibleLayer.__parent
                }
            }
            if (this._currentShownBounds.contains(visibleLayer.getLatLng())) {
                if (this.options.animateAddingMarkers) {
                    this._animationAddLayer(layer, visibleLayer);
          this._animationAddLayer(layer, visibleLayer)
                } else {
                    this._animationAddLayerNonAnimated(layer, visibleLayer);
          this._animationAddLayerNonAnimated(layer, visibleLayer)
                }
            }
            return this;
      return this
        },
        removeLayer: function(layer) {
            if (layer instanceof L.LayerGroup) {
                return this.removeLayers([layer]);
        return this.removeLayers([layer])
            }
            // Non point layers
            if (!layer.getLatLng) {
                this._nonPointGroup.removeLayer(layer);
                this.fire('layerremove', {layer: layer});
                return this;
        this._nonPointGroup.removeLayer(layer)
        this.fire('layerremove', { layer: layer })
        return this
            }
            if (!this._map) {
                if (!this._arraySplice(this._needsClustering, layer) && this.hasLayer(layer)) {
                    this._needsRemoving.push({layer: layer, latlng: layer._latlng});
          this._needsRemoving.push({ layer: layer, latlng: layer._latlng })
                }
                this.fire('layerremove', {layer: layer});
                return this;
        this.fire('layerremove', { layer: layer })
        return this
            }
            if (!layer.__parent) {
                return this;
        return this
            }
            if (this._unspiderfy) {
                this._unspiderfy();
                this._unspiderfyLayer(layer);
        this._unspiderfy()
        this._unspiderfyLayer(layer)
            }
            // Remove the marker from clusters
            this._removeLayer(layer, true);
            this.fire('layerremove', {layer: layer});
      this._removeLayer(layer, true)
      this.fire('layerremove', { layer: layer })
            //  Refresh bounds and weighted positions.
            this._topClusterLevel._recalculateBounds();
      this._topClusterLevel._recalculateBounds()
            this._refreshClustersIcons();
      this._refreshClustersIcons()
            layer.off(this._childMarkerEventHandlers, this);
      layer.off(this._childMarkerEventHandlers, this)
            if (this._featureGroup.hasLayer(layer)) {
                this._featureGroup.removeLayer(layer);
        this._featureGroup.removeLayer(layer)
                if (layer.clusterShow) {
                    layer.clusterShow();
          layer.clusterShow()
                }
            }
            return this;
      return this
        },
        // Takes an array of markers and adds them in bulk
        addLayers: function(layersArray, skipLayerAddEvent) {
            if (!L.Util.isArray(layersArray)) {
                return this.addLayer(layersArray);
        return this.addLayer(layersArray)
            }
            var fg = this._featureGroup,
                npg = this._nonPointGroup,
                chunked = this.options.chunkedLoading,
                chunkInterval = this.options.chunkInterval,
                chunkProgress = this.options.chunkProgress,
                l = layersArray.length,
                offset = 0,
                originalArray = true,
                m;
      var fg = this._featureGroup
      var npg = this._nonPointGroup
      var chunked = this.options.chunkedLoading
      var chunkInterval = this.options.chunkInterval
      var chunkProgress = this.options.chunkProgress
      var l = layersArray.length
      var offset = 0
      var originalArray = true
      var m
            if (this._map) {
                var started = (new Date()).getTime();
        var started = (new Date()).getTime()
                var process = L.bind(function() {
                    var start = (new Date()).getTime();
          var start = (new Date()).getTime()
                    for (; offset < l; offset++) {
                        if (chunked && offset % 200 === 0) {
                            //  every couple hundred markers, instrument the time elapsed since processing started:
                            var elapsed = (new Date()).getTime() - start;
              var elapsed = (new Date()).getTime() - start
                            if (elapsed > chunkInterval) {
                                break; //  been working too hard, time to take a break :-)
                break //  been working too hard, time to take a break :-)
                            }
                        }
                        m = layersArray[offset];
            m = layersArray[offset]
                        //  Group of layers, append children to layersArray and skip.
                        //  Side effects:
@@ -227,188 +224,187 @@
                        //  http:// jsperf.com/for-loop-changing-length/6
                        if (m instanceof L.LayerGroup) {
                            if (originalArray) {
                                layersArray = layersArray.slice();
                                originalArray = false;
                layersArray = layersArray.slice()
                originalArray = false
                            }
                            this._extractNonGroupLayers(m, layersArray);
                            l = layersArray.length;
                            continue;
              this._extractNonGroupLayers(m, layersArray)
              l = layersArray.length
              continue
                        }
                        // Not point data, can't be clustered
                        if (!m.getLatLng) {
                            npg.addLayer(m);
              npg.addLayer(m)
                            if (!skipLayerAddEvent) {
                                this.fire('layeradd', {layer: m});
                this.fire('layeradd', { layer: m })
                            }
                            continue;
              continue
                        }
                        if (this.hasLayer(m)) {
                            continue;
              continue
                        }
                        this._addLayer(m, this._maxZoom);
            this._addLayer(m, this._maxZoom)
                        if (!skipLayerAddEvent) {
                            this.fire('layeradd', {layer: m});
              this.fire('layeradd', { layer: m })
                        }
                        // If we just made a cluster of size 2 then we need to remove the other marker from the map (if it is) or we never will
                        if (m.__parent) {
                            if (m.__parent.getChildCount() === 2) {
                                var markers = m.__parent.getAllChildMarkers(),
                                    otherMarker = markers[0] === m ? markers[1] : markers[0];
                                fg.removeLayer(otherMarker);
                var markers = m.__parent.getAllChildMarkers()
                var otherMarker = markers[0] === m ? markers[1] : markers[0]
                fg.removeLayer(otherMarker)
                            }
                        }
                    }
                    if (chunkProgress) {
                        //  report progress and time elapsed:
                        chunkProgress(offset, l, (new Date()).getTime() - started);
            chunkProgress(offset, l, (new Date()).getTime() - started)
                    }
                    //  Completed processing all markers.
                    if (offset === l) {
                        //  Refresh bounds and weighted positions.
                        this._topClusterLevel._recalculateBounds();
            this._topClusterLevel._recalculateBounds()
                        this._refreshClustersIcons();
            this._refreshClustersIcons()
                        this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
            this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)
                    } else {
                        setTimeout(process, this.options.chunkDelay);
            setTimeout(process, this.options.chunkDelay)
                    }
                }, this);
        }, this)
                process();
        process()
            } else {
                var needsClustering = this._needsClustering;
        var needsClustering = this._needsClustering
                for (; offset < l; offset++) {
                    m = layersArray[offset];
          m = layersArray[offset]
                    //  Group of layers, append children to layersArray and skip.
                    if (m instanceof L.LayerGroup) {
                        if (originalArray) {
                            layersArray = layersArray.slice();
                            originalArray = false;
              layersArray = layersArray.slice()
              originalArray = false
                        }
                        this._extractNonGroupLayers(m, layersArray);
                        l = layersArray.length;
                        continue;
            this._extractNonGroupLayers(m, layersArray)
            l = layersArray.length
            continue
                    }
                    // Not point data, can't be clustered
                    if (!m.getLatLng) {
                        npg.addLayer(m);
                        continue;
            npg.addLayer(m)
            continue
                    }
                    if (this.hasLayer(m)) {
                        continue;
            continue
                    }
                    needsClustering.push(m);
          needsClustering.push(m)
                }
            }
            return this;
      return this
        },
        // Takes an array of markers and removes them in bulk
        removeLayers: function(layersArray) {
            var i, m,
                l = layersArray.length,
                fg = this._featureGroup,
                npg = this._nonPointGroup,
                originalArray = true;
      var i; var m
      var l = layersArray.length
      var fg = this._featureGroup
      var npg = this._nonPointGroup
      var originalArray = true
            if (!this._map) {
                for (i = 0; i < l; i++) {
                    m = layersArray[i];
          m = layersArray[i]
                    //  Group of layers, append children to layersArray and skip.
                    if (m instanceof L.LayerGroup) {
                        if (originalArray) {
                            layersArray = layersArray.slice();
                            originalArray = false;
              layersArray = layersArray.slice()
              originalArray = false
                        }
                        this._extractNonGroupLayers(m, layersArray);
                        l = layersArray.length;
                        continue;
            this._extractNonGroupLayers(m, layersArray)
            l = layersArray.length
            continue
                    }
                    this._arraySplice(this._needsClustering, m);
                    npg.removeLayer(m);
          this._arraySplice(this._needsClustering, m)
          npg.removeLayer(m)
                    if (this.hasLayer(m)) {
                        this._needsRemoving.push({layer: m, latlng: m._latlng});
            this._needsRemoving.push({ layer: m, latlng: m._latlng })
                    }
                    this.fire('layerremove', {layer: m});
          this.fire('layerremove', { layer: m })
                }
                return this;
        return this
            }
            if (this._unspiderfy) {
                this._unspiderfy();
        this._unspiderfy()
                //  Work on a copy of the array, so that next loop is not affected.
                var layersArray2 = layersArray.slice(),
                    l2 = l;
        var layersArray2 = layersArray.slice()
        var l2 = l
                for (i = 0; i < l2; i++) {
                    m = layersArray2[i];
          m = layersArray2[i]
                    //  Group of layers, append children to layersArray and skip.
                    if (m instanceof L.LayerGroup) {
                        this._extractNonGroupLayers(m, layersArray2);
                        l2 = layersArray2.length;
                        continue;
            this._extractNonGroupLayers(m, layersArray2)
            l2 = layersArray2.length
            continue
                    }
                    this._unspiderfyLayer(m);
          this._unspiderfyLayer(m)
                }
            }
            for (i = 0; i < l; i++) {
                m = layersArray[i];
        m = layersArray[i]
                //  Group of layers, append children to layersArray and skip.
                if (m instanceof L.LayerGroup) {
                    if (originalArray) {
                        layersArray = layersArray.slice();
                        originalArray = false;
            layersArray = layersArray.slice()
            originalArray = false
                    }
                    this._extractNonGroupLayers(m, layersArray);
                    l = layersArray.length;
                    continue;
          this._extractNonGroupLayers(m, layersArray)
          l = layersArray.length
          continue
                }
                if (!m.__parent) {
                    npg.removeLayer(m);
                    this.fire('layerremove', {layer: m});
                    continue;
          npg.removeLayer(m)
          this.fire('layerremove', { layer: m })
          continue
                }
                this._removeLayer(m, true, true);
                this.fire('layerremove', {layer: m});
        this._removeLayer(m, true, true)
        this.fire('layerremove', { layer: m })
                if (fg.hasLayer(m)) {
                    fg.removeLayer(m);
          fg.removeLayer(m)
                    if (m.clusterShow) {
                        m.clusterShow();
            m.clusterShow()
                    }
                }
            }
            //  Refresh bounds and weighted positions.
            this._topClusterLevel._recalculateBounds();
      this._topClusterLevel._recalculateBounds()
            this._refreshClustersIcons();
      this._refreshClustersIcons()
            // Fix up the clusters and markers on the map
            this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
      this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds)
            return this;
      return this
        },
        // Removes all layers from the MarkerClusterGroup
@@ -417,253 +413,253 @@
            // If we aren't on the map (yet), blow away the markers we know of
            if (!this._map) {
                this._needsClustering = [];
                this._needsRemoving = [];
                delete this._gridClusters;
                delete this._gridUnclustered;
        this._needsClustering = []
        this._needsRemoving = []
        delete this._gridClusters
        delete this._gridUnclustered
            }
            if (this._noanimationUnspiderfy) {
                this._noanimationUnspiderfy();
        this._noanimationUnspiderfy()
            }
            // Remove all the visible layers
            this._featureGroup.clearLayers();
            this._nonPointGroup.clearLayers();
      this._featureGroup.clearLayers()
      this._nonPointGroup.clearLayers()
            this.eachLayer(function(marker) {
                marker.off(this._childMarkerEventHandlers, this);
                delete marker.__parent;
            }, this);
        marker.off(this._childMarkerEventHandlers, this)
        delete marker.__parent
      }, this)
            if (this._map) {
                // Reset _topClusterLevel and the DistanceGrids
                this._generateInitialClusters();
        this._generateInitialClusters()
            }
            return this;
      return this
        },
        // Override FeatureGroup.getBounds as it doesn't work
        getBounds: function() {
            var bounds = new L.LatLngBounds();
      var bounds = new L.LatLngBounds()
            if (this._topClusterLevel) {
                bounds.extend(this._topClusterLevel._bounds);
        bounds.extend(this._topClusterLevel._bounds)
            }
            for (var i = this._needsClustering.length - 1; i >= 0; i--) {
                bounds.extend(this._needsClustering[i].getLatLng());
        bounds.extend(this._needsClustering[i].getLatLng())
            }
            bounds.extend(this._nonPointGroup.getBounds());
      bounds.extend(this._nonPointGroup.getBounds())
            return bounds;
      return bounds
        },
        // Overrides LayerGroup.eachLayer
        eachLayer: function(method, context) {
            var markers = this._needsClustering.slice(),
                needsRemoving = this._needsRemoving,
                thisNeedsRemoving, i, j;
      var markers = this._needsClustering.slice()
      var needsRemoving = this._needsRemoving
      var thisNeedsRemoving; var i; var j
            if (this._topClusterLevel) {
                this._topClusterLevel.getAllChildMarkers(markers);
        this._topClusterLevel.getAllChildMarkers(markers)
            }
            for (i = markers.length - 1; i >= 0; i--) {
                thisNeedsRemoving = true;
        thisNeedsRemoving = true
                for (j = needsRemoving.length - 1; j >= 0; j--) {
                    if (needsRemoving[j].layer === markers[i]) {
                        thisNeedsRemoving = false;
                        break;
            thisNeedsRemoving = false
            break
                    }
                }
                if (thisNeedsRemoving) {
                    method.call(context, markers[i]);
          method.call(context, markers[i])
                }
            }
            this._nonPointGroup.eachLayer(method, context);
      this._nonPointGroup.eachLayer(method, context)
        },
        // Overrides LayerGroup.getLayers
        getLayers: function() {
            var layers = [];
      var layers = []
            this.eachLayer(function(l) {
                layers.push(l);
            });
            return layers;
        layers.push(l)
      })
      return layers
        },
        // Overrides LayerGroup.getLayer, WARNING: Really bad performance
        getLayer: function(id) {
            var result = null;
      var result = null
            id = parseInt(id, 10);
      id = parseInt(id, 10)
            this.eachLayer(function(l) {
                if (L.stamp(l) === id) {
                    result = l;
          result = l
                }
            });
      })
            return result;
      return result
        },
        // Returns true if the given layer is in this MarkerClusterGroup
        hasLayer: function(layer) {
            if (!layer) {
                return false;
        return false
            }
            var i, anArray = this._needsClustering;
      var i; var anArray = this._needsClustering
            for (i = anArray.length - 1; i >= 0; i--) {
                if (anArray[i] === layer) {
                    return true;
          return true
                }
            }
            anArray = this._needsRemoving;
      anArray = this._needsRemoving
            for (i = anArray.length - 1; i >= 0; i--) {
                if (anArray[i].layer === layer) {
                    return false;
          return false
                }
            }
            return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer);
      return !!(layer.__parent && layer.__parent._group === this) || this._nonPointGroup.hasLayer(layer)
        },
        // Zoom down to show the given layer (spiderfying if necessary) then calls the callback
        zoomToShowLayer: function(layer, callback) {
            if (typeof callback !== 'function') {
                callback = function() {
                };
        }
            }
            var showMarker = function() {
                if ((layer._icon || layer.__parent._icon) && !this._inZoomAnimation) {
                    this._map.off('moveend', showMarker, this);
                    this.off('animationend', showMarker, this);
          this._map.off('moveend', showMarker, this)
          this.off('animationend', showMarker, this)
                    if (layer._icon) {
                        callback();
            callback()
                    } else if (layer.__parent._icon) {
                        this.once('spiderfied', callback, this);
                        layer.__parent.spiderfy();
            this.once('spiderfied', callback, this)
            layer.__parent.spiderfy()
                    }
                }
            };
      }
            if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
                // Layer is visible ond on screen, immediate return
                callback();
        callback()
            } else if (layer.__parent._zoom < Math.round(this._map._zoom)) {
                // Layer should be visible at this zoom level. It must not be on screen so just pan over to it
                this._map.on('moveend', showMarker, this);
                this._map.panTo(layer.getLatLng());
        this._map.on('moveend', showMarker, this)
        this._map.panTo(layer.getLatLng())
            } else {
                this._map.on('moveend', showMarker, this);
                this.on('animationend', showMarker, this);
                layer.__parent.zoomToBounds();
        this._map.on('moveend', showMarker, this)
        this.on('animationend', showMarker, this)
        layer.__parent.zoomToBounds()
            }
        },
        // Overrides FeatureGroup.onAdd
        onAdd: function(map) {
            this._map = map;
            var i, l, layer;
      this._map = map
      var i, l, layer
            if (!isFinite(this._map.getMaxZoom())) {
                throw "Map has no maxZoom specified";
          // eslint-disable-next-line no-throw-literal
        throw 'Map has no maxZoom specified'
            }
            this._featureGroup.addTo(map);
            this._nonPointGroup.addTo(map);
      this._featureGroup.addTo(map)
      this._nonPointGroup.addTo(map)
            if (!this._gridClusters) {
                this._generateInitialClusters();
        this._generateInitialClusters()
            }
            this._maxLat = map.options.crs.projection.MAX_LATITUDE;
      this._maxLat = map.options.crs.projection.MAX_LATITUDE
            // Restore all the positions as they are in the MCG before removing them
            for (i = 0, l = this._needsRemoving.length; i < l; i++) {
                layer = this._needsRemoving[i];
                layer.newlatlng = layer.layer._latlng;
                layer.layer._latlng = layer.latlng;
        layer = this._needsRemoving[i]
        layer.newlatlng = layer.layer._latlng
        layer.layer._latlng = layer.latlng
            }
            // Remove them, then restore their new positions
            for (i = 0, l = this._needsRemoving.length; i < l; i++) {
                layer = this._needsRemoving[i];
                this._removeLayer(layer.layer, true);
                layer.layer._latlng = layer.newlatlng;
        layer = this._needsRemoving[i]
        this._removeLayer(layer.layer, true)
        layer.layer._latlng = layer.newlatlng
            }
            this._needsRemoving = [];
      this._needsRemoving = []
            // Remember the current zoom level and bounds
            this._zoom = Math.round(this._map._zoom);
            this._currentShownBounds = this._getExpandedVisibleBounds();
      this._zoom = Math.round(this._map._zoom)
      this._currentShownBounds = this._getExpandedVisibleBounds()
            this._map.on('zoomend', this._zoomEnd, this);
            this._map.on('moveend', this._moveEnd, this);
      this._map.on('zoomend', this._zoomEnd, this)
      this._map.on('moveend', this._moveEnd, this)
            if (this._spiderfierOnAdd) { // TODO FIXME: Not sure how to have spiderfier add something on here nicely
                this._spiderfierOnAdd();
        this._spiderfierOnAdd()
            }
            this._bindEvents();
      this._bindEvents()
            // Actually add our markers to the map:
            l = this._needsClustering;
            this._needsClustering = [];
            this.addLayers(l, true);
      l = this._needsClustering
      this._needsClustering = []
      this.addLayers(l, true)
        },
        // Overrides FeatureGroup.onRemove
        onRemove: function(map) {
            map.off('zoomend', this._zoomEnd, this);
            map.off('moveend', this._moveEnd, this);
      map.off('zoomend', this._zoomEnd, this)
      map.off('moveend', this._moveEnd, this)
            this._unbindEvents();
      this._unbindEvents()
            // In case we are in a cluster animation
            this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
      this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '')
            if (this._spiderfierOnRemove) { // TODO FIXME: Not sure how to have spiderfier add something on here nicely
                this._spiderfierOnRemove();
        this._spiderfierOnRemove()
            }
            delete this._maxLat;
      delete this._maxLat
            // Clean up all the layers we added to the map
            this._hideCoverage();
            this._featureGroup.remove();
            this._nonPointGroup.remove();
      this._hideCoverage()
      this._featureGroup.remove()
      this._nonPointGroup.remove()
            this._featureGroup.clearLayers();
      this._featureGroup.clearLayers()
            this._map = null;
      this._map = null
        },
        getVisibleParent: function(marker) {
            var vMarker = marker;
      var vMarker = marker
            while (vMarker && !vMarker._icon) {
                vMarker = vMarker.__parent;
        vMarker = vMarker.__parent
            }
            return vMarker || null;
      return vMarker || null
        },
        // Remove the given object from the given array
        _arraySplice: function(anArray, obj) {
            for (var i = anArray.length - 1; i >= 0; i--) {
                if (anArray[i] === obj) {
                    anArray.splice(i, 1);
                    return true;
          anArray.splice(i, 1)
          return true
                }
            }
        },
@@ -675,117 +671,116 @@
         * @private
         */
        _removeFromGridUnclustered: function(marker, z) {
            var map = this._map,
                gridUnclustered = this._gridUnclustered,
                minZoom = Math.floor(this._map.getMinZoom());
      var map = this._map
      var gridUnclustered = this._gridUnclustered
      var minZoom = Math.floor(this._map.getMinZoom())
            for (; z >= minZoom; z--) {
                if (!gridUnclustered[z].removeObject(marker, map.project(marker.getLatLng(), z))) {
                    break;
          break
                }
            }
        },
        _childMarkerDragStart: function(e) {
            e.target.__dragStart = e.target._latlng;
      e.target.__dragStart = e.target._latlng
        },
        _childMarkerMoved: function(e) {
            if (!this._ignoreMove && !e.target.__dragStart) {
                var isPopupOpen = e.target._popup && e.target._popup.isOpen();
        var isPopupOpen = e.target._popup && e.target._popup.isOpen()
                this._moveChild(e.target, e.oldLatLng, e.latlng);
        this._moveChild(e.target, e.oldLatLng, e.latlng)
                if (isPopupOpen) {
                    e.target.openPopup();
          e.target.openPopup()
                }
            }
        },
        _moveChild: function(layer, from, to) {
            layer._latlng = from;
            this.removeLayer(layer);
      layer._latlng = from
      this.removeLayer(layer)
            layer._latlng = to;
            this.addLayer(layer);
      layer._latlng = to
      this.addLayer(layer)
        },
        _childMarkerDragEnd: function(e) {
            var dragStart = e.target.__dragStart;
            delete e.target.__dragStart;
      var dragStart = e.target.__dragStart
      delete e.target.__dragStart
            if (dragStart) {
                this._moveChild(e.target, dragStart, e.target._latlng);
        this._moveChild(e.target, dragStart, e.target._latlng)
            }
        },
        // Internal function for removing a marker from everything.
        // dontUpdateMap: set to true if you will handle updating the map manually (for bulk functions)
        _removeLayer: function(marker, removeFromDistanceGrid, dontUpdateMap) {
            var gridClusters = this._gridClusters,
                gridUnclustered = this._gridUnclustered,
                fg = this._featureGroup,
                map = this._map,
                minZoom = Math.floor(this._map.getMinZoom());
      var gridClusters = this._gridClusters
      var gridUnclustered = this._gridUnclustered
      var fg = this._featureGroup
      var map = this._map
      var minZoom = Math.floor(this._map.getMinZoom())
            // Remove the marker from distance clusters it might be in
            if (removeFromDistanceGrid) {
                this._removeFromGridUnclustered(marker, this._maxZoom);
        this._removeFromGridUnclustered(marker, this._maxZoom)
            }
            // Work our way up the clusters removing them as we go if required
            var cluster = marker.__parent,
                markers = cluster._markers,
                otherMarker;
      var cluster = marker.__parent
      var markers = cluster._markers
      var otherMarker
            // Remove the marker from the immediate parents marker list
            this._arraySplice(markers, marker);
      this._arraySplice(markers, marker)
            while (cluster) {
                cluster._childCount--;
                cluster._boundsNeedUpdate = true;
        cluster._childCount--
        cluster._boundsNeedUpdate = true
                if (cluster._zoom < minZoom) {
                    // Top level, do nothing
                    break;
          break
                } else if (removeFromDistanceGrid && cluster._childCount <= 1) { // Cluster no longer required
                    // We need to push the other marker up to the parent
                    otherMarker = cluster._markers[0] === marker ? cluster._markers[1] : cluster._markers[0];
          otherMarker = cluster._markers[0] === marker ? cluster._markers[1] : cluster._markers[0]
                    // Update distance grid
                    gridClusters[cluster._zoom].removeObject(cluster, map.project(cluster._cLatLng, cluster._zoom));
                    gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom));
          gridClusters[cluster._zoom].removeObject(cluster, map.project(cluster._cLatLng, cluster._zoom))
          gridUnclustered[cluster._zoom].addObject(otherMarker, map.project(otherMarker.getLatLng(), cluster._zoom))
                    // Move otherMarker up to parent
                    this._arraySplice(cluster.__parent._childClusters, cluster);
                    cluster.__parent._markers.push(otherMarker);
                    otherMarker.__parent = cluster.__parent;
          this._arraySplice(cluster.__parent._childClusters, cluster)
          cluster.__parent._markers.push(otherMarker)
          otherMarker.__parent = cluster.__parent
                    if (cluster._icon) {
                        // Cluster is currently on the map, need to put the marker on the map instead
                        fg.removeLayer(cluster);
            fg.removeLayer(cluster)
                        if (!dontUpdateMap) {
                            fg.addLayer(otherMarker);
              fg.addLayer(otherMarker)
                        }
                    }
                } else {
                    cluster._iconNeedsUpdate = true;
          cluster._iconNeedsUpdate = true
                }
                cluster = cluster.__parent;
        cluster = cluster.__parent
            }
            delete marker.__parent;
      delete marker.__parent
        },
        _isOrIsParent: function(el, oel) {
            while (oel) {
                if (el === oel) {
                    return true;
          return true
                }
                oel = oel.parentNode;
        oel = oel.parentNode
            }
            return false;
      return false
        },
        // Override L.Evented.fire
@@ -793,237 +788,234 @@
            if (data && data.layer instanceof L.MarkerCluster) {
                // Prevent multiple clustermouseover/off events if the icon is made up of stacked divs (Doesn't work in ie <= 8, no relatedTarget)
                if (data.originalEvent && this._isOrIsParent(data.layer._icon, data.originalEvent.relatedTarget)) {
                    return;
          return
                }
                type = 'cluster' + type;
        type = 'cluster' + type
            }
            L.FeatureGroup.prototype.fire.call(this, type, data, propagate);
      L.FeatureGroup.prototype.fire.call(this, type, data, propagate)
        },
        // Override L.Evented.listens
        listens: function(type, propagate) {
            return L.FeatureGroup.prototype.listens.call(this, type, propagate) || L.FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate);
      return L.FeatureGroup.prototype.listens.call(this, type, propagate) || L.FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate)
        },
        // Default functionality
        _defaultIconCreateFunction: function(cluster) {
            var childCount = cluster.getChildCount();
      var childCount = cluster.getChildCount()
            var c = ' marker-cluster-';
      var c = ' marker-cluster-'
            if (childCount < 10) {
                c += 'small';
        c += 'small'
            } else if (childCount < 100) {
                c += 'medium';
        c += 'medium'
            } else {
                c += 'large';
        c += 'large'
            }
            return new L.DivIcon({
                html: '<div><span>' + childCount + '</span></div>',
                className: 'marker-cluster' + c,
                iconSize: new L.Point(40, 40)
            });
      })
        },
        _bindEvents: function() {
            var map = this._map,
                spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
                showCoverageOnHover = this.options.showCoverageOnHover,
                zoomToBoundsOnClick = this.options.zoomToBoundsOnClick;
      var map = this._map
      var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom
      var showCoverageOnHover = this.options.showCoverageOnHover
      var zoomToBoundsOnClick = this.options.zoomToBoundsOnClick
            // Zoom on cluster click or spiderfy if we are at the lowest level
            if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
                this.on('clusterclick', this._zoomOrSpiderfy, this);
        this.on('clusterclick', this._zoomOrSpiderfy, this)
            }
            // Show convex hull (boundary) polygon on mouse over
            if (showCoverageOnHover) {
                this.on('clustermouseover', this._showCoverage, this);
                this.on('clustermouseout', this._hideCoverage, this);
                map.on('zoomend', this._hideCoverage, this);
        this.on('clustermouseover', this._showCoverage, this)
        this.on('clustermouseout', this._hideCoverage, this)
        map.on('zoomend', this._hideCoverage, this)
            }
        },
        _zoomOrSpiderfy: function(e) {
            var cluster = e.layer,
                bottomCluster = cluster;
      var cluster = e.layer
      var bottomCluster = cluster
            while (bottomCluster._childClusters.length === 1) {
                bottomCluster = bottomCluster._childClusters[0];
        bottomCluster = bottomCluster._childClusters[0]
            }
            if (bottomCluster._zoom === this._maxZoom &&
                bottomCluster._childCount === cluster._childCount &&
                this.options.spiderfyOnMaxZoom) {
                //  All child markers are contained in a single cluster from this._maxZoom to this cluster.
                cluster.spiderfy();
        cluster.spiderfy()
            } else if (this.options.zoomToBoundsOnClick) {
                cluster.zoomToBounds();
        cluster.zoomToBounds()
            }
            //  Focus the map again for keyboard users.
            if (e.originalEvent && e.originalEvent.keyCode === 13) {
                this._map._container.focus();
        this._map._container.focus()
            }
        },
        _showCoverage: function(e) {
            var map = this._map;
      var map = this._map
            if (this._inZoomAnimation) {
                return;
        return
            }
            if (this._shownPolygon) {
                map.removeLayer(this._shownPolygon);
        map.removeLayer(this._shownPolygon)
            }
            if (e.layer.getChildCount() > 2 && e.layer !== this._spiderfied) {
                this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions);
                map.addLayer(this._shownPolygon);
        this._shownPolygon = new L.Polygon(e.layer.getConvexHull(), this.options.polygonOptions)
        map.addLayer(this._shownPolygon)
            }
        },
        _hideCoverage: function() {
            if (this._shownPolygon) {
                this._map.removeLayer(this._shownPolygon);
                this._shownPolygon = null;
        this._map.removeLayer(this._shownPolygon)
        this._shownPolygon = null
            }
        },
        _unbindEvents: function() {
            var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom,
                showCoverageOnHover = this.options.showCoverageOnHover,
                zoomToBoundsOnClick = this.options.zoomToBoundsOnClick,
                map = this._map;
      var spiderfyOnMaxZoom = this.options.spiderfyOnMaxZoom
      var showCoverageOnHover = this.options.showCoverageOnHover
      var zoomToBoundsOnClick = this.options.zoomToBoundsOnClick
      var map = this._map
            if (spiderfyOnMaxZoom || zoomToBoundsOnClick) {
                this.off('clusterclick', this._zoomOrSpiderfy, this);
        this.off('clusterclick', this._zoomOrSpiderfy, this)
            }
            if (showCoverageOnHover) {
                this.off('clustermouseover', this._showCoverage, this);
                this.off('clustermouseout', this._hideCoverage, this);
                map.off('zoomend', this._hideCoverage, this);
        this.off('clustermouseover', this._showCoverage, this)
        this.off('clustermouseout', this._hideCoverage, this)
        map.off('zoomend', this._hideCoverage, this)
            }
        },
        _zoomEnd: function() {
            if (!this._map) { // May have been removed from the map by a zoomEnd handler
                return;
        return
            }
            this._mergeSplitClusters();
      this._mergeSplitClusters()
            this._zoom = Math.round(this._map._zoom);
            this._currentShownBounds = this._getExpandedVisibleBounds();
      this._zoom = Math.round(this._map._zoom)
      this._currentShownBounds = this._getExpandedVisibleBounds()
        },
        _moveEnd: function() {
            if (this._inZoomAnimation) {
                return;
        return
            }
            var newBounds = this._getExpandedVisibleBounds();
      var newBounds = this._getExpandedVisibleBounds()
            this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds);
            this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds);
      this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, newBounds)
      this._topClusterLevel._recursivelyAddChildrenToMap(null, Math.round(this._map._zoom), newBounds)
            this._currentShownBounds = newBounds;
            return;
      this._currentShownBounds = newBounds
        },
        _generateInitialClusters: function() {
            var maxZoom = Math.ceil(this._map.getMaxZoom()),
                minZoom = Math.floor(this._map.getMinZoom()),
                radius = this.options.maxClusterRadius,
                radiusFn = radius;
      var maxZoom = Math.ceil(this._map.getMaxZoom())
      var minZoom = Math.floor(this._map.getMinZoom())
      var radius = this.options.maxClusterRadius
      var radiusFn = radius
            // If we just set maxClusterRadius to a single number, we need to create
            // a simple function to return that number. Otherwise, we just have to
            // use the function we've passed in.
            if (typeof radius !== "function") {
      if (typeof radius !== 'function') {
                radiusFn = function() {
                    return radius;
                };
          return radius
        }
            }
            if (this.options.disableClusteringAtZoom !== null) {
                maxZoom = this.options.disableClusteringAtZoom - 1;
        maxZoom = this.options.disableClusteringAtZoom - 1
            }
            this._maxZoom = maxZoom;
            this._gridClusters = {};
            this._gridUnclustered = {};
      this._maxZoom = maxZoom
      this._gridClusters = {}
      this._gridUnclustered = {}
            // Set up DistanceGrids for each zoom
            for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
                this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
                this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
        this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom))
        this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom))
            }
            //  Instantiate the appropriate L.MarkerCluster class (animated or not).
            this._topClusterLevel = new this._markerCluster(this, minZoom - 1);
      this._topClusterLevel = new this._markerCluster(this, minZoom - 1)
        },
        // Zoom: Zoom to start adding at (Pass this._maxZoom to start at the bottom)
        _addLayer: function(layer, zoom) {
            var gridClusters = this._gridClusters,
                gridUnclustered = this._gridUnclustered,
                minZoom = Math.floor(this._map.getMinZoom()),
                markerPoint, z;
      var gridClusters = this._gridClusters
      var gridUnclustered = this._gridUnclustered
      var minZoom = Math.floor(this._map.getMinZoom())
      var markerPoint; var z
            if (this.options.singleMarkerMode) {
                this._overrideMarkerIcon(layer);
        this._overrideMarkerIcon(layer)
            }
            layer.on(this._childMarkerEventHandlers, this);
      layer.on(this._childMarkerEventHandlers, this)
            // Find the lowest zoom level to slot this one in
            for (; zoom >= minZoom; zoom--) {
                markerPoint = this._map.project(layer.getLatLng(), zoom); //  calculate pixel position
        markerPoint = this._map.project(layer.getLatLng(), zoom) //  calculate pixel position
                // Try find a cluster close by
                var closest = gridClusters[zoom].getNearObject(markerPoint);
        var closest = gridClusters[zoom].getNearObject(markerPoint)
                if (closest) {
                    closest._addChild(layer);
                    layer.__parent = closest;
                    return;
          closest._addChild(layer)
          layer.__parent = closest
          return
                }
                // Try find a marker close by to form a new cluster with
                closest = gridUnclustered[zoom].getNearObject(markerPoint);
        closest = gridUnclustered[zoom].getNearObject(markerPoint)
                if (closest) {
                    var parent = closest.__parent;
          var parent = closest.__parent
                    if (parent) {
                        this._removeLayer(closest, false);
            this._removeLayer(closest, false)
                    }
                    // Create new cluster with these 2 in it
                    var newCluster = new this._markerCluster(this, zoom, closest, layer);
                    gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom));
                    closest.__parent = newCluster;
                    layer.__parent = newCluster;
          var newCluster = new this._markerCluster(this, zoom, closest, layer)
          gridClusters[zoom].addObject(newCluster, this._map.project(newCluster._cLatLng, zoom))
          closest.__parent = newCluster
          layer.__parent = newCluster
                    // First create any new intermediate parent clusters that don't exist
                    var lastParent = newCluster;
          var lastParent = newCluster
                    for (z = zoom - 1; z > parent._zoom; z--) {
                        lastParent = new this._markerCluster(this, z, lastParent);
                        gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z));
            lastParent = new this._markerCluster(this, z, lastParent)
            gridClusters[z].addObject(lastParent, this._map.project(closest.getLatLng(), z))
                    }
                    parent._addChild(lastParent);
          parent._addChild(lastParent)
                    // Remove closest from this zoom level and any above that it is in, replace with newCluster
                    this._removeFromGridUnclustered(closest, zoom);
          this._removeFromGridUnclustered(closest, zoom)
                    return;
          return
                }
                // Didn't manage to cluster in at this zoom, record us as a marker here and continue upwards
                gridUnclustered[zoom].addObject(layer, markerPoint);
        gridUnclustered[zoom].addObject(layer, markerPoint)
            }
            // Didn't get in anything, add us to the top
            this._topClusterLevel._addChild(layer);
            layer.__parent = this._topClusterLevel;
            return;
      this._topClusterLevel._addChild(layer)
      layer.__parent = this._topClusterLevel
        },
        /**
@@ -1034,47 +1026,46 @@
        _refreshClustersIcons: function() {
            this._featureGroup.eachLayer(function(c) {
                if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
                    c._updateIcon();
          c._updateIcon()
                }
            });
      })
        },
        // Enqueue code to fire after the marker expand/contract has happened
        _enqueue: function(fn) {
            this._queue.push(fn);
      this._queue.push(fn)
            if (!this._queueTimeout) {
                this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300);
        this._queueTimeout = setTimeout(L.bind(this._processQueue, this), 300)
            }
        },
        _processQueue: function() {
            for (var i = 0; i < this._queue.length; i++) {
                this._queue[i].call(this);
        this._queue[i].call(this)
            }
            this._queue.length = 0;
            clearTimeout(this._queueTimeout);
            this._queueTimeout = null;
      this._queue.length = 0
      clearTimeout(this._queueTimeout)
      this._queueTimeout = null
        },
        // Merge and split any existing clusters that are too big or small
        _mergeSplitClusters: function() {
            var mapZoom = Math.round(this._map._zoom);
      var mapZoom = Math.round(this._map._zoom)
            // In case we are starting to split before the animation finished
            this._processQueue();
      this._processQueue()
            if (this._zoom < mapZoom && this._currentShownBounds.intersects(this._getExpandedVisibleBounds())) { // Zoom in, split
                this._animationStart();
        this._animationStart()
                // Remove clusters now off screen
                this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds());
        this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), this._zoom, this._getExpandedVisibleBounds())
                this._animationZoomIn(this._zoom, mapZoom);
        this._animationZoomIn(this._zoom, mapZoom)
            } else if (this._zoom > mapZoom) { // Zoom out, merge
                this._animationStart();
        this._animationStart()
                this._animationZoomOut(this._zoom, mapZoom);
        this._animationZoomOut(this._zoom, mapZoom)
            } else {
                this._moveEnd();
        this._moveEnd()
            }
        },
@@ -1137,9 +1128,9 @@
         * @private
         */
        _extractNonGroupLayers: function(group, output) {
            var layers = group.getLayers(),
                i = 0,
                layer
      var layers = group.getLayers()
      var i = 0
      var layer
            output = output || []
@@ -1189,14 +1180,14 @@
                // Do nothing...
            },
            _animationZoomIn: function(previousZoomLevel, newZoomLevel) {
                this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
        this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel)
                this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds())
                // We didn't actually animate, but we use this event to mean "clustering animations have finished"
                this.fire('animationend')
            },
            _animationZoomOut: function(previousZoomLevel, newZoomLevel) {
                this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel);
        this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel)
                this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds())
                // We didn't actually animate, but we use this event to mean "clustering animations have finished"
@@ -1215,18 +1206,18 @@
            },
            _animationZoomIn: function(previousZoomLevel, newZoomLevel) {
                var bounds = this._getExpandedVisibleBounds(),
                    fg = this._featureGroup,
                    minZoom = Math.floor(this._map.getMinZoom()),
                    i
        var bounds = this._getExpandedVisibleBounds()
        var fg = this._featureGroup
        var minZoom = Math.floor(this._map.getMinZoom())
        var i
                this._ignoreMove = true
                // Add all children of current clusters to map and remove those clusters from map
                this._topClusterLevel._recursively(bounds, previousZoomLevel, minZoom, function(c) {
                    var startPos = c._latlng,
                        markers = c._markers,
                        m
          var startPos = c._latlng
          var markers = c._markers
          var m
                    if (!bounds.contains(startPos)) {
                        startPos = null
@@ -1249,26 +1240,25 @@
                            fg.removeLayer(m)
                        }
                    }
                });
        })
                this._forceLayout()
                // Update opacities
                this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
        this._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel)
                // TODO Maybe? Update markers in _recursivelyBecomeVisible
                fg.eachLayer(function(n) {
                    if (!(n instanceof L.MarkerCluster) && n._icon) {
                        n.clusterShow()
                    }
                });
        })
                // update the positions of the just added clusters/markers
                this._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function(c) {
                    c._recursivelyRestoreChildPositions(newZoomLevel);
                });
          c._recursivelyRestoreChildPositions(newZoomLevel)
        })
                this._ignoreMove = false;
        this._ignoreMove = false
                // Remove the old clusters and close the zoom animation
                this._enqueue(function() {
@@ -1288,12 +1278,12 @@
                // Need to add markers for those that weren't on the map before but are now
                this._topClusterLevel._recursivelyAddChildrenToMap(null, newZoomLevel, this._getExpandedVisibleBounds())
                // Remove markers that were on the map before but won't be now
                this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds());
        this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds, Math.floor(this._map.getMinZoom()), previousZoomLevel, this._getExpandedVisibleBounds())
            },
            _animationAddLayer: function(layer, newCluster) {
                var me = this,
                    fg = this._featureGroup
        var me = this
        var fg = this._featureGroup
                fg.addLayer(layer)
                if (newCluster !== layer) {
@@ -1310,8 +1300,7 @@
                            layer.clusterShow()
                            me._animationEnd()
                        });
            })
                    } else { // Just became a cluster
                        this._forceLayout()
@@ -1324,8 +1313,8 @@
        //  Private methods for animated versions.
        _animationZoomOutSingle: function(cluster, previousZoomLevel, newZoomLevel) {
            var bounds = this._getExpandedVisibleBounds(),
                minZoom = Math.floor(this._map.getMinZoom())
      var bounds = this._getExpandedVisibleBounds()
      var minZoom = Math.floor(this._map.getMinZoom())
            // Animate all of the markers in the clusters to move to their cluster center point
            cluster._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, minZoom, previousZoomLevel + 1, newZoomLevel)
@@ -1333,7 +1322,7 @@
            var me = this
            // Update the opacity (If we immediately set it they won't animate)
            this._forceLayout();
      this._forceLayout()
            cluster._recursivelyBecomeVisible(bounds, newZoomLevel)
            // TODO: Maybe use the transition timing stuff to make this more reliable
@@ -1355,12 +1344,12 @@
                    })
                }
                me._animationEnd()
            });
      })
        },
        _animationEnd: function() {
            if (this._map) {
                this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
        this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '')
            }
            this._inZoomAnimation--
            this.fire('animationend')
@@ -1374,11 +1363,11 @@
            L.Util.falseFn(document.body.offsetWidth)
        }
    });
  })
    L.markerClusterGroup = function(options) {
        return new L.MarkerClusterGroup(options)
    };
  }
    var MarkerCluster = L.MarkerCluster = L.Marker.extend({
        options: L.Icon.prototype.options,
@@ -1399,10 +1388,10 @@
            this._bounds = new L.LatLngBounds()
            if (a) {
                this._addChild(a);
        this._addChild(a)
            }
            if (b) {
                this._addChild(b);
        this._addChild(b)
            }
        },
@@ -1426,32 +1415,32 @@
        // Returns the count of how many child markers we have
        getChildCount: function() {
            return this._childCount;
      return this._childCount
        },
        // Zoom to the minimum of showing all of the child markers, or the extents of this cluster
        zoomToBounds: function(fitBoundsOptions) {
            var childClusters = this._childClusters.slice(),
                map = this._group._map,
                boundsZoom = map.getBoundsZoom(this._bounds),
                zoom = this._zoom + 1,
                mapZoom = map.getZoom(),
                i;
      var childClusters = this._childClusters.slice()
      var map = this._group._map
      var boundsZoom = map.getBoundsZoom(this._bounds)
      var zoom = this._zoom + 1
      var mapZoom = map.getZoom()
      var i
            // calculate how far we need to zoom down to see all of the markers
            while (childClusters.length > 0 && boundsZoom > zoom) {
                zoom++;
                var newClusters = [];
        zoom++
        var newClusters = []
                for (i = 0; i < childClusters.length; i++) {
                    newClusters = newClusters.concat(childClusters[i]._childClusters);
          newClusters = newClusters.concat(childClusters[i]._childClusters)
                }
                childClusters = newClusters;
        childClusters = newClusters
            }
            if (boundsZoom > zoom) {
                this._group._map.setView(this._latlng, zoom);
        this._group._map.setView(this._latlng, zoom)
            } else if (boundsZoom <= mapZoom) { // If fitBounds wouldn't zoom us down, zoom us down instead
                this._group._map.setView(this._latlng, mapZoom + 1);
        this._group._map.setView(this._latlng, mapZoom + 1)
            } else {
                this._group._map.fitBounds(this._bounds, fitBoundsOptions)
            }
@@ -1473,7 +1462,7 @@
        //  Cludge for Icon, we pretend to be an icon for performance
        createIcon: function() {
            if (this._iconNeedsUpdate) {
                this._iconObj = this._group.options.iconCreateFunction(this);
        this._iconObj = this._group.options.iconCreateFunction(this)
                this._iconNeedsUpdate = false
            }
            return this._iconObj.createIcon()
@@ -1538,12 +1527,12 @@
        },
        _recalculateBounds: function() {
            var markers = this._markers,
                childClusters = this._childClusters,
                latSum = 0,
                lngSum = 0,
                totalCount = this._childCount,
                i, child, childLatLng, childCount
      var markers = this._markers
      var childClusters = this._childClusters
      var latSum = 0
      var lngSum = 0
      var totalCount = this._childCount
      var i; var child; var childLatLng; var childCount
            //  Case where all markers are removed from the map and we are left with just an empty _topClusterLevel.
            if (totalCount === 0) {
@@ -1599,8 +1588,8 @@
        _recursivelyAnimateChildrenIn: function(bounds, center, maxZoom) {
            this._recursively(bounds, this._group._map.getMinZoom(), maxZoom - 1,
                function(c) {
                    var markers = c._markers,
                        i, m
          var markers = c._markers
          var i; var m
                    for (i = markers.length - 1; i >= 0; i--) {
                        m = markers[i]
@@ -1612,8 +1601,8 @@
                    }
                },
                function(c) {
                    var childClusters = c._childClusters,
                        j, cm
          var childClusters = c._childClusters
          var j; var cm
                    for (j = childClusters.length - 1; j >= 0; j--) {
                        cm = childClusters[j]
                        if (cm._icon) {
@@ -1622,13 +1611,13 @@
                        }
                    }
                }
            );
      )
        },
        _recursivelyAnimateChildrenInAndAddSelfToMap: function(bounds, mapMinZoom, previousZoomLevel, newZoomLevel) {
            this._recursively(bounds, newZoomLevel, mapMinZoom,
                function(c) {
                    c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel);
          c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), previousZoomLevel)
                    //  TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
                    //  As a hack we only do a animation free zoom on a single level zoom, if someone does multiple levels then we always animate
@@ -1696,7 +1685,7 @@
            if (zoomLevel - 1 === this._zoom) {
                //  Reposition child clusters
                for (var j = this._childClusters.length - 1; j >= 0; j--) {
                    this._childClusters[j]._restorePosition();
          this._childClusters[j]._restorePosition()
                }
            } else {
                for (var k = this._childClusters.length - 1; k >= 0; k--) {
@@ -1750,9 +1739,9 @@
        //  runAtEveryLevel: function that takes an L.MarkerCluster as an argument that should be applied on every level
        //  runAtBottomLevel: function that takes an L.MarkerCluster as an argument that should be applied at only the bottom level
        _recursively: function(boundsToApplyTo, zoomLevelToStart, zoomLevelToStop, runAtEveryLevel, runAtBottomLevel) {
            var childClusters = this._childClusters,
                zoom = this._zoom,
                i, c
      var childClusters = this._childClusters
      var zoom = this._zoom
      var i; var c
            if (zoomLevelToStart <= zoom) {
                if (runAtEveryLevel) {
@@ -1781,7 +1770,7 @@
            //  Don't need to check this._markers as the rest won't work if there are any
            return this._childClusters.length > 0 && this._childClusters[0]._childCount === this._childCount
        }
    });
  })
    /*
    * Extends L.Marker to include two extra methods: clusterHide and clusterShow.
@@ -1814,12 +1803,12 @@
    L.DistanceGrid.prototype = {
        addObject: function(obj, point) {
            var x = this._getCoord(point.x),
                y = this._getCoord(point.y),
                grid = this._grid,
                row = grid[y] = grid[y] || {},
                cell = row[x] = row[x] || [],
                stamp = L.Util.stamp(obj)
      var x = this._getCoord(point.x)
      var y = this._getCoord(point.y)
      var grid = this._grid
      var row = grid[y] = grid[y] || {}
      var cell = row[x] = row[x] || []
      var stamp = L.Util.stamp(obj)
            this._objectPoint[stamp] = point
@@ -1833,14 +1822,14 @@
        //  Returns true if the object was found
        removeObject: function(obj, point) {
            var x = this._getCoord(point.x),
                y = this._getCoord(point.y),
                grid = this._grid,
                row = grid[y] = grid[y] || {},
                cell = row[x] = row[x] || [],
                i, len;
      var x = this._getCoord(point.x)
      var y = this._getCoord(point.y)
      var grid = this._grid
      var row = grid[y] = grid[y] || {}
      var cell = row[x] = row[x] || []
      var i; var len
            delete this._objectPoint[L.Util.stamp(obj)];
      delete this._objectPoint[L.Util.stamp(obj)]
            for (i = 0, len = cell.length; i < len; i++) {
                if (cell[i] === obj) {
@@ -1856,8 +1845,8 @@
        },
        eachObject: function(fn, context) {
            var i, j, k, len, row, cell, removed,
                grid = this._grid
      var i; var j; var k; var len; var row; var cell; var removed
      var grid = this._grid
            for (i in grid) {
                row = grid[i]
@@ -1866,7 +1855,7 @@
                    cell = row[j]
                    for (k = 0, len = cell.length; k < len; k++) {
                        removed = fn.call(context, cell[k]);
            removed = fn.call(context, cell[k])
                        if (removed) {
                            k--
                            len--
@@ -1877,12 +1866,12 @@
        },
        getNearObject: function(point) {
            var x = this._getCoord(point.x),
                y = this._getCoord(point.y),
                i, j, k, row, cell, len, obj, dist,
                objectPoint = this._objectPoint,
                closestDistSq = this._sqCellSize,
                closest = null
      var x = this._getCoord(point.x)
      var y = this._getCoord(point.y)
      var i; var j; var k; var row; var cell; var len; var obj; var dist
      var objectPoint = this._objectPoint
      var closestDistSq = this._sqCellSize
      var closest = null
            for (i = y - 1; i <= y + 1; i++) {
                row = this._grid[i]
@@ -1892,7 +1881,7 @@
                        if (cell) {
                            for (k = 0, len = cell.length; k < len; k++) {
                                obj = cell[k]
                                dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point);
                dist = this._sqDist(objectPoint[L.Util.stamp(obj)], point)
                                if (dist < closestDistSq ||
                                    dist <= closestDistSq && closest === null) {
                                    closestDistSq = dist
@@ -1912,8 +1901,8 @@
        },
        _sqDist: function(p, p2) {
            var dx = p2.x - p.x,
                dy = p2.y - p.y
      var dx = p2.x - p.x
      var dy = p2.y - p.y
            return dx * dx + dy * dy
        }
    };
@@ -1954,8 +1943,8 @@
             * @returns {Number} an approximate distance measure
             */
            getDistant: function(cpt, bl) {
                var vY = bl[1].lat - bl[0].lat,
                    vX = bl[0].lng - bl[1].lng
        var vY = bl[1].lat - bl[0].lat
        var vX = bl[0].lng - bl[1].lng
                return (vX * (cpt.lat - bl[0].lat) + vY * (cpt.lng - bl[0].lng))
            },
@@ -1967,10 +1956,10 @@
             *   in consideration for the hull.
             */
            findMostDistantPointFromBaseLine: function(baseLine, latLngs) {
                var maxD = 0,
                    maxPt = null,
                    newPoints = [],
                    i, pt, d
        var maxD = 0
        var maxPt = null
        var newPoints = []
        var i; var pt; var d
                for (i = latLngs.length - 1; i >= 0; i--) {
                    pt = latLngs[i]
@@ -1999,14 +1988,14 @@
             * @returns {Array}
             */
            buildConvexHull: function(baseLine, latLngs) {
                var convexHullBaseLines = [],
                    t = this.findMostDistantPointFromBaseLine(baseLine, latLngs);
        var convexHullBaseLines = []
        var t = this.findMostDistantPointFromBaseLine(baseLine, latLngs)
                if (t.maxPoint) { //  if there is still a point "outside" the base line
                    convexHullBaseLines =
                        convexHullBaseLines.concat(
                            this.buildConvexHull([baseLine[0], t.maxPoint], t.newPoints)
                        );
                        )
                    convexHullBaseLines =
                        convexHullBaseLines.concat(
                            this.buildConvexHull([t.maxPoint, baseLine[1]], t.newPoints)
@@ -2026,12 +2015,12 @@
             */
            getConvexHull: function(latLngs) {
                //  find first baseline
                var maxLat = false, minLat = false,
                    maxLng = false, minLng = false,
                    maxLatPt = null, minLatPt = null,
                    maxLngPt = null, minLngPt = null,
                    maxPt = null, minPt = null,
                    i
        var maxLat = false; var minLat = false
        var maxLng = false; var minLng = false
        var maxLatPt = null; var minLatPt = null
        var maxLngPt = null; var minLngPt = null
        var maxPt = null; var minPt = null
        var i
                for (i = latLngs.length - 1; i >= 0; i--) {
                    var pt = latLngs[i]
@@ -2070,16 +2059,16 @@
    L.MarkerCluster.include({
        getConvexHull: function() {
            var childMarkers = this.getAllChildMarkers(),
                points = [],
                p, i
      var childMarkers = this.getAllChildMarkers()
      var points = []
      var p; var i
            for (i = childMarkers.length - 1; i >= 0; i--) {
                p = childMarkers[i].getLatLng()
                points.push(p)
            }
            return L.QuickHull.getConvexHull(points);
      return L.QuickHull.getConvexHull(points)
        }
    })
@@ -2104,14 +2093,14 @@
                return
            }
            var childMarkers = this.getAllChildMarkers(null, true),
                group = this._group,
                map = group._map,
                center = map.latLngToLayerPoint(this._latlng),
                positions;
      var childMarkers = this.getAllChildMarkers(null, true)
      var group = this._group
      var map = group._map
      var center = map.latLngToLayerPoint(this._latlng)
      var positions
            this._group._unspiderfy();
            this._group._spiderfied = this;
      this._group._unspiderfy()
      this._group._spiderfied = this
            //  TODO Maybe: childMarkers order by distance to center
@@ -2136,32 +2125,32 @@
        },
        _generatePointsCircle: function(count, centerPt) {
            var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count),
                legLength = circumference / this._2PI, //  radius from circumference
                angleStep = this._2PI / count,
                res = [],
                i, angle
      var circumference = this._group.options.spiderfyDistanceMultiplier * this._circleFootSeparation * (2 + count)
      var legLength = circumference / this._2PI //  radius from circumference
      var angleStep = this._2PI / count
      var res = []
      var i; var angle
            legLength = Math.max(legLength, 35) //  Minimum distance to get outside the cluster icon.
            res.length = count
            for (i = 0; i < count; i++) { //  Clockwise, like spiral.
                angle = this._circleStartAngle + i * angleStep;
                res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round();
        angle = this._circleStartAngle + i * angleStep
        res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round()
            }
            return res
        },
        _generatePointsSpiral: function(count, centerPt) {
            var spiderfyDistanceMultiplier = this._group.options.spiderfyDistanceMultiplier,
                legLength = spiderfyDistanceMultiplier * this._spiralLengthStart,
                separation = spiderfyDistanceMultiplier * this._spiralFootSeparation,
                lengthFactor = spiderfyDistanceMultiplier * this._spiralLengthFactor * this._2PI,
                angle = 0,
                res = [],
                i
      var spiderfyDistanceMultiplier = this._group.options.spiderfyDistanceMultiplier
      var legLength = spiderfyDistanceMultiplier * this._spiralLengthStart
      var separation = spiderfyDistanceMultiplier * this._spiralFootSeparation
      var lengthFactor = spiderfyDistanceMultiplier * this._spiralLengthFactor * this._2PI
      var angle = 0
      var res = []
      var i
            res.length = count
@@ -2175,15 +2164,15 @@
                angle += separation / legLength + i * 0.0005
                legLength += lengthFactor / angle
            }
            return res;
      return res
        },
        _noanimationUnspiderfy: function() {
            var group = this._group,
                map = group._map,
                fg = group._featureGroup,
                childMarkers = this.getAllChildMarkers(null, true),
                m, i
      var group = this._group
      var map = group._map
      var fg = group._featureGroup
      var childMarkers = this.getAllChildMarkers(null, true)
      var m; var i
            group._ignoreMove = true
@@ -2219,11 +2208,11 @@
//  Non Animated versions of everything
    L.MarkerClusterNonAnimated = L.MarkerCluster.extend({
        _animationSpiderfy: function(childMarkers, positions) {
            var group = this._group,
                map = group._map,
                fg = group._featureGroup,
                legOptions = this._group.options.spiderLegPolylineOptions,
                i, m, leg, newPos
      var group = this._group
      var map = group._map
      var fg = group._featureGroup
      var legOptions = this._group.options.spiderLegPolylineOptions
      var i; var m; var leg; var newPos
            group._ignoreMove = true
@@ -2265,19 +2254,19 @@
    L.MarkerCluster.include({
        _animationSpiderfy: function(childMarkers, positions) {
            var me = this,
                group = this._group,
                map = group._map,
                fg = group._featureGroup,
                thisLayerLatLng = this._latlng,
                thisLayerPos = map.latLngToLayerPoint(thisLayerLatLng),
                svg = L.Path.SVG,
                legOptions = L.extend({}, this._group.options.spiderLegPolylineOptions), //  Copy the options so that we can modify them for animation.
                finalLegOpacity = legOptions.opacity,
                i, m, leg, legPath, legLength, newPos
      var me = this
      var group = this._group
      var map = group._map
      var fg = group._featureGroup
      var thisLayerLatLng = this._latlng
      var thisLayerPos = map.latLngToLayerPoint(thisLayerLatLng)
      var svg = L.Path.SVG
      var legOptions = L.extend({}, this._group.options.spiderLegPolylineOptions) //  Copy the options so that we can modify them for animation.
      var finalLegOpacity = legOptions.opacity
      var i; var m; var leg; var legPath; var legLength; var newPos
            if (finalLegOpacity === undefined) {
                finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity;
        finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity
            }
            if (svg) {
@@ -2370,14 +2359,14 @@
        },
        _animationUnspiderfy: function(zoomDetails) {
            var me = this,
                group = this._group,
                map = group._map,
                fg = group._featureGroup,
                thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng),
                childMarkers = this.getAllChildMarkers(null, true),
                svg = L.Path.SVG,
                m, i, leg, legPath, legLength, nonAnimatable
      var me = this
      var group = this._group
      var map = group._map
      var fg = group._featureGroup
      var thisLayerPos = zoomDetails ? map._latLngToNewLayerPoint(this._latlng, zoomDetails.zoom, zoomDetails.center) : map.latLngToLayerPoint(this._latlng)
      var childMarkers = this.getAllChildMarkers(null, true)
      var svg = L.Path.SVG
      var m; var i; var leg; var legPath; var legLength; var nonAnimatable
            group._ignoreMove = true
            group._animationStart()
@@ -2427,7 +2416,7 @@
            setTimeout(function() {
                //  If we have only <= one child left then that marker will be shown on the map so don't remove it!
                var stillThereChildCount = 0;
        var stillThereChildCount = 0
                for (i = childMarkers.length - 1; i >= 0; i--) {
                    m = childMarkers[i]
                    if (m._spiderLeg) {
@@ -2470,7 +2459,7 @@
        _spiderfied: null,
        unspiderfy: function() {
            this._unspiderfy.apply(this, arguments);
      this._unspiderfy.apply(this, arguments)
        },
        _spiderfierOnAdd: function() {
@@ -2483,7 +2472,7 @@
            this._map.on('zoomend', this._noanimationUnspiderfy, this)
            if (!L.Browser.touch) {
                this._map.getRenderer(this);
        this._map.getRenderer(this)
                //  Needs to happen in the pageload, not after, or animations don't work in webkit
                //  http:// stackoverflow.com/questions/8455200/svg-animate-with-dynamically-added-elements
                //  Disable on touch browsers as the animation messes up on a touch zoom and isn't very noticable
@@ -2508,7 +2497,7 @@
                return
            }
            this._map.on('zoomanim', this._unspiderfyZoomAnim, this);
      this._map.on('zoomanim', this._unspiderfyZoomAnim, this)
        },
        _unspiderfyZoomAnim: function(zoomDetails) {
@@ -2555,7 +2544,7 @@
                delete layer._spiderLeg
            }
        }
    });
  })
    /**
     * Adds 1 public method to MCG and 1 to L.Marker to facilitate changing
@@ -2563,7 +2552,6 @@
     * accordingly (case where their iconCreateFunction uses data of childMarkers
     * to make up the cluster icon).
     */
    L.MarkerClusterGroup.include({
        /**
@@ -2639,7 +2627,7 @@
                }
            }
        }
    });
  })
    L.Marker.include({
        /**
@@ -2670,7 +2658,6 @@
    exports.MarkerClusterGroup = MarkerClusterGroup
    exports.MarkerCluster = MarkerCluster
}
export default {
src/components/plugin/wmts_plugins.js
@@ -13,61 +13,61 @@
        },
    
        initialize: function (url, options) { // (String, Object)
            this._url = url;
            var lOptions= {};
            var cOptions = Object.keys(options);
      this._url = url
      var lOptions = {}
      var cOptions = Object.keys(options)
            cOptions.forEach(element=>{
               lOptions[element.toLowerCase()]=options[element];
            });
            var wmtsParams = L.extend({}, this.defaultWmtsParams);
            var tileSize = lOptions.tileSize || this.options.tileSize;
        lOptions[element.toLowerCase()] = options[element]
      })
      var wmtsParams = L.extend({}, this.defaultWmtsParams)
      var tileSize = lOptions.tileSize || this.options.tileSize
            if (lOptions.detectRetina && L.Browser.retina) {
                wmtsParams.width = wmtsParams.height = tileSize * 2;
        wmtsParams.width = wmtsParams.height = tileSize * 2
            } else {
                wmtsParams.width = wmtsParams.height = tileSize;
        wmtsParams.width = wmtsParams.height = tileSize
            }
            for (var i in lOptions) {
                // all keys that are in defaultWmtsParams options go to WMTS params
                if (wmtsParams.hasOwnProperty(i) && i!="matrixIds") {
                    wmtsParams[i] = lOptions[i];
        if (wmtsParams.hasOwnProperty(i) && i != 'matrixIds') {
          wmtsParams[i] = lOptions[i]
                }
            }
            this.wmtsParams = wmtsParams;
            this.matrixIds = options.matrixIds||this.getDefaultMatrix();
            L.setOptions(this, options);
      this.wmtsParams = wmtsParams
      this.matrixIds = options.matrixIds || this.getDefaultMatrix()
      L.setOptions(this, options)
        },
    
        onAdd: function (map) {
            this._crs = this.options.crs || map.options.crs;
            L.TileLayer.prototype.onAdd.call(this, map);
      this._crs = this.options.crs || map.options.crs
      L.TileLayer.prototype.onAdd.call(this, map)
        },
    
        getTileUrl: function (coords) { // (Point, Number) -> String
            var tileSize = this.options.tileSize;
            var nwPoint = coords.multiplyBy(tileSize);
            nwPoint.x+=1;
            nwPoint.y-=1;
            var sePoint = nwPoint.add(new L.Point(tileSize, tileSize));
            var zoom = this._tileZoom;
            var nw = this._crs.project(this._map.unproject(nwPoint, zoom));
            var se = this._crs.project(this._map.unproject(sePoint, zoom));
            var tilewidth = se.x-nw.x;
            var ident = this.matrixIds[zoom].identifier;
            var tilematrix = this.wmtsParams.tilematrixset + ":" + ident;
            var X0 = this.matrixIds[zoom].topLeftCorner.lng;
            var Y0 = this.matrixIds[zoom].topLeftCorner.lat;
            var tilecol=Math.floor((nw.x-X0)/tilewidth);
            var tilerow=-Math.floor((nw.y-Y0)/tilewidth);
            var url = L.Util.template(this._url, {s: this._getSubdomain(coords)});
            return url + L.Util.getParamString(this.wmtsParams, url) + "&tilematrix=" + tilematrix + "&tilerow=" + tilerow +"&tilecol=" + tilecol;
      var tileSize = this.options.tileSize
      var nwPoint = coords.multiplyBy(tileSize)
      nwPoint.x += 1
      nwPoint.y -= 1
      var sePoint = nwPoint.add(new L.Point(tileSize, tileSize))
      var zoom = this._tileZoom
      var nw = this._crs.project(this._map.unproject(nwPoint, zoom))
      var se = this._crs.project(this._map.unproject(sePoint, zoom))
      var tilewidth = se.x - nw.x
      var ident = this.matrixIds[zoom].identifier
      var tilematrix = this.wmtsParams.tilematrixset + ':' + ident
      var X0 = this.matrixIds[zoom].topLeftCorner.lng
      var Y0 = this.matrixIds[zoom].topLeftCorner.lat
      var tilecol = Math.floor((nw.x - X0) / tilewidth)
      var tilerow = -Math.floor((nw.y - Y0) / tilewidth)
      var url = L.Util.template(this._url, { s: this._getSubdomain(coords) })
      return url + L.Util.getParamString(this.wmtsParams, url) + '&tilematrix=' + tilematrix + '&tilerow=' + tilerow + '&tilecol=' + tilecol
        },
    
        setParams: function (params, noRedraw) {
            L.extend(this.wmtsParams, params);
      L.extend(this.wmtsParams, params)
            if (!noRedraw) {
                this.redraw();
        this.redraw()
            }
            return this;
      return this
        },
        
        getDefaultMatrix : function () {
@@ -75,20 +75,20 @@
             * the matrix3857 represents the projection 
             * for in the IGN WMTS for the google coordinates.
             */
            var matrixIds3857 = new Array(22);
      var matrixIds3857 = new Array(22)
            for (var i= 0; i<22; i++) {
                matrixIds3857[i]= {
                    identifier    : "" + i,
          identifier: '' + i,
                    topLeftCorner : new L.LatLng(20037508.3428,-20037508.3428)
                };
            }
            return matrixIds3857;
        }
    });
      return matrixIds3857
    }
  })
    
    L.tileLayer.wmts = function (url, options) {
        return new L.TileLayer.WMTS(url, options);
    };
    return new L.TileLayer.WMTS(url, options)
  }
}
export default {
src/utils/tools.js
@@ -1,9 +1,9 @@
import * as $CONST from './constant'
import { Message } from 'element-ui'
// import { notify } from '@nutui/nutui'
export const _ = require('lodash')
const notify = window.vm.$notify
/**
 * 集合转换为JSON
 * @param obj collection数据
@@ -993,23 +993,38 @@
}
export function success (msg = $CONST.MSG_SYS_SUCCESS) {
  notify.success(msg)
  Message({
    message: msg,
    type: 'success'
  })
}
export function fail (msg = $CONST.MSG_SYS_FAIL) {
  notify.warn(msg)
  Message({
    message: msg,
    type: 'error'
  })
}
export function error (msg = $CONST.MSG_SYS_ERR) {
  notify.danger(msg)
  Message({
    message: msg,
    type: 'error'
  })
}
export function warning (msg = $CONST.MSG_SYS_WARNING) {
  notify.warn(msg)
  Message({
    message: msg,
    type: 'warning'
  })
}
export function info (msg = $CONST.MSG_SYS_CANCELED) {
  notify.primary(msg)
  Message({
    message: msg,
    type: 'info'
  })
}
/**