diff --git a/src/DistanceGrid.js b/src/DistanceGrid.js index eee74110..5046f597 100644 --- a/src/DistanceGrid.js +++ b/src/DistanceGrid.js @@ -1,12 +1,13 @@ +import { Util } from 'leaflet/src/core'; -L.DistanceGrid = function (cellSize) { +export var DistanceGrid = function (cellSize) { this._cellSize = cellSize; this._sqCellSize = cellSize * cellSize; this._grid = {}; this._objectPoint = { }; }; -L.DistanceGrid.prototype = { +DistanceGrid.prototype = { addObject: function (obj, point) { var x = this._getCoord(point.x), @@ -14,7 +15,7 @@ L.DistanceGrid.prototype = { grid = this._grid, row = grid[y] = grid[y] || {}, cell = row[x] = row[x] || [], - stamp = L.Util.stamp(obj); + stamp = Util.stamp(obj); this._objectPoint[stamp] = point; @@ -35,7 +36,7 @@ L.DistanceGrid.prototype = { cell = row[x] = row[x] || [], i, len; - delete this._objectPoint[L.Util.stamp(obj)]; + delete this._objectPoint[Util.stamp(obj)]; for (i = 0, len = cell.length; i < len; i++) { if (cell[i] === obj) { @@ -91,7 +92,7 @@ L.DistanceGrid.prototype = { 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[Util.stamp(obj)], point); if (dist < closestDistSq || dist <= closestDistSq && closest === null) { closestDistSq = dist; diff --git a/src/MarkerCluster.QuickHull.js b/src/MarkerCluster.QuickHull.js index 741c5210..be270cb0 100644 --- a/src/MarkerCluster.QuickHull.js +++ b/src/MarkerCluster.QuickHull.js @@ -24,8 +24,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=18434 */ -(function () { - L.QuickHull = { +import { MarkerCluster } from './MarkerCluster.js'; + +//(function () { + export var QuickHull = { /* * @param {Object} cpt a point to be measured from the baseline @@ -133,7 +135,7 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843 minLng = pt.lng; } } - + if (minLat !== maxLat) { minPt = minLatPt; maxPt = maxLatPt; @@ -147,9 +149,9 @@ Retrieved from: http://en.literateprograms.org/Quickhull_(Javascript)?oldid=1843 return ch; } }; -}()); +//}()); -L.MarkerCluster.include({ +MarkerCluster.include({ getConvexHull: function () { var childMarkers = this.getAllChildMarkers(), points = [], @@ -160,6 +162,6 @@ L.MarkerCluster.include({ points.push(p); } - return L.QuickHull.getConvexHull(points); + return QuickHull.getConvexHull(points); } }); diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js index b84c2b13..91a11f11 100644 --- a/src/MarkerCluster.Spiderfier.js +++ b/src/MarkerCluster.Spiderfier.js @@ -1,7 +1,14 @@ //This code is 100% based on https://github.com/jawj/OverlappingMarkerSpiderfier-Leaflet //Huge thanks to jawj for implementing it first to make my job easy :-) -L.MarkerCluster.include({ +import { MarkerCluster } from './MarkerCluster.js'; +import { MarkerClusterGroup } from './MarkerClusterGroup.js'; +import { Browser, Util } from 'leaflet/src/core'; +import { DomUtil } from 'leaflet/src/dom'; +import { Point } from 'leaflet/src/geometry'; +import { Path, Polyline } from 'leaflet/src/layer/vector'; + +MarkerCluster.include({ _2PI: Math.PI * 2, _circleFootSeparation: 25, //related to circumference of circle @@ -65,7 +72,7 @@ L.MarkerCluster.include({ 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(); + res[i] = new Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); } return res; @@ -87,7 +94,7 @@ L.MarkerCluster.include({ // Skip the first position, so that we are already farther from center and we avoid // being under the default cluster icon (especially important for Circle Markers). if (i < count) { - res[i] = new L.Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); + res[i] = new Point(centerPt.x + legLength * Math.cos(angle), centerPt.y + legLength * Math.sin(angle))._round(); } angle += separation / legLength + i * 0.0005; legLength += lengthFactor / angle; @@ -134,7 +141,7 @@ L.MarkerCluster.include({ }); //Non Animated versions of everything -L.MarkerClusterNonAnimated = L.MarkerCluster.extend({ +var MarkerClusterNonAnimated = MarkerCluster.extend({ _animationSpiderfy: function (childMarkers, positions) { var group = this._group, map = group._map, @@ -151,7 +158,7 @@ L.MarkerClusterNonAnimated = L.MarkerCluster.extend({ m = childMarkers[i]; // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. - leg = new L.Polyline([this._latlng, newPos], legOptions); + leg = new Polyline([this._latlng, newPos], legOptions); map.addLayer(leg); m._spiderLeg = leg; @@ -179,7 +186,7 @@ L.MarkerClusterNonAnimated = L.MarkerCluster.extend({ }); //Animated versions here -L.MarkerCluster.include({ +MarkerCluster.include({ _animationSpiderfy: function (childMarkers, positions) { var me = this, @@ -188,13 +195,13 @@ L.MarkerCluster.include({ 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. + svg = Path.SVG, + legOptions = Util.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; if (finalLegOpacity === undefined) { - finalLegOpacity = L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity; + finalLegOpacity = MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity; } if (svg) { @@ -219,7 +226,7 @@ L.MarkerCluster.include({ newPos = map.layerPointToLatLng(positions[i]); // Add the leg before the marker, so that in case the latter is a circleMarker, the leg is behind it. - leg = new L.Polyline([thisLayerLatLng, newPos], legOptions); + leg = new Polyline([thisLayerLatLng, newPos], legOptions); map.addLayer(leg); m._spiderLeg = leg; @@ -239,7 +246,7 @@ L.MarkerCluster.include({ if (m.clusterHide) { m.clusterHide(); } - + // Vectors just get immediately added fg.addLayer(m); @@ -259,7 +266,7 @@ L.MarkerCluster.include({ //Move marker to new position m._preSpiderfyLatlng = m._latlng; m.setLatLng(newPos); - + if (m.clusterShow) { m.clusterShow(); } @@ -293,7 +300,7 @@ L.MarkerCluster.include({ 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, + svg = Path.SVG, m, i, leg, legPath, legLength, nonAnimatable; group._ignoreMove = true; @@ -384,7 +391,7 @@ L.MarkerCluster.include({ }); -L.MarkerClusterGroup.include({ +MarkerClusterGroup.include({ //The MarkerCluster currently spiderfied (if any) _spiderfied: null, @@ -401,7 +408,7 @@ L.MarkerClusterGroup.include({ //Browsers without zoomAnimation or a big zoom don't fire zoomstart this._map.on('zoomend', this._noanimationUnspiderfy, this); - if (!L.Browser.touch) { + if (!Browser.touch) { 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 @@ -432,7 +439,7 @@ L.MarkerClusterGroup.include({ _unspiderfyZoomAnim: function (zoomDetails) { //Wait until the first zoomanim after the user has finished touch-zooming before running the animation - if (L.DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) { + if (DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) { return; } diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index f408ba2a..9392d58d 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -1,9 +1,12 @@ -export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ - options: L.Icon.prototype.options, +import { Icon, Marker } from 'leaflet/src/layer/marker'; +import { LatLng, LatLngBounds } from 'leaflet/src/geo'; + +export var MarkerCluster = Marker.extend({ + options: Icon.prototype.options, initialize: function (group, zoom, a, b) { - L.Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new L.LatLng(0, 0), + Marker.prototype.initialize.call(this, a ? (a._cLatLng || a.getLatLng()) : new LatLng(0, 0), { icon: this, pane: group.options.clusterPane }); this._group = group; @@ -15,7 +18,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ this._iconNeedsUpdate = true; this._boundsNeedUpdate = true; - this._bounds = new L.LatLngBounds(); + this._bounds = new LatLngBounds(); if (a) { this._addChild(a); @@ -77,7 +80,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ }, getBounds: function () { - var bounds = new L.LatLngBounds(); + var bounds = new LatLngBounds(); bounds.extend(this._bounds); return bounds; }, @@ -109,7 +112,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ this._boundsNeedUpdate = true; this._setClusterCenter(new1); - if (new1 instanceof L.MarkerCluster) { + if (new1 instanceof MarkerCluster) { if (!isNotificationFromChild) { this._childClusters.push(new1); new1.__parent = this; @@ -129,7 +132,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ /** * Makes sure the cluster center is set. If not, uses the child center if it is a cluster, or the marker position. - * @param child L.MarkerCluster|L.Marker that will be used as cluster center if not defined yet. + * @param child MarkerCluster|Marker that will be used as cluster center if not defined yet. * @private */ _setClusterCenter: function (child) { @@ -141,7 +144,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ /** * Assigns impossible bounding values so that the next extend entirely determines the new bounds. - * This method avoids having to trash the previous L.LatLngBounds object and to create a new one, which is much slower for this class. + * This method avoids having to trash the previous LatLngBounds object and to create a new one, which is much slower for this class. * As long as the bounds are not extended, most other methods would probably fail, as they would with bounds initialized but not extended. * @private */ @@ -202,7 +205,7 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ lngSum += childLatLng.lng * childCount; } - this._latlng = this._wLatLng = new L.LatLng(latSum / totalCount, lngSum / totalCount); + this._latlng = this._wLatLng = new LatLng(latSum / totalCount, lngSum / totalCount); // Reset dirty flag. this._boundsNeedUpdate = false; @@ -365,11 +368,11 @@ export var MarkerCluster = L.MarkerCluster = L.Marker.extend({ }, //Run the given functions recursively to this and child clusters - // boundsToApplyTo: a L.LatLngBounds representing the bounds of what clusters to recurse in to + // boundsToApplyTo: a LatLngBounds representing the bounds of what clusters to recurse in to // zoomLevelToStart: zoom level to start running functions (inclusive) // zoomLevelToStop: zoom level to stop running functions (inclusive) - // 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 + // runAtEveryLevel: function that takes an MarkerCluster as an argument that should be applied on every level + // runAtBottomLevel: function that takes an 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, diff --git a/src/MarkerClusterGroup.Refresh.js b/src/MarkerClusterGroup.Refresh.js index a1320b02..a369d50c 100644 --- a/src/MarkerClusterGroup.Refresh.js +++ b/src/MarkerClusterGroup.Refresh.js @@ -1,32 +1,34 @@ /** - * Adds 1 public method to MCG and 1 to L.Marker to facilitate changing + * Adds 1 public method to MCG and 1 to Marker to facilitate changing * markers' icon options and refreshing their icon and their parent clusters * accordingly (case where their iconCreateFunction uses data of childMarkers * to make up the cluster icon). */ +import { MarkerClusterGroup } from './MarkerClusterGroup.js'; +import { Marker } from 'leaflet/src/layer/marker'; -L.MarkerClusterGroup.include({ +MarkerClusterGroup.include({ /** * Updates the icon of all clusters which are parents of the given marker(s). * In singleMarkerMode, also updates the given marker(s) icon. - * @param layers L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)| - * L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent + * @param layers MarkerClusterGroup|LayerGroup|Array(Marker)|Map(Marker)| + * MarkerCluster|Marker (optional) list of markers (or single marker) whose parent * clusters need to be updated. If not provided, retrieves all child markers of this. - * @returns {L.MarkerClusterGroup} + * @returns {MarkerClusterGroup} */ refreshClusters: function (layers) { if (!layers) { layers = this._topClusterLevel.getAllChildMarkers(); - } else if (layers instanceof L.MarkerClusterGroup) { + } else if (layers instanceof MarkerClusterGroup) { layers = layers._topClusterLevel.getAllChildMarkers(); - } else if (layers instanceof L.LayerGroup) { + } else if (layers instanceof LayerGroup) { layers = layers._layers; - } else if (layers instanceof L.MarkerCluster) { + } else if (layers instanceof MarkerCluster) { layers = layers.getAllChildMarkers(); - } else if (layers instanceof L.Marker) { + } else if (layers instanceof Marker) { layers = [layers]; - } // else: must be an Array(L.Marker)|Map(L.Marker) + } // else: must be an Array(Marker)|Map(Marker) this._flagParentsIconsNeedUpdate(layers); this._refreshClustersIcons(); @@ -40,7 +42,7 @@ L.MarkerClusterGroup.include({ /** * Simply flags all parent clusters of the given markers as having a "dirty" icon. - * @param layers Array(L.Marker)|Map(L.Marker) list of markers. + * @param layers Array(Marker)|Map(Marker) list of markers. * @private */ _flagParentsIconsNeedUpdate: function (layers) { @@ -64,7 +66,7 @@ L.MarkerClusterGroup.include({ /** * Re-draws the icon of the supplied markers. * To be used in singleMarkerMode only. - * @param layers Array(L.Marker)|Map(L.Marker) list of markers. + * @param layers Array(Marker)|Map(Marker) list of markers. * @private */ _refreshSingleMarkerModeMarkers: function (layers) { @@ -82,18 +84,18 @@ L.MarkerClusterGroup.include({ } }); -L.Marker.include({ +Marker.include({ /** * Updates the given options in the marker's icon and refreshes the marker. * @param options map object of icon options. * @param directlyRefreshClusters boolean (optional) true to trigger * MCG.refreshClustersOf() right away with this single marker. - * @returns {L.Marker} + * @returns {Marker} */ refreshIconOptions: function (options, directlyRefreshClusters) { var icon = this.options.icon; - L.setOptions(icon, options); + setOptions(icon, options); this.setIcon(icon); diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 99c56e7d..068076ae 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -1,13 +1,24 @@ /* - * L.MarkerClusterGroup extends L.FeatureGroup by clustering the markers contained within + * MarkerClusterGroup extends FeatureGroup by clustering the markers contained within */ -export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ +import { FeatureGroup, LayerGroup } from 'leaflet/src/layer'; +import { Marker, DivIcon } from 'leaflet/src/layer/marker'; +import { LatLng, LatLngBounds } from 'leaflet/src/geo'; +import { Browser, Util } from 'leaflet/src/core'; +import { DomUtil } from 'leaflet/src/dom'; +import { Point } from 'leaflet/src/geometry'; +import { Polygon } from 'leaflet/src/layer/vector'; + +import { MarkerCluster } from './MarkerCluster.js'; +import { DistanceGrid } from './DistanceGrid.js'; + +export var MarkerClusterGroup = FeatureGroup.extend({ options: { maxClusterRadius: 80, //A cluster will cover at most this many pixels from its center iconCreateFunction: null, - clusterPane: L.Marker.prototype.options.pane, + clusterPane: Marker.prototype.options.pane, spiderfyOnMaxZoom: true, showCoverageOnHover: true, @@ -22,7 +33,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ // Set to false to disable all animations (zoom and spiderfy). // If false, option animateAddingMarkers below has no effect. - // If L.DomUtil.TRANSITION is falsy, this option has no effect. + // If DomUtil.TRANSITION is falsy, this option has no effect. animate: true, //Whether to animate adding markers after adding the MarkerClusterGroup to the map @@ -44,20 +55,20 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ chunkDelay: 50, // at the end of each interval, give n milliseconds back to system/browser chunkProgress: null, // progress callback: function(processed, total, elapsed) (e.g. for a progress indicator) - //Options to pass to the L.Polygon constructor + //Options to pass to the Polygon constructor polygonOptions: {} }, initialize: function (options) { - L.Util.setOptions(this, options); + Util.setOptions(this, options); if (!this.options.iconCreateFunction) { this.options.iconCreateFunction = this._defaultIconCreateFunction; } - this._featureGroup = L.featureGroup(); + this._featureGroup = new FeatureGroup(); this._featureGroup.addEventParent(this); - this._nonPointGroup = L.featureGroup(); + this._nonPointGroup = new FeatureGroup(); this._nonPointGroup.addEventParent(this); this._inZoomAnimation = 0; @@ -75,15 +86,15 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ }; // Hook the appropriate animation methods. - var animate = L.DomUtil.TRANSITION && this.options.animate; - L.extend(this, animate ? this._withAnimation : this._noAnimation); + var animate = DomUtil.TRANSITION && this.options.animate; + Util.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 ? MarkerCluster : MarkerClusterNonAnimated; }, addLayer: function (layer) { - if (layer instanceof L.LayerGroup) { + if (layer instanceof LayerGroup) { return this.addLayers([layer]); } @@ -140,7 +151,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ removeLayer: function (layer) { - if (layer instanceof L.LayerGroup) { + if (layer instanceof LayerGroup) { return this.removeLayers([layer]); } @@ -191,7 +202,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ //Takes an array of markers and adds them in bulk addLayers: function (layersArray, skipLayerAddEvent) { - if (!L.Util.isArray(layersArray)) { + if (!Util.isArray(layersArray)) { return this.addLayer(layersArray); } @@ -207,7 +218,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ if (this._map) { var started = (new Date()).getTime(); - var process = L.bind(function () { + var process = Util.bind(function () { var start = (new Date()).getTime(); // Make sure to unspiderfy before starting to add some layers @@ -232,7 +243,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ // - Groups are not included in this group, only their non-group child layers (hasLayer). // Changing array length while looping does not affect performance in current browsers: // http://jsperf.com/for-loop-changing-length/6 - if (m instanceof L.LayerGroup) { + if (m instanceof LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; @@ -297,7 +308,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ m = layersArray[offset]; // Group of layers, append children to layersArray and skip. - if (m instanceof L.LayerGroup) { + if (m instanceof LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; @@ -336,7 +347,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ m = layersArray[i]; // Group of layers, append children to layersArray and skip. - if (m instanceof L.LayerGroup) { + if (m instanceof LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; @@ -366,7 +377,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ m = layersArray2[i]; // Group of layers, append children to layersArray and skip. - if (m instanceof L.LayerGroup) { + if (m instanceof LayerGroup) { this._extractNonGroupLayers(m, layersArray2); l2 = layersArray2.length; continue; @@ -380,7 +391,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ m = layersArray[i]; // Group of layers, append children to layersArray and skip. - if (m instanceof L.LayerGroup) { + if (m instanceof LayerGroup) { if (originalArray) { layersArray = layersArray.slice(); originalArray = false; @@ -453,7 +464,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ //Override FeatureGroup.getBounds as it doesn't work getBounds: function () { - var bounds = new L.LatLngBounds(); + var bounds = new LatLngBounds(); if (this._topClusterLevel) { bounds.extend(this._topClusterLevel._bounds); @@ -512,7 +523,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ id = parseInt(id, 10); this.eachLayer(function (l) { - if (L.stamp(l) === id) { + if (stamp(l) === id) { result = l; } }); @@ -725,7 +736,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ delete e.target.__dragStart; if (dragStart) { this._moveChild(e.target, dragStart, e.target._latlng); - } + } }, @@ -798,9 +809,9 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ return false; }, - //Override L.Evented.fire + //Override Evented.fire fire: function (type, data, propagate) { - if (data && data.layer instanceof L.MarkerCluster) { + if (data && data.layer instanceof 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; @@ -808,12 +819,12 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ type = 'cluster' + type; } - L.FeatureGroup.prototype.fire.call(this, type, data, propagate); + FeatureGroup.prototype.fire.call(this, type, data, propagate); }, - //Override L.Evented.listens + //Override 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 FeatureGroup.prototype.listens.call(this, type, propagate) || FeatureGroup.prototype.listens.call(this, 'cluster' + type, propagate); }, //Default functionality @@ -829,7 +840,7 @@ export var MarkerClusterGroup = L.MarkerClusterGroup = L.FeatureGroup.extend({ c += 'large'; } - return new L.DivIcon({ html: '