@react-google-maps/marker-clusterer 2.16.1 → 2.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Cluster.d.ts +28 -0
- package/dist/ClusterIcon.d.ts +43 -0
- package/dist/Clusterer.d.ts +107 -0
- package/dist/__tests__/clusterer.test.d.ts +4 -0
- package/dist/cjs.js +98 -52
- package/dist/cjs.js.map +1 -1
- package/dist/cjs.min.js +1 -1
- package/dist/cjs.min.js.map +1 -1
- package/dist/esm.js +98 -52
- package/dist/esm.js.map +1 -1
- package/dist/esm.min.js +1 -1
- package/dist/esm.min.js.map +1 -1
- package/dist/index.d.ts +54 -33
- package/dist/types.d.ts +44 -0
- package/dist/umd.js +98 -52
- package/dist/umd.js.map +1 -1
- package/dist/umd.min.js +1 -1
- package/dist/umd.min.js.map +1 -1
- package/package.json +9 -8
- package/src/Cluster.tsx +7 -7
- package/src/ClusterIcon.tsx +23 -20
- package/src/Clusterer.tsx +81 -40
- package/src/types.tsx +29 -29
package/dist/cjs.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cjs.min.js","sources":["../src/ClusterIcon.tsx","../src/Cluster.tsx","../src/Clusterer.tsx"],"sourcesContent":["/* global google */\n/* eslint-disable filenames/match-regex */\nimport { Cluster } from './Cluster'\n\nimport { ClusterIconStyle, ClusterIconInfo } from './types'\n\nexport class ClusterIcon {\n cluster: Cluster\n className: string\n clusterClassName: string\n styles: ClusterIconStyle[]\n center: google.maps.LatLng | undefined\n div: HTMLDivElement | null\n sums: ClusterIconInfo | null\n visible: boolean\n url: string\n height: number\n width: number\n anchorText: number[]\n anchorIcon: number[]\n textColor: string\n textSize: number\n textDecoration: string\n fontWeight: string\n fontStyle: string\n fontFamily: string\n backgroundPosition: string\n cMouseDownInCluster: boolean | null\n cDraggingMapByCluster: boolean | null\n timeOut: number | null\n\n boundsChangedListener: google.maps.MapsEventListener | null\n\n constructor(cluster: Cluster, styles: ClusterIconStyle[]) {\n cluster.getClusterer().extend(ClusterIcon, google.maps.OverlayView)\n\n this.cluster = cluster\n\n this.clusterClassName = this.cluster.getClusterer().getClusterClass()\n\n this.className = this.clusterClassName\n\n this.styles = styles\n\n this.center = undefined\n\n this.div = null\n\n this.sums = null\n\n this.visible = false\n\n this.boundsChangedListener = null\n\n this.url = ''\n\n this.height = 0\n this.width = 0\n\n this.anchorText = [0, 0]\n this.anchorIcon = [0, 0]\n\n this.textColor = 'black'\n this.textSize = 11\n this.textDecoration = 'none'\n this.fontWeight = 'bold'\n this.fontStyle = 'normal'\n this.fontFamily = 'Arial,sans-serif'\n\n this.backgroundPosition = '0 0'\n\n this.cMouseDownInCluster = null\n this.cDraggingMapByCluster = null\n this.timeOut = null;\n\n (this as unknown as google.maps.OverlayView).setMap(cluster.getMap()) // Note: this causes onAdd to be called\n\n this.onBoundsChanged = this.onBoundsChanged.bind(this)\n this.onMouseDown = this.onMouseDown.bind(this)\n this.onClick = this.onClick.bind(this)\n this.onMouseOver = this.onMouseOver.bind(this)\n this.onMouseOut = this.onMouseOut.bind(this)\n this.onAdd = this.onAdd.bind(this)\n this.onRemove = this.onRemove.bind(this)\n this.draw = this.draw.bind(this)\n this.hide = this.hide.bind(this)\n this.show = this.show.bind(this)\n this.useStyle = this.useStyle.bind(this)\n this.setCenter = this.setCenter.bind(this)\n this.getPosFromLatLng = this.getPosFromLatLng.bind(this)\n }\n\n onBoundsChanged() {\n this.cDraggingMapByCluster = this.cMouseDownInCluster\n }\n\n onMouseDown() {\n this.cMouseDownInCluster = true\n\n this.cDraggingMapByCluster = false\n }\n\n onClick(event: Event) {\n this.cMouseDownInCluster = false\n\n if (!this.cDraggingMapByCluster) {\n const markerClusterer = this.cluster.getClusterer()\n\n /**\n * This event is fired when a cluster marker is clicked.\n * @name MarkerClusterer#click\n * @param {Cluster} c The cluster that was clicked.\n * @event\n */\n google.maps.event.trigger(markerClusterer, 'click', this.cluster)\n google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster) // deprecated name\n\n // The default click handler follows. Disable it by setting\n // the zoomOnClick property to false.\n if (markerClusterer.getZoomOnClick()) {\n // Zoom into the cluster.\n const maxZoom = markerClusterer.getMaxZoom()\n\n const bounds = this.cluster.getBounds()\n\n const map = (markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null && 'fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n\n // There is a fix for Issue 170 here:\n this.timeOut = window.setTimeout(() => {\n const map = (markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null) {\n if ('fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n const zoom = map.getZoom() || 0\n\n // Don't zoom beyond the max zoom level\n if (\n maxZoom !== null &&\n zoom > maxZoom\n ) {\n map.setZoom(maxZoom + 1)\n }\n }\n }, 100)\n }\n\n // Prevent event propagation to the map:\n event.cancelBubble = true\n\n if (event.stopPropagation) {\n event.stopPropagation()\n }\n }\n }\n\n onMouseOver() {\n /**\n * This event is fired when the mouse moves over a cluster marker.\n * @name MarkerClusterer#mouseover\n * @param {Cluster} c The cluster that the mouse moved over.\n * @event\n */\n google.maps.event.trigger(\n this.cluster.getClusterer(),\n 'mouseover',\n this.cluster\n )\n }\n\n onMouseOut() {\n /**\n * This event is fired when the mouse moves out of a cluster marker.\n * @name MarkerClusterer#mouseout\n * @param {Cluster} c The cluster that the mouse moved out of.\n * @event\n */\n google.maps.event.trigger(\n this.cluster.getClusterer(),\n 'mouseout',\n this.cluster\n )\n }\n\n onAdd() {\n this.div = document.createElement('div')\n\n this.div.className = this.className\n\n if (this.visible) {\n this.show()\n }\n\n ;(this as unknown as google.maps.OverlayView).getPanes()?.overlayMouseTarget.appendChild(this.div)\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null) {\n // Fix for Issue 157\n this.boundsChangedListener = google.maps.event.addListener(\n map,\n 'bounds_changed',\n this.onBoundsChanged\n )\n\n this.div.addEventListener('mousedown', this.onMouseDown)\n\n this.div.addEventListener('click', this.onClick)\n\n this.div.addEventListener('mouseover', this.onMouseOver)\n\n this.div.addEventListener('mouseout', this.onMouseOut)\n }\n }\n\n onRemove() {\n if (this.div && this.div.parentNode) {\n this.hide()\n\n if (this.boundsChangedListener !== null) {\n google.maps.event.removeListener(this.boundsChangedListener)\n }\n\n this.div.removeEventListener('mousedown', this.onMouseDown)\n\n this.div.removeEventListener('click', this.onClick)\n\n this.div.removeEventListener('mouseover', this.onMouseOver)\n\n this.div.removeEventListener('mouseout', this.onMouseOut)\n\n this.div.parentNode.removeChild(this.div)\n\n if (this.timeOut !== null) {\n window.clearTimeout(this.timeOut)\n\n this.timeOut = null\n }\n\n this.div = null\n }\n }\n\n draw() {\n if (this.visible && this.div !== null && this.center) {\n const pos = this.getPosFromLatLng(this.center)\n\n this.div.style.top = pos !== null ? `${pos.y}px` : '0'\n this.div.style.left = pos !== null ? `${pos.x}px` : '0'\n }\n }\n\n hide() {\n if (this.div) {\n this.div.style.display = 'none'\n }\n\n this.visible = false\n }\n\n show() {\n if (this.div && this.center) {\n const divTitle = this.sums === null ||\n typeof this.sums.title === 'undefined' ||\n this.sums.title === '' ? this.cluster.getClusterer().getTitle() : this.sums.title\n\n // NOTE: values must be specified in px units\n const bp = this.backgroundPosition.split(' ')\n\n const spriteH = parseInt(bp[0].replace(/^\\s+|\\s+$/g, ''), 10)\n const spriteV = parseInt(bp[1].replace(/^\\s+|\\s+$/g, ''), 10)\n\n const pos = this.getPosFromLatLng(this.center)\n\n this.div.className = this.className\n this.div .setAttribute('style', `cursor: pointer; position: absolute; top: ${pos !== null ? `${pos.y}px` : '0'}; left: ${pos !== null ? `${pos.x}px` : '0'}; width: ${this.width}px; height: ${this.height}px; `)\n\n const img = document.createElement('img')\n\n img.alt = divTitle\n img.src = this.url\n img.width = this.width\n img.height = this.height\n img.setAttribute('style', `position: absolute; top: ${spriteV}px; left: ${spriteH}px`)\n\n if (!this.cluster.getClusterer().enableRetinaIcons) {\n img.style.clip = `rect(-${spriteV}px, -${spriteH + this.width}px, -${\n spriteV + this.height\n }, -${spriteH})`\n }\n\n const textElm = document.createElement('div')\n\n textElm .setAttribute('style', `position: absolute; top: ${this.anchorText[0]}px; left: ${this.anchorText[1]}px; color: ${this.textColor}; font-size: ${this.textSize}px; font-family: ${this.fontFamily}; font-weight: ${this.fontWeight}; fontStyle: ${this.fontStyle}; text-decoration: ${this.textDecoration}; text-align: center; width: ${this.width}px; line-height: ${this.height}px`)\n\n if (this.sums?.text) textElm.innerText = `${this.sums?.text}`\n if (this.sums?.html) textElm.innerHTML = `${this.sums?.html}`\n\n this.div.innerHTML = ''\n\n this.div.appendChild(img)\n this.div.appendChild(textElm)\n\n this.div.title = divTitle\n\n this.div.style.display = ''\n }\n\n this.visible = true\n }\n\n useStyle(sums: ClusterIconInfo) {\n this.sums = sums\n\n const styles = this.cluster.getClusterer().getStyles()\n\n const style =\n styles[Math.min(styles.length - 1, Math.max(0, sums.index - 1))]\n\n this.url = style.url\n this.height = style.height\n this.width = style.width\n\n if (style.className)\n this.className = `${this.clusterClassName} ${style.className}`\n\n this.anchorText = style.anchorText || [0, 0]\n this.anchorIcon = style.anchorIcon || [this.height / 2, this.width / 2]\n\n this.textColor = style.textColor || 'black'\n\n this.textSize = style.textSize || 11\n\n this.textDecoration = style.textDecoration || 'none'\n\n this.fontWeight = style.fontWeight || 'bold'\n\n this.fontStyle = style.fontStyle || 'normal'\n\n this.fontFamily = style.fontFamily || 'Arial,sans-serif'\n\n this.backgroundPosition = style.backgroundPosition || '0 0'\n }\n\n setCenter(center: google.maps.LatLng) {\n this.center = center\n }\n\n getPosFromLatLng(latlng: google.maps.LatLng): google.maps.Point | null {\n const pos = (this as unknown as google.maps.OverlayView).getProjection().fromLatLngToDivPixel(latlng)\n\n if (pos !== null) {\n pos.x -= this.anchorIcon[1]\n\n pos.y -= this.anchorIcon[0]\n }\n\n return pos\n }\n}\n","/* global google */\n/* eslint-disable filenames/match-regex */\nimport { Clusterer } from './Clusterer'\n\nimport { ClusterIcon } from './ClusterIcon'\n\nimport { MarkerExtended } from './types'\n\nexport class Cluster {\n markerClusterer: Clusterer\n map: google.maps.Map | google.maps.StreetViewPanorama | null\n gridSize: number\n minClusterSize: number\n averageCenter: boolean\n markers: MarkerExtended[]\n center: google.maps.LatLng | undefined\n bounds: google.maps.LatLngBounds | null\n clusterIcon: ClusterIcon\n\n constructor(markerClusterer: Clusterer) {\n this.markerClusterer = markerClusterer\n\n this.map = (this.markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n this.gridSize = this.markerClusterer.getGridSize()\n\n this.minClusterSize = this.markerClusterer.getMinimumClusterSize()\n\n this.averageCenter = this.markerClusterer.getAverageCenter()\n\n this.markers = []\n\n this.center = undefined\n\n this.bounds = null\n\n this.clusterIcon = new ClusterIcon(this, this.markerClusterer.getStyles())\n\n this.getSize = this.getSize.bind(this)\n this.getMarkers = this.getMarkers.bind(this)\n this.getCenter = this.getCenter.bind(this)\n this.getMap = this.getMap.bind(this)\n this.getClusterer = this.getClusterer.bind(this)\n this.getBounds = this.getBounds.bind(this)\n this.remove = this.remove.bind(this)\n this.addMarker = this.addMarker.bind(this)\n this.isMarkerInClusterBounds = this.isMarkerInClusterBounds.bind(this)\n this.calculateBounds = this.calculateBounds.bind(this)\n this.updateIcon = this.updateIcon.bind(this)\n this.isMarkerAlreadyAdded = this.isMarkerAlreadyAdded.bind(this)\n }\n\n getSize(): number {\n return this.markers.length\n }\n\n getMarkers(): MarkerExtended[] {\n return this.markers\n }\n\n getCenter(): google.maps.LatLng | undefined {\n return this.center\n }\n\n getMap(): google.maps.Map | google.maps.StreetViewPanorama | null {\n return this.map\n }\n\n getClusterer(): Clusterer {\n return this.markerClusterer\n }\n\n getBounds(): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds(this.center, this.center)\n\n const markers = this.getMarkers()\n\n for (let i = 0; i < markers.length; i++) {\n const position = markers[i].getPosition()\n\n if (position) {\n bounds.extend(position)\n }\n }\n\n return bounds\n }\n\n remove() {\n (this.clusterIcon as unknown as google.maps.OverlayView).setMap(null)\n\n this.markers = []\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete this.markers\n }\n\n addMarker(marker: MarkerExtended): boolean {\n if (this.isMarkerAlreadyAdded(marker)) {\n return false\n }\n\n if (!this.center) {\n const position = marker.getPosition()\n\n if (position) {\n this.center = position\n\n this.calculateBounds()\n }\n } else {\n if (this.averageCenter) {\n const position = marker.getPosition()\n\n if (position) {\n const length = this.markers.length + 1\n\n this.center = new google.maps.LatLng(\n (this.center.lat() * (length - 1) + position.lat()) / length,\n (this.center.lng() * (length - 1) + position.lng()) / length\n )\n\n this.calculateBounds()\n }\n }\n }\n\n marker.isAdded = true\n\n this.markers.push(marker)\n\n const mCount = this.markers.length\n\n const maxZoom = this.markerClusterer.getMaxZoom()\n\n const zoom = this.map?.getZoom()\n\n if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {\n // Zoomed in past max zoom, so show the marker.\n if (marker.getMap() !== this.map) {\n marker.setMap(this.map)\n }\n } else if (mCount < this.minClusterSize) {\n // Min cluster size not reached so show the marker.\n if (marker.getMap() !== this.map) {\n marker.setMap(this.map)\n }\n } else if (mCount === this.minClusterSize) {\n // Hide the markers that were showing.\n for (let i = 0; i < mCount; i++) {\n this.markers[i].setMap(null)\n }\n } else {\n marker.setMap(null)\n }\n\n return true\n }\n\n isMarkerInClusterBounds(marker: MarkerExtended): boolean {\n if (this.bounds !== null) {\n const position = marker.getPosition()\n\n if (position) {\n return this.bounds.contains(position)\n }\n }\n\n return false\n }\n\n calculateBounds() {\n this.bounds = this.markerClusterer.getExtendedBounds(\n new google.maps.LatLngBounds(this.center, this.center)\n )\n }\n\n updateIcon() {\n const mCount = this.markers.length\n\n const maxZoom = this.markerClusterer.getMaxZoom()\n\n const zoom = this.map?.getZoom()\n\n if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {\n this.clusterIcon.hide()\n\n return\n }\n\n if (mCount < this.minClusterSize) {\n // Min cluster size not yet reached.\n this.clusterIcon.hide()\n\n return\n }\n\n if (this.center) {\n this.clusterIcon.setCenter(this.center)\n }\n\n this.clusterIcon.useStyle(\n this.markerClusterer.getCalculator()(this.markers, this.markerClusterer.getStyles().length)\n )\n\n this.clusterIcon.show()\n }\n\n isMarkerAlreadyAdded(marker: MarkerExtended): boolean {\n if (this.markers.includes) {\n return this.markers.includes(marker)\n }\n\n for (let i = 0; i < this.markers.length; i++) {\n if (marker === this.markers[i]) {\n return true\n }\n }\n\n return false\n }\n}\n","/* global google */\n/* eslint-disable filenames/match-regex */\nimport { Cluster } from './Cluster'\nimport { ClusterIcon } from './ClusterIcon'\n\nimport {\n MarkerExtended,\n ClustererOptions,\n ClusterIconStyle,\n TCalculator,\n ClusterIconInfo,\n} from './types'\n\n/**\n * Supports up to 9007199254740991 (Number.MAX_SAFE_INTEGER) markers\n * which is not a problem as max array length is 4294967296 (2**32)\n */\nfunction CALCULATOR(\n markers: MarkerExtended[],\n numStyles: number\n): ClusterIconInfo {\n const count = markers.length\n\n const numberOfDigits = count.toString().length\n\n const index = Math.min(numberOfDigits, numStyles)\n\n return {\n text: count.toString(),\n index,\n title: '',\n }\n}\n\nconst BATCH_SIZE = 2000\n\nconst BATCH_SIZE_IE = 500\n\nconst IMAGE_PATH =\n 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'\n\nconst IMAGE_EXTENSION = 'png'\n\nconst IMAGE_SIZES = [53, 56, 66, 78, 90]\n\nconst CLUSTERER_CLASS = 'cluster'\n\nexport class Clusterer {\n markers: MarkerExtended[]\n clusters: Cluster[]\n listeners: google.maps.MapsEventListener[]\n activeMap: google.maps.Map | google.maps.StreetViewPanorama | null\n ready: boolean\n gridSize: number\n minClusterSize: number\n maxZoom: number | null\n styles: ClusterIconStyle[]\n title: string\n zoomOnClick: boolean\n averageCenter: boolean\n ignoreHidden: boolean\n enableRetinaIcons: boolean\n imagePath: string\n imageExtension: string\n imageSizes: number[]\n calculator: TCalculator\n batchSize: number\n batchSizeIE: number\n clusterClass: string\n timerRefStatic: number | null\n\n constructor(\n map: google.maps.Map,\n optMarkers: MarkerExtended[] = [],\n optOptions: ClustererOptions = {}\n ) {\n this.getMinimumClusterSize = this.getMinimumClusterSize.bind(this)\n this.setMinimumClusterSize = this.setMinimumClusterSize.bind(this)\n this.getEnableRetinaIcons = this.getEnableRetinaIcons.bind(this)\n this.setEnableRetinaIcons = this.setEnableRetinaIcons.bind(this)\n this.addToClosestCluster = this.addToClosestCluster.bind(this)\n this.getImageExtension = this.getImageExtension.bind(this)\n this.setImageExtension = this.setImageExtension.bind(this)\n this.getExtendedBounds = this.getExtendedBounds.bind(this)\n this.getAverageCenter = this.getAverageCenter.bind(this)\n this.setAverageCenter = this.setAverageCenter.bind(this)\n this.getTotalClusters = this.getTotalClusters.bind(this)\n this.fitMapToMarkers = this.fitMapToMarkers.bind(this)\n this.getIgnoreHidden = this.getIgnoreHidden.bind(this)\n this.setIgnoreHidden = this.setIgnoreHidden.bind(this)\n this.getClusterClass = this.getClusterClass.bind(this)\n this.setClusterClass = this.setClusterClass.bind(this)\n this.getTotalMarkers = this.getTotalMarkers.bind(this)\n this.getZoomOnClick = this.getZoomOnClick.bind(this)\n this.setZoomOnClick = this.setZoomOnClick.bind(this)\n this.getBatchSizeIE = this.getBatchSizeIE.bind(this)\n this.setBatchSizeIE = this.setBatchSizeIE.bind(this)\n this.createClusters = this.createClusters.bind(this)\n this.onZoomChanged = this.onZoomChanged.bind(this)\n this.getImageSizes = this.getImageSizes.bind(this)\n this.setImageSizes = this.setImageSizes.bind(this)\n this.getCalculator = this.getCalculator.bind(this)\n this.setCalculator = this.setCalculator.bind(this)\n this.removeMarkers = this.removeMarkers.bind(this)\n this.resetViewport = this.resetViewport.bind(this)\n this.getImagePath = this.getImagePath.bind(this)\n this.setImagePath = this.setImagePath.bind(this)\n this.pushMarkerTo = this.pushMarkerTo.bind(this)\n this.removeMarker = this.removeMarker.bind(this)\n this.clearMarkers = this.clearMarkers.bind(this)\n this.setupStyles = this.setupStyles.bind(this)\n this.getGridSize = this.getGridSize.bind(this)\n this.setGridSize = this.setGridSize.bind(this)\n this.getClusters = this.getClusters.bind(this)\n this.getMaxZoom = this.getMaxZoom.bind(this)\n this.setMaxZoom = this.setMaxZoom.bind(this)\n this.getMarkers = this.getMarkers.bind(this)\n this.addMarkers = this.addMarkers.bind(this)\n this.getStyles = this.getStyles.bind(this)\n this.setStyles = this.setStyles.bind(this)\n this.addMarker = this.addMarker.bind(this)\n this.onRemove = this.onRemove.bind(this)\n this.getTitle = this.getTitle.bind(this)\n this.setTitle = this.setTitle.bind(this)\n this.repaint = this.repaint.bind(this)\n this.onIdle = this.onIdle.bind(this)\n this.redraw = this.redraw.bind(this)\n this.extend = this.extend.bind(this)\n this.onAdd = this.onAdd.bind(this)\n this.draw = this.draw.bind(this)\n\n this.extend(Clusterer, google.maps.OverlayView)\n\n this.markers = []\n this.clusters = []\n this.listeners = []\n this.activeMap = null\n this.ready = false\n this.gridSize = optOptions.gridSize || 60\n this.minClusterSize = optOptions.minimumClusterSize || 2\n this.maxZoom = optOptions.maxZoom || null\n this.styles = optOptions.styles || []\n\n this.title = optOptions.title || ''\n\n this.zoomOnClick = true\n\n if (optOptions.zoomOnClick !== undefined) {\n this.zoomOnClick = optOptions.zoomOnClick\n }\n\n this.averageCenter = false\n\n if (optOptions.averageCenter !== undefined) {\n this.averageCenter = optOptions.averageCenter\n }\n\n this.ignoreHidden = false\n\n if (optOptions.ignoreHidden !== undefined) {\n this.ignoreHidden = optOptions.ignoreHidden\n }\n\n this.enableRetinaIcons = false\n\n if (optOptions.enableRetinaIcons !== undefined) {\n this.enableRetinaIcons = optOptions.enableRetinaIcons\n }\n this.imagePath = optOptions.imagePath || IMAGE_PATH\n\n this.imageExtension = optOptions.imageExtension || IMAGE_EXTENSION\n\n this.imageSizes = optOptions.imageSizes || IMAGE_SIZES\n\n this.calculator = optOptions.calculator || CALCULATOR\n\n this.batchSize = optOptions.batchSize || BATCH_SIZE\n\n this.batchSizeIE = optOptions.batchSizeIE || BATCH_SIZE_IE\n\n this.clusterClass = optOptions.clusterClass || CLUSTERER_CLASS\n\n if (navigator.userAgent.toLowerCase().indexOf('msie') !== -1) {\n // Try to avoid IE timeout when processing a huge number of markers:\n this.batchSize = this.batchSizeIE\n }\n\n this.timerRefStatic = null\n\n this.setupStyles()\n\n this.addMarkers(optMarkers, true);\n\n (this as unknown as google.maps.OverlayView).setMap(map) // Note: this causes onAdd to be called\n }\n\n onZoomChanged() {\n this.resetViewport(false)\n\n // Workaround for this Google bug: when map is at level 0 and \"-\" of\n // zoom slider is clicked, a \"zoom_changed\" event is fired even though\n // the map doesn't zoom out any further. In this situation, no \"idle\"\n // event is triggered so the cluster markers that have been removed\n // do not get redrawn. Same goes for a zoom in at maxZoom.\n if (\n (this as unknown as google.maps.OverlayView).getMap()?.getZoom() === ((this as unknown as google.maps.OverlayView).get('minZoom') || 0) ||\n (this as unknown as google.maps.OverlayView).getMap()?.getZoom() === (this as unknown as google.maps.OverlayView).get('maxZoom')\n ) {\n google.maps.event.trigger(this, 'idle')\n }\n }\n\n onIdle() {\n this.redraw()\n }\n\n onAdd() {\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n this.activeMap = map\n\n this.ready = true\n\n this.repaint()\n\n if (map !== null) {\n // Add the map event listeners\n this.listeners = [\n google.maps.event.addListener(\n map,\n 'zoom_changed',\n this.onZoomChanged\n ),\n google.maps.event.addListener(\n map,\n 'idle',\n this.onIdle\n ),\n ]\n }\n }\n\n onRemove() {\n // Put all the managed markers back on the map:\n for (let i = 0; i < this.markers.length; i++) {\n if (this.markers[i].getMap() !== this.activeMap) {\n this.markers[i].setMap(this.activeMap)\n }\n }\n\n // Remove all clusters:\n for (let i = 0; i < this.clusters.length; i++) {\n this.clusters[i].remove()\n }\n\n this.clusters = []\n\n // Remove map event listeners:\n for (let i = 0; i < this.listeners.length; i++) {\n google.maps.event.removeListener(this.listeners[i])\n }\n\n this.listeners = []\n\n this.activeMap = null\n\n this.ready = false\n }\n\n draw() { return }\n\n setupStyles() {\n if (this.styles.length > 0) {\n return\n }\n\n for (let i = 0; i < this.imageSizes.length; i++) {\n this.styles.push({\n url: `${this.imagePath + (i + 1)}.${this.imageExtension}`,\n height: this.imageSizes[i],\n width: this.imageSizes[i],\n })\n }\n }\n\n fitMapToMarkers() {\n const markers = this.getMarkers()\n\n const bounds = new google.maps.LatLngBounds()\n\n for (let i = 0; i < markers.length; i++) {\n const position = markers[i].getPosition()\n\n if (position) {\n bounds.extend(position)\n }\n }\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null && 'fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n }\n\n getGridSize(): number {\n return this.gridSize\n }\n\n setGridSize(gridSize: number) {\n this.gridSize = gridSize\n }\n\n getMinimumClusterSize(): number {\n return this.minClusterSize\n }\n\n setMinimumClusterSize(minimumClusterSize: number) {\n this.minClusterSize = minimumClusterSize\n }\n\n getMaxZoom(): number | null {\n return this.maxZoom\n }\n\n setMaxZoom(maxZoom: number) {\n this.maxZoom = maxZoom\n }\n\n getStyles(): ClusterIconStyle[] {\n return this.styles\n }\n\n setStyles(styles: ClusterIconStyle[]) {\n this.styles = styles\n }\n\n getTitle(): string {\n return this.title\n }\n\n setTitle(title: string) {\n this.title = title\n }\n\n getZoomOnClick(): boolean {\n return this.zoomOnClick\n }\n\n setZoomOnClick(zoomOnClick: boolean) {\n this.zoomOnClick = zoomOnClick\n }\n\n getAverageCenter(): boolean {\n return this.averageCenter\n }\n\n setAverageCenter(averageCenter: boolean) {\n this.averageCenter = averageCenter\n }\n\n getIgnoreHidden(): boolean {\n return this.ignoreHidden\n }\n\n setIgnoreHidden(ignoreHidden: boolean) {\n this.ignoreHidden = ignoreHidden\n }\n\n getEnableRetinaIcons(): boolean {\n return this.enableRetinaIcons\n }\n\n setEnableRetinaIcons(enableRetinaIcons: boolean) {\n this.enableRetinaIcons = enableRetinaIcons\n }\n\n getImageExtension(): string {\n return this.imageExtension\n }\n\n setImageExtension(imageExtension: string) {\n this.imageExtension = imageExtension\n }\n\n getImagePath(): string {\n return this.imagePath\n }\n\n setImagePath(imagePath: string) {\n this.imagePath = imagePath\n }\n\n getImageSizes(): number[] {\n return this.imageSizes\n }\n\n setImageSizes(imageSizes: number[]) {\n this.imageSizes = imageSizes\n }\n\n getCalculator(): TCalculator {\n return this.calculator\n }\n\n setCalculator(calculator: TCalculator) {\n this.calculator = calculator\n }\n\n getBatchSizeIE(): number {\n return this.batchSizeIE\n }\n\n setBatchSizeIE(batchSizeIE: number) {\n this.batchSizeIE = batchSizeIE\n }\n\n getClusterClass(): string {\n return this.clusterClass\n }\n\n setClusterClass(clusterClass: string) {\n this.clusterClass = clusterClass\n }\n\n getMarkers(): MarkerExtended[] {\n return this.markers\n }\n\n getTotalMarkers(): number {\n return this.markers.length\n }\n\n getClusters(): Cluster[] {\n return this.clusters\n }\n\n getTotalClusters(): number {\n return this.clusters.length\n }\n\n addMarker(marker: MarkerExtended, optNoDraw: boolean) {\n this.pushMarkerTo(marker)\n\n if (!optNoDraw) {\n this.redraw()\n }\n }\n\n addMarkers(markers: MarkerExtended[], optNoDraw: boolean) {\n for (const key in markers) {\n if (Object.prototype.hasOwnProperty.call(markers, key)) {\n this.pushMarkerTo(markers[key])\n }\n }\n\n if (!optNoDraw) {\n this.redraw()\n }\n }\n\n pushMarkerTo(marker: MarkerExtended) {\n // If the marker is draggable add a listener so we can update the clusters on the dragend:\n if (marker.getDraggable()) {\n google.maps.event.addListener(marker, 'dragend', () => {\n if (this.ready) {\n marker.isAdded = false\n\n this.repaint()\n }\n })\n }\n\n marker.isAdded = false\n\n this.markers.push(marker)\n }\n\n removeMarker_(marker: MarkerExtended): boolean {\n let index = -1\n\n if (this.markers.indexOf) {\n index = this.markers.indexOf(marker)\n } else {\n for (let i = 0; i < this.markers.length; i++) {\n if (marker === this.markers[i]) {\n index = i\n\n break\n }\n }\n }\n\n if (index === -1) {\n // Marker is not in our list of markers, so do nothing:\n return false\n }\n\n marker.setMap(null)\n\n this.markers.splice(index, 1) // Remove the marker from the list of managed markers\n\n return true\n }\n\n removeMarker(marker: MarkerExtended, optNoDraw: boolean): boolean {\n const removed = this.removeMarker_(marker)\n\n if (!optNoDraw && removed) {\n this.repaint()\n }\n\n return removed\n }\n\n removeMarkers(markers: MarkerExtended[], optNoDraw: boolean): boolean {\n let removed = false\n\n for (let i = 0; i < markers.length; i++) {\n removed = removed || this.removeMarker_(markers[i])\n }\n\n if (!optNoDraw && removed) {\n this.repaint()\n }\n\n return removed\n }\n\n clearMarkers() {\n this.resetViewport(true)\n\n this.markers = []\n }\n\n repaint() {\n const oldClusters = this.clusters.slice()\n\n this.clusters = []\n\n this.resetViewport(false)\n\n this.redraw()\n\n // Remove the old clusters.\n // Do it in a timeout to prevent blinking effect.\n setTimeout(function timeout() {\n for (let i = 0; i < oldClusters.length; i++) {\n oldClusters[i].remove()\n }\n }, 0)\n }\n\n getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds {\n const projection = (this as unknown as google.maps.OverlayView).getProjection()\n\n // Convert the points to pixels and the extend out by the grid size.\n const trPix = projection.fromLatLngToDivPixel(\n // Turn the bounds into latlng.\n new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getNorthEast().lng())\n )\n\n if (trPix !== null) {\n trPix.x += this.gridSize\n trPix.y -= this.gridSize\n }\n\n const blPix = projection.fromLatLngToDivPixel(\n // Turn the bounds into latlng.\n new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng())\n )\n\n if (blPix !== null) {\n blPix.x -= this.gridSize\n blPix.y += this.gridSize\n }\n\n\n // Extend the bounds to contain the new bounds.\n if (trPix !== null) {\n // Convert the pixel points back to LatLng nw\n const point1 = projection.fromDivPixelToLatLng(trPix)\n\n if (point1 !== null) {\n bounds.extend(point1)\n }\n }\n\n if (blPix !== null) {\n // Convert the pixel points back to LatLng sw\n const point2 = projection.fromDivPixelToLatLng(blPix)\n\n if (point2 !== null) {\n bounds.extend(\n point2\n )\n }\n }\n\n\n return bounds\n }\n\n redraw() {\n // Redraws all the clusters.\n this.createClusters(0)\n }\n\n resetViewport(optHide: boolean) {\n // Remove all the clusters\n for (let i = 0; i < this.clusters.length; i++) {\n this.clusters[i].remove()\n }\n\n this.clusters = []\n\n // Reset the markers to not be added and to be removed from the map.\n for (let i = 0; i < this.markers.length; i++) {\n const marker = this.markers[i]\n\n marker.isAdded = false\n\n if (optHide) {\n marker.setMap(null)\n }\n }\n }\n\n distanceBetweenPoints(p1: google.maps.LatLng, p2: google.maps.LatLng): number {\n const R = 6371 // Radius of the Earth in km\n\n const dLat = ((p2.lat() - p1.lat()) * Math.PI) / 180\n const dLon = ((p2.lng() - p1.lng()) * Math.PI) / 180\n\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos((p1.lat() * Math.PI) / 180) *\n Math.cos((p2.lat() * Math.PI) / 180) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2)\n\n return R * (2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)))\n }\n\n isMarkerInBounds(marker: MarkerExtended, bounds: google.maps.LatLngBounds): boolean {\n const position = marker.getPosition()\n\n if (position) {\n return bounds.contains(position)\n }\n\n return false\n }\n\n addToClosestCluster(marker: MarkerExtended) {\n let cluster\n\n let distance = 40000 // Some large number\n\n let clusterToAddTo = null\n\n for (let i = 0; i < this.clusters.length; i++) {\n cluster = this.clusters[i]\n\n const center = cluster.getCenter()\n\n const position = marker.getPosition()\n\n if (center && position) {\n const d = this.distanceBetweenPoints(center, position)\n\n if (d < distance) {\n distance = d\n\n clusterToAddTo = cluster\n }\n }\n }\n\n if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {\n clusterToAddTo.addMarker(marker)\n } else {\n cluster = new Cluster(this)\n\n cluster.addMarker(marker)\n\n this.clusters.push(cluster)\n }\n }\n\n createClusters(iFirst: number) {\n if (!this.ready) {\n return\n }\n\n // Cancel previous batch processing if we're working on the first batch:\n if (iFirst === 0) {\n /**\n * This event is fired when the <code>Clusterer</code> begins\n * clustering markers.\n * @name Clusterer#clusteringbegin\n * @param {Clusterer} mc The Clusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, 'clusteringbegin', this)\n\n if (this.timerRefStatic !== null) {\n window.clearTimeout(this.timerRefStatic)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete this.timerRefStatic\n }\n }\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n const bounds = map !== null && 'getBounds' in map ? map.getBounds() : null\n\n const zoom = map?.getZoom() || 0\n // Get our current map view bounds.\n // Create a new bounds object so we don't affect the map.\n //\n // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:\n const mapBounds = zoom > 3\n ? new google.maps.LatLngBounds(\n bounds?.getSouthWest(),\n bounds?.getNorthEast()\n )\n : new google.maps.LatLngBounds(\n new google.maps.LatLng(85.02070771743472, -178.48388434375),\n new google.maps.LatLng(-85.08136444384544, 178.00048865625)\n )\n\n const extendedMapBounds = this.getExtendedBounds(mapBounds)\n\n const iLast = Math.min(iFirst + this.batchSize, this.markers.length)\n\n for (let i = iFirst; i < iLast; i++) {\n const marker = this.markers[i]\n\n if (!marker.isAdded && this.isMarkerInBounds(marker, extendedMapBounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {\n this.addToClosestCluster(marker)\n }\n }\n\n if (iLast < this.markers.length) {\n this.timerRefStatic = window.setTimeout(\n () => {\n this.createClusters(iLast)\n },\n 0\n )\n } else {\n this.timerRefStatic = null\n\n /**\n * This event is fired when the <code>Clusterer</code> stops\n * clustering markers.\n * @name Clusterer#clusteringend\n * @param {Clusterer} mc The Clusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, 'clusteringend', this)\n\n for (let i = 0; i < this.clusters.length; i++) {\n this.clusters[i].updateIcon()\n }\n }\n }\n\n extend<A extends typeof ClusterIcon | typeof Clusterer>(obj1: A, obj2: typeof google.maps.OverlayView): A {\n return function applyExtend(this: A, object: typeof google.maps.OverlayView): A {\n for (const property in object.prototype) {\n // @ts-ignore\n this.prototype[property] = object.prototype[property as keyof google.maps.OverlayView]\n }\n\n return this\n }.apply<A, [typeof google.maps.OverlayView], any>(obj1, [obj2])\n }\n}\n"],"names":["ClusterIcon","cluster","styles","getClusterer","extend","google","maps","OverlayView","this","clusterClassName","getClusterClass","className","center","undefined","div","sums","visible","boundsChangedListener","url","height","width","anchorText","anchorIcon","textColor","textSize","textDecoration","fontWeight","fontStyle","fontFamily","backgroundPosition","cMouseDownInCluster","cDraggingMapByCluster","timeOut","setMap","getMap","onBoundsChanged","bind","onMouseDown","onClick","onMouseOver","onMouseOut","onAdd","onRemove","draw","hide","show","useStyle","setCenter","getPosFromLatLng","prototype","event","markerClusterer_1","trigger","getZoomOnClick","maxZoom_1","getMaxZoom","bounds_1","getBounds","map","fitBounds","window","setTimeout","zoom","getZoom","setZoom","cancelBubble","stopPropagation","document","createElement","_a","getPanes","overlayMouseTarget","appendChild","addListener","addEventListener","parentNode","removeListener","removeEventListener","removeChild","clearTimeout","pos","style","top","concat","y","left","x","display","divTitle","title","getTitle","bp","split","spriteH","parseInt","replace","spriteV","setAttribute","img","alt","src","enableRetinaIcons","clip","textElm","text","innerText","_b","_c","html","innerHTML","_d","getStyles","Math","min","length","max","index","latlng","getProjection","fromLatLngToDivPixel","Cluster","markerClusterer","gridSize","getGridSize","minClusterSize","getMinimumClusterSize","averageCenter","getAverageCenter","markers","bounds","clusterIcon","getSize","getMarkers","getCenter","remove","addMarker","isMarkerInClusterBounds","calculateBounds","updateIcon","isMarkerAlreadyAdded","LatLngBounds","i","position","getPosition","marker","length_1","LatLng","lat","lng","isAdded","push","mCount","maxZoom","contains","getExtendedBounds","getCalculator","includes","CALCULATOR","numStyles","count","numberOfDigits","toString","IMAGE_SIZES","Clusterer","optMarkers","optOptions","setMinimumClusterSize","getEnableRetinaIcons","setEnableRetinaIcons","addToClosestCluster","getImageExtension","setImageExtension","setAverageCenter","getTotalClusters","fitMapToMarkers","getIgnoreHidden","setIgnoreHidden","setClusterClass","getTotalMarkers","setZoomOnClick","getBatchSizeIE","setBatchSizeIE","createClusters","onZoomChanged","getImageSizes","setImageSizes","setCalculator","removeMarkers","resetViewport","getImagePath","setImagePath","pushMarkerTo","removeMarker","clearMarkers","setupStyles","setGridSize","getClusters","setMaxZoom","addMarkers","setStyles","setTitle","repaint","onIdle","redraw","clusters","listeners","activeMap","ready","minimumClusterSize","zoomOnClick","ignoreHidden","imagePath","imageExtension","imageSizes","calculator","batchSize","batchSizeIE","clusterClass","navigator","userAgent","toLowerCase","indexOf","timerRefStatic","get","optNoDraw","key","Object","hasOwnProperty","call","_this","getDraggable","removeMarker_","splice","removed","oldClusters","slice","projection","trPix","getNorthEast","blPix","getSouthWest","point1","fromDivPixelToLatLng","point2","optHide","distanceBetweenPoints","p1","p2","dLat","PI","dLon","a","sin","cos","atan2","sqrt","isMarkerInBounds","distance","clusterToAddTo","d","iFirst","mapBounds","extendedMapBounds","iLast","getVisible","obj1","obj2","object","property","apply"],"mappings":"oEAMA,IAAAA,EAAA,WA2BE,SAAYA,EAAAC,EAAkBC,GAC5BD,EAAQE,eAAeC,OAAOJ,EAAaK,OAAOC,KAAKC,aAEvDC,KAAKP,QAAUA,EAEfO,KAAKC,iBAAmBD,KAAKP,QAAQE,eAAeO,kBAEpDF,KAAKG,UAAYH,KAAKC,iBAEtBD,KAAKN,OAASA,EAEdM,KAAKI,YAASC,EAEdL,KAAKM,IAAM,KAEXN,KAAKO,KAAO,KAEZP,KAAKQ,SAAU,EAEfR,KAAKS,sBAAwB,KAE7BT,KAAKU,IAAM,GAEXV,KAAKW,OAAS,EACdX,KAAKY,MAAQ,EAEbZ,KAAKa,WAAa,CAAC,EAAG,GACtBb,KAAKc,WAAa,CAAC,EAAG,GAEtBd,KAA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
{"version":3,"file":"cjs.min.js","sources":["../src/ClusterIcon.tsx","../src/Cluster.tsx","../src/Clusterer.tsx"],"sourcesContent":["/* global google */\n/* eslint-disable filenames/match-regex */\nimport type { Cluster } from './Cluster'\n\nimport type { ClusterIconStyle, ClusterIconInfo } from './types'\n\nexport class ClusterIcon {\n cluster: Cluster\n className: string\n clusterClassName: string\n styles: ClusterIconStyle[]\n center: google.maps.LatLng | undefined\n div: HTMLDivElement | null\n sums: ClusterIconInfo | null\n visible: boolean\n url: string\n height: number\n width: number\n anchorText: [number, number]\n anchorIcon: [number, number]\n textColor: string\n textSize: number\n textDecoration: string\n fontWeight: string\n fontStyle: string\n fontFamily: string\n backgroundPosition: string\n cMouseDownInCluster: boolean | null\n cDraggingMapByCluster: boolean | null\n timeOut: number | null\n\n boundsChangedListener: google.maps.MapsEventListener | null\n\n constructor(cluster: Cluster, styles: ClusterIconStyle[]) {\n cluster.getClusterer().extend(ClusterIcon, google.maps.OverlayView)\n\n this.cluster = cluster\n\n this.clusterClassName = this.cluster.getClusterer().getClusterClass()\n\n this.className = this.clusterClassName\n\n this.styles = styles\n\n this.center = undefined\n\n this.div = null\n\n this.sums = null\n\n this.visible = false\n\n this.boundsChangedListener = null\n\n this.url = ''\n\n this.height = 0\n this.width = 0\n\n this.anchorText = [0, 0]\n this.anchorIcon = [0, 0]\n\n this.textColor = 'black'\n this.textSize = 11\n this.textDecoration = 'none'\n this.fontWeight = 'bold'\n this.fontStyle = 'normal'\n this.fontFamily = 'Arial,sans-serif'\n\n this.backgroundPosition = '0 0'\n\n this.cMouseDownInCluster = null\n this.cDraggingMapByCluster = null\n this.timeOut = null;\n\n (this as unknown as google.maps.OverlayView).setMap(cluster.getMap()) // Note: this causes onAdd to be called\n\n this.onBoundsChanged = this.onBoundsChanged.bind(this)\n this.onMouseDown = this.onMouseDown.bind(this)\n this.onClick = this.onClick.bind(this)\n this.onMouseOver = this.onMouseOver.bind(this)\n this.onMouseOut = this.onMouseOut.bind(this)\n this.onAdd = this.onAdd.bind(this)\n this.onRemove = this.onRemove.bind(this)\n this.draw = this.draw.bind(this)\n this.hide = this.hide.bind(this)\n this.show = this.show.bind(this)\n this.useStyle = this.useStyle.bind(this)\n this.setCenter = this.setCenter.bind(this)\n this.getPosFromLatLng = this.getPosFromLatLng.bind(this)\n }\n\n onBoundsChanged() {\n this.cDraggingMapByCluster = this.cMouseDownInCluster\n }\n\n onMouseDown() {\n this.cMouseDownInCluster = true\n\n this.cDraggingMapByCluster = false\n }\n\n onClick(event: Event) {\n this.cMouseDownInCluster = false\n\n if (!this.cDraggingMapByCluster) {\n const markerClusterer = this.cluster.getClusterer()\n\n /**\n * This event is fired when a cluster marker is clicked.\n * @name MarkerClusterer#click\n * @param {Cluster} c The cluster that was clicked.\n * @event\n */\n google.maps.event.trigger(markerClusterer, 'click', this.cluster)\n google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster) // deprecated name\n\n // The default click handler follows. Disable it by setting\n // the zoomOnClick property to false.\n if (markerClusterer.getZoomOnClick()) {\n // Zoom into the cluster.\n const maxZoom = markerClusterer.getMaxZoom()\n\n const bounds = this.cluster.getBounds()\n\n const map = (markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null && 'fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n\n // There is a fix for Issue 170 here:\n this.timeOut = window.setTimeout(() => {\n const map = (markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null) {\n if ('fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n const zoom = map.getZoom() || 0\n\n // Don't zoom beyond the max zoom level\n if (\n maxZoom !== null &&\n zoom > maxZoom\n ) {\n map.setZoom(maxZoom + 1)\n }\n }\n }, 100)\n }\n\n // Prevent event propagation to the map:\n event.cancelBubble = true\n\n if (event.stopPropagation) {\n event.stopPropagation()\n }\n }\n }\n\n onMouseOver() {\n /**\n * This event is fired when the mouse moves over a cluster marker.\n * @name MarkerClusterer#mouseover\n * @param {Cluster} c The cluster that the mouse moved over.\n * @event\n */\n google.maps.event.trigger(\n this.cluster.getClusterer(),\n 'mouseover',\n this.cluster\n )\n }\n\n onMouseOut() {\n /**\n * This event is fired when the mouse moves out of a cluster marker.\n * @name MarkerClusterer#mouseout\n * @param {Cluster} c The cluster that the mouse moved out of.\n * @event\n */\n google.maps.event.trigger(\n this.cluster.getClusterer(),\n 'mouseout',\n this.cluster\n )\n }\n\n onAdd() {\n this.div = document.createElement('div')\n\n this.div.className = this.className\n\n if (this.visible) {\n this.show()\n }\n\n ;(this as unknown as google.maps.OverlayView).getPanes()?.overlayMouseTarget.appendChild(this.div)\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null) {\n // Fix for Issue 157\n this.boundsChangedListener = google.maps.event.addListener(\n map,\n 'bounds_changed',\n this.onBoundsChanged\n )\n\n this.div.addEventListener('mousedown', this.onMouseDown)\n\n this.div.addEventListener('click', this.onClick)\n\n this.div.addEventListener('mouseover', this.onMouseOver)\n\n this.div.addEventListener('mouseout', this.onMouseOut)\n }\n }\n\n onRemove() {\n if (this.div && this.div.parentNode) {\n this.hide()\n\n if (this.boundsChangedListener !== null) {\n google.maps.event.removeListener(this.boundsChangedListener)\n }\n\n this.div.removeEventListener('mousedown', this.onMouseDown)\n\n this.div.removeEventListener('click', this.onClick)\n\n this.div.removeEventListener('mouseover', this.onMouseOver)\n\n this.div.removeEventListener('mouseout', this.onMouseOut)\n\n this.div.parentNode.removeChild(this.div)\n\n if (this.timeOut !== null) {\n window.clearTimeout(this.timeOut)\n\n this.timeOut = null\n }\n\n this.div = null\n }\n }\n\n draw() {\n if (this.visible && this.div !== null && this.center) {\n const pos = this.getPosFromLatLng(this.center)\n\n this.div.style.top = pos !== null ? `${pos.y}px` : '0'\n this.div.style.left = pos !== null ? `${pos.x}px` : '0'\n }\n }\n\n hide() {\n if (this.div) {\n this.div.style.display = 'none'\n }\n\n this.visible = false\n }\n\n show() {\n if (this.div && this.center) {\n const divTitle = this.sums === null ||\n typeof this.sums.title === 'undefined' ||\n this.sums.title === '' ? this.cluster.getClusterer().getTitle() : this.sums.title\n\n // NOTE: values must be specified in px units\n const bp = this.backgroundPosition.split(' ')\n\n const spriteH = parseInt(bp[0]?.replace(/^\\s+|\\s+$/g, '') || '0', 10)\n const spriteV = parseInt(bp[1]?.replace(/^\\s+|\\s+$/g, '') || '0', 10)\n\n const pos = this.getPosFromLatLng(this.center)\n\n this.div.className = this.className\n this.div .setAttribute('style', `cursor: pointer; position: absolute; top: ${pos !== null ? `${pos.y}px` : '0'}; left: ${pos !== null ? `${pos.x}px` : '0'}; width: ${this.width}px; height: ${this.height}px; `)\n\n const img = document.createElement('img')\n\n img.alt = divTitle\n img.src = this.url\n img.width = this.width\n img.height = this.height\n img.setAttribute('style', `position: absolute; top: ${spriteV}px; left: ${spriteH}px`)\n\n if (!this.cluster.getClusterer().enableRetinaIcons) {\n img.style.clip = `rect(-${spriteV}px, -${spriteH + this.width}px, -${\n spriteV + this.height\n }, -${spriteH})`\n }\n\n const textElm = document.createElement('div')\n\n textElm .setAttribute('style', `position: absolute; top: ${this.anchorText[0]}px; left: ${this.anchorText[1]}px; color: ${this.textColor}; font-size: ${this.textSize}px; font-family: ${this.fontFamily}; font-weight: ${this.fontWeight}; fontStyle: ${this.fontStyle}; text-decoration: ${this.textDecoration}; text-align: center; width: ${this.width}px; line-height: ${this.height}px`)\n\n if (this.sums?.text) textElm.innerText = `${this.sums?.text}`\n if (this.sums?.html) textElm.innerHTML = `${this.sums?.html}`\n\n this.div.innerHTML = ''\n\n this.div.appendChild(img)\n this.div.appendChild(textElm)\n\n this.div.title = divTitle\n\n this.div.style.display = ''\n }\n\n this.visible = true\n }\n\n useStyle(sums: ClusterIconInfo) {\n this.sums = sums\n\n const styles = this.cluster.getClusterer().getStyles()\n\n const style =\n styles[Math.min(styles.length - 1, Math.max(0, sums.index - 1))]\n\n if (style) {\n this.url = style.url\n this.height = style.height\n this.width = style.width\n\n if (style.className) {\n this.className = `${this.clusterClassName} ${style.className}`\n }\n\n this.anchorText = style.anchorText || [0, 0]\n this.anchorIcon = style.anchorIcon || [this.height / 2, this.width / 2]\n\n this.textColor = style.textColor || 'black'\n\n this.textSize = style.textSize || 11\n\n this.textDecoration = style.textDecoration || 'none'\n\n this.fontWeight = style.fontWeight || 'bold'\n\n this.fontStyle = style.fontStyle || 'normal'\n\n this.fontFamily = style.fontFamily || 'Arial,sans-serif'\n\n this.backgroundPosition = style.backgroundPosition || '0 0'\n }\n }\n\n setCenter(center: google.maps.LatLng) {\n this.center = center\n }\n\n getPosFromLatLng(latlng: google.maps.LatLng): google.maps.Point | null {\n const pos = (this as unknown as google.maps.OverlayView).getProjection().fromLatLngToDivPixel(latlng)\n\n if (pos !== null) {\n pos.x -= this.anchorIcon[1]\n\n pos.y -= this.anchorIcon[0]\n }\n\n return pos\n }\n}\n","/* global google */\n\nimport type { Clusterer } from './Clusterer'\n\nimport { ClusterIcon } from './ClusterIcon'\n\nimport type { MarkerExtended } from './types'\n\nexport class Cluster {\n markerClusterer: Clusterer\n map: google.maps.Map | google.maps.StreetViewPanorama | null\n gridSize: number\n minClusterSize: number\n averageCenter: boolean\n markers: MarkerExtended[]\n center: google.maps.LatLng | undefined\n bounds: google.maps.LatLngBounds | null\n clusterIcon: ClusterIcon\n\n constructor(markerClusterer: Clusterer) {\n this.markerClusterer = markerClusterer\n\n this.map = (this.markerClusterer as unknown as google.maps.OverlayView).getMap()\n\n this.gridSize = this.markerClusterer.getGridSize()\n\n this.minClusterSize = this.markerClusterer.getMinimumClusterSize()\n\n this.averageCenter = this.markerClusterer.getAverageCenter()\n\n this.markers = []\n\n this.center = undefined\n\n this.bounds = null\n\n this.clusterIcon = new ClusterIcon(this, this.markerClusterer.getStyles())\n\n this.getSize = this.getSize.bind(this)\n this.getMarkers = this.getMarkers.bind(this)\n this.getCenter = this.getCenter.bind(this)\n this.getMap = this.getMap.bind(this)\n this.getClusterer = this.getClusterer.bind(this)\n this.getBounds = this.getBounds.bind(this)\n this.remove = this.remove.bind(this)\n this.addMarker = this.addMarker.bind(this)\n this.isMarkerInClusterBounds = this.isMarkerInClusterBounds.bind(this)\n this.calculateBounds = this.calculateBounds.bind(this)\n this.updateIcon = this.updateIcon.bind(this)\n this.isMarkerAlreadyAdded = this.isMarkerAlreadyAdded.bind(this)\n }\n\n getSize(): number {\n return this.markers.length\n }\n\n getMarkers(): MarkerExtended[] {\n return this.markers\n }\n\n getCenter(): google.maps.LatLng | undefined {\n return this.center\n }\n\n getMap(): google.maps.Map | google.maps.StreetViewPanorama | null {\n return this.map\n }\n\n getClusterer(): Clusterer {\n return this.markerClusterer\n }\n\n getBounds(): google.maps.LatLngBounds {\n const bounds = new google.maps.LatLngBounds(this.center, this.center)\n\n const markers = this.getMarkers()\n\n for (const marker of markers) {\n const position = marker.getPosition()\n\n if (position) {\n bounds.extend(position)\n }\n }\n\n return bounds\n }\n\n remove() {\n (this.clusterIcon as unknown as google.maps.OverlayView).setMap(null)\n\n this.markers = []\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete this.markers\n }\n\n addMarker(marker: MarkerExtended): boolean {\n if (this.isMarkerAlreadyAdded(marker)) {\n return false\n }\n\n if (!this.center) {\n const position = marker.getPosition()\n\n if (position) {\n this.center = position\n\n this.calculateBounds()\n }\n } else {\n if (this.averageCenter) {\n const position = marker.getPosition()\n\n if (position) {\n const length = this.markers.length + 1\n\n this.center = new google.maps.LatLng(\n (this.center.lat() * (length - 1) + position.lat()) / length,\n (this.center.lng() * (length - 1) + position.lng()) / length\n )\n\n this.calculateBounds()\n }\n }\n }\n\n marker.isAdded = true\n\n this.markers.push(marker)\n\n const mCount = this.markers.length\n\n const maxZoom = this.markerClusterer.getMaxZoom()\n\n const zoom = this.map?.getZoom()\n\n if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {\n // Zoomed in past max zoom, so show the marker.\n if (marker.getMap() !== this.map) {\n marker.setMap(this.map)\n }\n } else if (mCount < this.minClusterSize) {\n // Min cluster size not reached so show the marker.\n if (marker.getMap() !== this.map) {\n marker.setMap(this.map)\n }\n } else if (mCount === this.minClusterSize) {\n // Hide the markers that were showing.\n for (const markerElement of this.markers) {\n markerElement.setMap(null)\n }\n } else {\n marker.setMap(null)\n }\n\n return true\n }\n\n isMarkerInClusterBounds(marker: MarkerExtended): boolean {\n if (this.bounds !== null) {\n const position = marker.getPosition()\n\n if (position) {\n return this.bounds.contains(position)\n }\n }\n\n return false\n }\n\n calculateBounds() {\n this.bounds = this.markerClusterer.getExtendedBounds(\n new google.maps.LatLngBounds(this.center, this.center)\n )\n }\n\n updateIcon() {\n const mCount = this.markers.length\n\n const maxZoom = this.markerClusterer.getMaxZoom()\n\n const zoom = this.map?.getZoom()\n\n if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {\n this.clusterIcon.hide()\n\n return\n }\n\n if (mCount < this.minClusterSize) {\n // Min cluster size not yet reached.\n this.clusterIcon.hide()\n\n return\n }\n\n if (this.center) {\n this.clusterIcon.setCenter(this.center)\n }\n\n this.clusterIcon.useStyle(\n this.markerClusterer.getCalculator()(this.markers, this.markerClusterer.getStyles().length)\n )\n\n this.clusterIcon.show()\n }\n\n isMarkerAlreadyAdded(marker: MarkerExtended): boolean {\n if (this.markers.includes) {\n return this.markers.includes(marker)\n }\n\n for (let i = 0; i < this.markers.length; i++) {\n if (marker === this.markers[i]) {\n return true\n }\n }\n\n return false\n }\n}\n","/* global google */\n/* eslint-disable filenames/match-regex */\nimport { Cluster } from './Cluster'\nimport type { ClusterIcon } from './ClusterIcon'\n\nimport type {\n MarkerExtended,\n ClustererOptions,\n ClusterIconStyle,\n TCalculator,\n ClusterIconInfo,\n} from './types'\n\n/**\n * Supports up to 9007199254740991 (Number.MAX_SAFE_INTEGER) markers\n * which is not a problem as max array length is 4294967296 (2**32)\n */\nfunction CALCULATOR(\n markers: MarkerExtended[],\n numStyles: number\n): ClusterIconInfo {\n const count = markers.length\n\n const numberOfDigits = count.toString().length\n\n const index = Math.min(numberOfDigits, numStyles)\n\n return {\n text: count.toString(),\n index,\n title: '',\n }\n}\n\nconst BATCH_SIZE = 2000\n\nconst BATCH_SIZE_IE = 500\n\nconst IMAGE_PATH =\n 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'\n\nconst IMAGE_EXTENSION = 'png'\n\nconst IMAGE_SIZES = [53, 56, 66, 78, 90]\n\nconst CLUSTERER_CLASS = 'cluster'\n\nexport class Clusterer implements google.maps.OverlayView {\n markers: MarkerExtended[]\n clusters: Cluster[]\n listeners: google.maps.MapsEventListener[]\n activeMap: google.maps.Map | google.maps.StreetViewPanorama | null\n ready: boolean\n gridSize: number\n minClusterSize: number\n maxZoom: number | null\n styles: ClusterIconStyle[]\n title: string\n zoomOnClick: boolean\n averageCenter: boolean\n ignoreHidden: boolean\n enableRetinaIcons: boolean\n imagePath: string\n imageExtension: string\n imageSizes: number[]\n calculator: TCalculator\n batchSize: number\n batchSizeIE: number\n clusterClass: string\n timerRefStatic: number | null\n\n constructor(\n map: google.maps.Map,\n optMarkers: MarkerExtended[] = [],\n optOptions: ClustererOptions = {}\n ) {\n this.getMinimumClusterSize = this.getMinimumClusterSize.bind(this)\n this.setMinimumClusterSize = this.setMinimumClusterSize.bind(this)\n this.getEnableRetinaIcons = this.getEnableRetinaIcons.bind(this)\n this.setEnableRetinaIcons = this.setEnableRetinaIcons.bind(this)\n this.addToClosestCluster = this.addToClosestCluster.bind(this)\n this.getImageExtension = this.getImageExtension.bind(this)\n this.setImageExtension = this.setImageExtension.bind(this)\n this.getExtendedBounds = this.getExtendedBounds.bind(this)\n this.getAverageCenter = this.getAverageCenter.bind(this)\n this.setAverageCenter = this.setAverageCenter.bind(this)\n this.getTotalClusters = this.getTotalClusters.bind(this)\n this.fitMapToMarkers = this.fitMapToMarkers.bind(this)\n this.getIgnoreHidden = this.getIgnoreHidden.bind(this)\n this.setIgnoreHidden = this.setIgnoreHidden.bind(this)\n this.getClusterClass = this.getClusterClass.bind(this)\n this.setClusterClass = this.setClusterClass.bind(this)\n this.getTotalMarkers = this.getTotalMarkers.bind(this)\n this.getZoomOnClick = this.getZoomOnClick.bind(this)\n this.setZoomOnClick = this.setZoomOnClick.bind(this)\n this.getBatchSizeIE = this.getBatchSizeIE.bind(this)\n this.setBatchSizeIE = this.setBatchSizeIE.bind(this)\n this.createClusters = this.createClusters.bind(this)\n this.onZoomChanged = this.onZoomChanged.bind(this)\n this.getImageSizes = this.getImageSizes.bind(this)\n this.setImageSizes = this.setImageSizes.bind(this)\n this.getCalculator = this.getCalculator.bind(this)\n this.setCalculator = this.setCalculator.bind(this)\n this.removeMarkers = this.removeMarkers.bind(this)\n this.resetViewport = this.resetViewport.bind(this)\n this.getImagePath = this.getImagePath.bind(this)\n this.setImagePath = this.setImagePath.bind(this)\n this.pushMarkerTo = this.pushMarkerTo.bind(this)\n this.removeMarker = this.removeMarker.bind(this)\n this.clearMarkers = this.clearMarkers.bind(this)\n this.setupStyles = this.setupStyles.bind(this)\n this.getGridSize = this.getGridSize.bind(this)\n this.setGridSize = this.setGridSize.bind(this)\n this.getClusters = this.getClusters.bind(this)\n this.getMaxZoom = this.getMaxZoom.bind(this)\n this.setMaxZoom = this.setMaxZoom.bind(this)\n this.getMarkers = this.getMarkers.bind(this)\n this.addMarkers = this.addMarkers.bind(this)\n this.getStyles = this.getStyles.bind(this)\n this.setStyles = this.setStyles.bind(this)\n this.addMarker = this.addMarker.bind(this)\n this.onRemove = this.onRemove.bind(this)\n this.getTitle = this.getTitle.bind(this)\n this.setTitle = this.setTitle.bind(this)\n this.repaint = this.repaint.bind(this)\n this.onIdle = this.onIdle.bind(this)\n this.redraw = this.redraw.bind(this)\n this.onAdd = this.onAdd.bind(this)\n this.draw = this.draw.bind(this)\n\n this.extend = this.extend.bind(this)\n this.extend(Clusterer, google.maps.OverlayView)\n\n this.markers = []\n this.clusters = []\n this.listeners = []\n this.activeMap = null\n this.ready = false\n this.gridSize = optOptions.gridSize || 60\n this.minClusterSize = optOptions.minimumClusterSize || 2\n this.maxZoom = optOptions.maxZoom || null\n this.styles = optOptions.styles || []\n\n this.title = optOptions.title || ''\n\n this.zoomOnClick = true\n\n if (optOptions.zoomOnClick !== undefined) {\n this.zoomOnClick = optOptions.zoomOnClick\n }\n\n this.averageCenter = false\n\n if (optOptions.averageCenter !== undefined) {\n this.averageCenter = optOptions.averageCenter\n }\n\n this.ignoreHidden = false\n\n if (optOptions.ignoreHidden !== undefined) {\n this.ignoreHidden = optOptions.ignoreHidden\n }\n\n this.enableRetinaIcons = false\n\n if (optOptions.enableRetinaIcons !== undefined) {\n this.enableRetinaIcons = optOptions.enableRetinaIcons\n }\n this.imagePath = optOptions.imagePath || IMAGE_PATH\n\n this.imageExtension = optOptions.imageExtension || IMAGE_EXTENSION\n\n this.imageSizes = optOptions.imageSizes || IMAGE_SIZES\n\n this.calculator = optOptions.calculator || CALCULATOR\n\n this.batchSize = optOptions.batchSize || BATCH_SIZE\n\n this.batchSizeIE = optOptions.batchSizeIE || BATCH_SIZE_IE\n\n this.clusterClass = optOptions.clusterClass || CLUSTERER_CLASS\n\n if (navigator.userAgent.toLowerCase().indexOf('msie') !== -1) {\n // Try to avoid IE timeout when processing a huge number of markers:\n this.batchSize = this.batchSizeIE\n }\n\n this.timerRefStatic = null\n\n this.setupStyles()\n\n this.addMarkers(optMarkers, true);\n\n (this as unknown as google.maps.OverlayView).setMap(map) // Note: this causes onAdd to be called\n }\n\n onZoomChanged(): void {\n this.resetViewport(false)\n\n // Workaround for this Google bug: when map is at level 0 and \"-\" of\n // zoom slider is clicked, a \"zoom_changed\" event is fired even though\n // the map doesn't zoom out any further. In this situation, no \"idle\"\n // event is triggered so the cluster markers that have been removed\n // do not get redrawn. Same goes for a zoom in at maxZoom.\n if (\n (this as unknown as google.maps.OverlayView).getMap()?.getZoom() === ((this as unknown as google.maps.OverlayView).get('minZoom') || 0) ||\n (this as unknown as google.maps.OverlayView).getMap()?.getZoom() === (this as unknown as google.maps.OverlayView).get('maxZoom')\n ) {\n google.maps.event.trigger(this, 'idle')\n }\n }\n\n onIdle(): void {\n this.redraw()\n }\n\n onAdd(): void {\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n this.activeMap = map\n\n this.ready = true\n\n this.repaint()\n\n if (map !== null) {\n // Add the map event listeners\n this.listeners = [\n google.maps.event.addListener(\n map,\n 'zoom_changed',\n this.onZoomChanged\n ),\n google.maps.event.addListener(\n map,\n 'idle',\n this.onIdle\n ),\n ]\n }\n }\n\n onRemove(): void {\n // Put all the managed markers back on the map:\n for (const marker of this.markers) {\n if (marker.getMap() !== this.activeMap) {\n marker.setMap(this.activeMap)\n }\n }\n\n // Remove all clusters:\n for (const cluster of this.clusters) {\n cluster.remove()\n }\n\n this.clusters = []\n\n // Remove map event listeners:\n for (const listener of this.listeners) {\n google.maps.event.removeListener(listener)\n }\n\n this.listeners = []\n\n this.activeMap = null\n\n this.ready = false\n }\n\n draw(): void { return }\n\n getMap(): null { return null }\n\n getPanes(): null { return null }\n\n getProjection() {\n return {\n fromContainerPixelToLatLng(): null { return null },\n fromDivPixelToLatLng(): null { return null},\n fromLatLngToContainerPixel(): null { return null},\n fromLatLngToDivPixel(): null { return null},\n getVisibleRegion(): null { return null },\n getWorldWidth(): number { return 0 }\n }\n }\n\n setMap(): void { return }\n\n addListener() {\n return {\n remove() { return }\n }\n }\n\n bindTo(): void { return }\n\n get(): void { return }\n\n notify(): void { return }\n\n set(): void { return }\n setValues(): void { return }\n unbind(): void { return }\n unbindAll(): void { return }\n\n setupStyles(): void {\n if (this.styles.length > 0) {\n return\n }\n\n for (let i = 0; i < this.imageSizes.length; i++) {\n this.styles.push({\n url: `${this.imagePath + (i + 1)}.${this.imageExtension}`,\n height: this.imageSizes[i] || 0,\n width: this.imageSizes[i] || 0,\n })\n }\n }\n\n fitMapToMarkers(): void {\n const markers = this.getMarkers()\n\n const bounds = new google.maps.LatLngBounds()\n\n for (const marker of markers) {\n const position = marker.getPosition()\n\n if (position) {\n bounds.extend(position)\n }\n }\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n if (map !== null && 'fitBounds' in map) {\n map.fitBounds(bounds)\n }\n\n }\n\n getGridSize(): number {\n return this.gridSize\n }\n\n setGridSize(gridSize: number) {\n this.gridSize = gridSize\n }\n\n getMinimumClusterSize(): number {\n return this.minClusterSize\n }\n\n setMinimumClusterSize(minimumClusterSize: number) {\n this.minClusterSize = minimumClusterSize\n }\n\n getMaxZoom(): number | null {\n return this.maxZoom\n }\n\n setMaxZoom(maxZoom: number) {\n this.maxZoom = maxZoom\n }\n\n getStyles(): ClusterIconStyle[] {\n return this.styles\n }\n\n setStyles(styles: ClusterIconStyle[]) {\n this.styles = styles\n }\n\n getTitle(): string {\n return this.title\n }\n\n setTitle(title: string) {\n this.title = title\n }\n\n getZoomOnClick(): boolean {\n return this.zoomOnClick\n }\n\n setZoomOnClick(zoomOnClick: boolean) {\n this.zoomOnClick = zoomOnClick\n }\n\n getAverageCenter(): boolean {\n return this.averageCenter\n }\n\n setAverageCenter(averageCenter: boolean) {\n this.averageCenter = averageCenter\n }\n\n getIgnoreHidden(): boolean {\n return this.ignoreHidden\n }\n\n setIgnoreHidden(ignoreHidden: boolean) {\n this.ignoreHidden = ignoreHidden\n }\n\n getEnableRetinaIcons(): boolean {\n return this.enableRetinaIcons\n }\n\n setEnableRetinaIcons(enableRetinaIcons: boolean) {\n this.enableRetinaIcons = enableRetinaIcons\n }\n\n getImageExtension(): string {\n return this.imageExtension\n }\n\n setImageExtension(imageExtension: string) {\n this.imageExtension = imageExtension\n }\n\n getImagePath(): string {\n return this.imagePath\n }\n\n setImagePath(imagePath: string) {\n this.imagePath = imagePath\n }\n\n getImageSizes(): number[] {\n return this.imageSizes\n }\n\n setImageSizes(imageSizes: number[]) {\n this.imageSizes = imageSizes\n }\n\n getCalculator(): TCalculator {\n return this.calculator\n }\n\n setCalculator(calculator: TCalculator) {\n this.calculator = calculator\n }\n\n getBatchSizeIE(): number {\n return this.batchSizeIE\n }\n\n setBatchSizeIE(batchSizeIE: number) {\n this.batchSizeIE = batchSizeIE\n }\n\n getClusterClass(): string {\n return this.clusterClass\n }\n\n setClusterClass(clusterClass: string) {\n this.clusterClass = clusterClass\n }\n\n getMarkers(): MarkerExtended[] {\n return this.markers\n }\n\n getTotalMarkers(): number {\n return this.markers.length\n }\n\n getClusters(): Cluster[] {\n return this.clusters\n }\n\n getTotalClusters(): number {\n return this.clusters.length\n }\n\n addMarker(marker: MarkerExtended, optNoDraw: boolean) {\n this.pushMarkerTo(marker)\n\n if (!optNoDraw) {\n this.redraw()\n }\n }\n\n addMarkers(markers: MarkerExtended[], optNoDraw: boolean) {\n for (const key in markers) {\n if (Object.prototype.hasOwnProperty.call(markers, key)) {\n const marker = markers[key]\n\n if (marker) {\n this.pushMarkerTo(marker)\n }\n }\n }\n\n if (!optNoDraw) {\n this.redraw()\n }\n }\n\n pushMarkerTo(marker: MarkerExtended) {\n // If the marker is draggable add a listener so we can update the clusters on the dragend:\n if (marker.getDraggable()) {\n google.maps.event.addListener(marker, 'dragend', () => {\n if (this.ready) {\n marker.isAdded = false\n\n this.repaint()\n }\n })\n }\n\n marker.isAdded = false\n\n this.markers.push(marker)\n }\n\n removeMarker_(marker: MarkerExtended): boolean {\n let index = -1\n\n if (this.markers.indexOf) {\n index = this.markers.indexOf(marker)\n } else {\n for (let i = 0; i < this.markers.length; i++) {\n if (marker === this.markers[i]) {\n index = i\n\n break\n }\n }\n }\n\n if (index === -1) {\n // Marker is not in our list of markers, so do nothing:\n return false\n }\n\n marker.setMap(null)\n\n this.markers.splice(index, 1) // Remove the marker from the list of managed markers\n\n return true\n }\n\n removeMarker(marker: MarkerExtended, optNoDraw: boolean): boolean {\n const removed = this.removeMarker_(marker)\n\n if (!optNoDraw && removed) {\n this.repaint()\n }\n\n return removed\n }\n\n removeMarkers(markers: MarkerExtended[], optNoDraw: boolean): boolean {\n let removed = false\n\n for (const marker of markers) {\n removed = removed || this.removeMarker_(marker)\n }\n\n if (!optNoDraw && removed) {\n this.repaint()\n }\n\n return removed\n }\n\n clearMarkers() {\n this.resetViewport(true)\n\n this.markers = []\n }\n\n repaint() {\n const oldClusters = this.clusters.slice()\n\n this.clusters = []\n\n this.resetViewport(false)\n\n this.redraw()\n\n // Remove the old clusters.\n // Do it in a timeout to prevent blinking effect.\n setTimeout(function timeout() {\n for (const oldCluster of oldClusters) {\n oldCluster.remove()\n }\n }, 0)\n }\n\n getExtendedBounds(bounds: google.maps.LatLngBounds): google.maps.LatLngBounds {\n const projection = (this as unknown as google.maps.OverlayView).getProjection()\n\n // Convert the points to pixels and the extend out by the grid size.\n const trPix = projection.fromLatLngToDivPixel(\n // Turn the bounds into latlng.\n new google.maps.LatLng(bounds.getNorthEast().lat(), bounds.getNorthEast().lng())\n )\n\n if (trPix !== null) {\n trPix.x += this.gridSize\n trPix.y -= this.gridSize\n }\n\n const blPix = projection.fromLatLngToDivPixel(\n // Turn the bounds into latlng.\n new google.maps.LatLng(bounds.getSouthWest().lat(), bounds.getSouthWest().lng())\n )\n\n if (blPix !== null) {\n blPix.x -= this.gridSize\n blPix.y += this.gridSize\n }\n\n\n // Extend the bounds to contain the new bounds.\n if (trPix !== null) {\n // Convert the pixel points back to LatLng nw\n const point1 = projection.fromDivPixelToLatLng(trPix)\n\n if (point1 !== null) {\n bounds.extend(point1)\n }\n }\n\n if (blPix !== null) {\n // Convert the pixel points back to LatLng sw\n const point2 = projection.fromDivPixelToLatLng(blPix)\n\n if (point2 !== null) {\n bounds.extend(\n point2\n )\n }\n }\n\n\n return bounds\n }\n\n redraw() {\n // Redraws all the clusters.\n this.createClusters(0)\n }\n\n resetViewport(optHide: boolean) {\n // Remove all the clusters\n for (const cluster of this.clusters) {\n cluster.remove()\n }\n\n this.clusters = []\n\n // Reset the markers to not be added and to be removed from the map.\n for (const marker of this.markers) {\n marker.isAdded = false\n\n if (optHide) {\n marker.setMap(null)\n }\n }\n }\n\n distanceBetweenPoints(p1: google.maps.LatLng, p2: google.maps.LatLng): number {\n const R = 6371 // Radius of the Earth in km\n\n const dLat = ((p2.lat() - p1.lat()) * Math.PI) / 180\n const dLon = ((p2.lng() - p1.lng()) * Math.PI) / 180\n\n const a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos((p1.lat() * Math.PI) / 180) *\n Math.cos((p2.lat() * Math.PI) / 180) *\n Math.sin(dLon / 2) *\n Math.sin(dLon / 2)\n\n return R * (2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)))\n }\n\n isMarkerInBounds(marker: MarkerExtended, bounds: google.maps.LatLngBounds): boolean {\n const position = marker.getPosition()\n\n if (position) {\n return bounds.contains(position)\n }\n\n return false\n }\n\n addToClosestCluster(marker: MarkerExtended) {\n let cluster\n\n let distance = 40000 // Some large number\n\n let clusterToAddTo = null\n\n for (const clusterElement of this.clusters) {\n cluster = clusterElement\n\n const center = cluster.getCenter()\n\n const position = marker.getPosition()\n\n if (center && position) {\n const d = this.distanceBetweenPoints(center, position)\n\n if (d < distance) {\n distance = d\n\n clusterToAddTo = cluster\n }\n }\n }\n\n if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {\n clusterToAddTo.addMarker(marker)\n } else {\n cluster = new Cluster(this)\n\n cluster.addMarker(marker)\n\n this.clusters.push(cluster)\n }\n }\n\n createClusters(iFirst: number) {\n if (!this.ready) {\n return\n }\n\n // Cancel previous batch processing if we're working on the first batch:\n if (iFirst === 0) {\n /**\n * This event is fired when the <code>Clusterer</code> begins\n * clustering markers.\n * @name Clusterer#clusteringbegin\n * @param {Clusterer} mc The Clusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, 'clusteringbegin', this)\n\n if (this.timerRefStatic !== null) {\n window.clearTimeout(this.timerRefStatic)\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n delete this.timerRefStatic\n }\n }\n\n const map = (this as unknown as google.maps.OverlayView).getMap()\n\n const bounds = map !== null && 'getBounds' in map ? map.getBounds() : null\n\n const zoom = map?.getZoom() || 0\n // Get our current map view bounds.\n // Create a new bounds object so we don't affect the map.\n //\n // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:\n const mapBounds = zoom > 3\n ? new google.maps.LatLngBounds(\n bounds?.getSouthWest(),\n bounds?.getNorthEast()\n )\n : new google.maps.LatLngBounds(\n new google.maps.LatLng(85.02070771743472, -178.48388434375),\n new google.maps.LatLng(-85.08136444384544, 178.00048865625)\n )\n\n const extendedMapBounds = this.getExtendedBounds(mapBounds)\n\n const iLast = Math.min(iFirst + this.batchSize, this.markers.length)\n\n for (let i = iFirst; i < iLast; i++) {\n const marker = this.markers[i]\n\n if (marker && !marker.isAdded && this.isMarkerInBounds(marker, extendedMapBounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {\n this.addToClosestCluster(marker)\n }\n }\n\n if (iLast < this.markers.length) {\n this.timerRefStatic = window.setTimeout(\n () => {\n this.createClusters(iLast)\n },\n 0\n )\n } else {\n this.timerRefStatic = null\n\n /**\n * This event is fired when the <code>Clusterer</code> stops\n * clustering markers.\n * @name Clusterer#clusteringend\n * @param {Clusterer} mc The Clusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, 'clusteringend', this)\n\n for (const cluster of this.clusters) {\n cluster.updateIcon()\n }\n }\n }\n\n extend<A extends typeof Clusterer | typeof ClusterIcon>(obj1: A, obj2: typeof google.maps.OverlayView): A {\n return function applyExtend(this: A, object: typeof google.maps.OverlayView): A {\n for (const property in object.prototype) {\n\n // eslint-disable-next-line @typescript-eslint/ban-types\n const prop = property as keyof google.maps.OverlayView & (string & {})\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.prototype[prop] = object.prototype[prop]\n }\n\n return this\n }.apply<A, [typeof google.maps.OverlayView], A>(obj1, [obj2])\n }\n}\n"],"names":["ClusterIcon","cluster","styles","getClusterer","extend","google","maps","OverlayView","this","clusterClassName","getClusterClass","className","center","undefined","div","sums","visible","boundsChangedListener","url","height","width","anchorText","anchorIcon","textColor","textSize","textDecoration","fontWeight","fontStyle","fontFamily","backgroundPosition","cMouseDownInCluster","cDraggingMapByCluster","timeOut","setMap","getMap","onBoundsChanged","bind","onMouseDown","onClick","onMouseOver","onMouseOut","onAdd","onRemove","draw","hide","show","useStyle","setCenter","getPosFromLatLng","prototype","event","markerClusterer_1","trigger","getZoomOnClick","maxZoom_1","getMaxZoom","bounds_1","getBounds","map","fitBounds","window","setTimeout","zoom","getZoom","setZoom","cancelBubble","stopPropagation","document","createElement","_a","getPanes","overlayMouseTarget","appendChild","addListener","addEventListener","parentNode","removeListener","removeEventListener","removeChild","clearTimeout","pos","style","top","concat","y","left","x","display","divTitle","title","getTitle","bp","split","spriteH","parseInt","replace","spriteV","_b","setAttribute","img","alt","src","enableRetinaIcons","clip","textElm","_c","text","innerText","_d","_e","html","innerHTML","_f","getStyles","Math","min","length","max","index","latlng","getProjection","fromLatLngToDivPixel","Cluster","markerClusterer","gridSize","getGridSize","minClusterSize","getMinimumClusterSize","averageCenter","getAverageCenter","markers","bounds","clusterIcon","getSize","getMarkers","getCenter","remove","addMarker","isMarkerInClusterBounds","calculateBounds","updateIcon","isMarkerAlreadyAdded","LatLngBounds","markers_1","_i","position","getPosition","marker","length_1","LatLng","lat","lng","isAdded","push","mCount","maxZoom","contains","getExtendedBounds","getCalculator","includes","i","CALCULATOR","numStyles","count","numberOfDigits","toString","BATCH_SIZE","BATCH_SIZE_IE","IMAGE_PATH","IMAGE_EXTENSION","IMAGE_SIZES","CLUSTERER_CLASS","Clusterer","optMarkers","optOptions","setMinimumClusterSize","getEnableRetinaIcons","setEnableRetinaIcons","addToClosestCluster","getImageExtension","setImageExtension","setAverageCenter","getTotalClusters","fitMapToMarkers","getIgnoreHidden","setIgnoreHidden","setClusterClass","getTotalMarkers","setZoomOnClick","getBatchSizeIE","setBatchSizeIE","createClusters","onZoomChanged","getImageSizes","setImageSizes","setCalculator","removeMarkers","resetViewport","getImagePath","setImagePath","pushMarkerTo","removeMarker","clearMarkers","setupStyles","setGridSize","getClusters","setMaxZoom","addMarkers","setStyles","setTitle","repaint","onIdle","redraw","clusters","listeners","activeMap","ready","minimumClusterSize","zoomOnClick","ignoreHidden","imagePath","imageExtension","imageSizes","calculator","batchSize","batchSizeIE","clusterClass","navigator","userAgent","toLowerCase","indexOf","timerRefStatic","get","listener","fromContainerPixelToLatLng","fromDivPixelToLatLng","fromLatLngToContainerPixel","getVisibleRegion","getWorldWidth","bindTo","notify","set","setValues","unbind","unbindAll","optNoDraw","key","Object","hasOwnProperty","call","_this","getDraggable","removeMarker_","splice","removed","markers_2","oldClusters","slice","oldClusters_1","projection","trPix","getNorthEast","blPix","getSouthWest","point1","point2","optHide","distanceBetweenPoints","p1","p2","dLat","PI","dLon","a","sin","cos","atan2","sqrt","isMarkerInBounds","distance","clusterToAddTo","d","iFirst","mapBounds","extendedMapBounds","iLast","getVisible","obj1","obj2","object","property","prop","apply"],"mappings":"oEAMA,IAAAA,EAAA,WA2BE,SAAYA,EAAAC,EAAkBC,GAC5BD,EAAQE,eAAeC,OAAOJ,EAAaK,OAAOC,KAAKC,aAEvDC,KAAKP,QAAUA,EAEfO,KAAKC,iBAAmBD,KAAKP,QAAQE,eAAeO,kBAEpDF,KAAKG,UAAYH,KAAKC,iBAEtBD,KAAKN,OAASA,EAEdM,KAAKI,YAASC,EAEdL,KAAKM,IAAM,KAEXN,KAAKO,KAAO,KAEZP,KAAKQ,SAAU,EAEfR,KAAKS,sBAAwB,KAE7BT,KAAKU,IAAM,GAEXV,KAAKW,OAAS,EACdX,KAAKY,MAAQ,EAEbZ,KAAKa,WAAa,CAAC,EAAG,GACtBb,KAAKc,WAAa,CAAC,EAAG,GAEtBd,KAAKe,UAAY,QACjBf,KAAKgB,SAAW,GAChBhB,KAAKiB,eAAiB,OACtBjB,KAAKkB,WAAa,OAClBlB,KAAKmB,UAAY,SACjBnB,KAAKoB,WAAa,mBAElBpB,KAAKqB,mBAAqB,MA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pH,CAAD"}
|
package/dist/esm.js
CHANGED
|
@@ -160,15 +160,15 @@ var ClusterIcon = /** @class */ (function () {
|
|
|
160
160
|
this.visible = false;
|
|
161
161
|
};
|
|
162
162
|
ClusterIcon.prototype.show = function () {
|
|
163
|
-
var _a, _b, _c, _d;
|
|
163
|
+
var _a, _b, _c, _d, _e, _f;
|
|
164
164
|
if (this.div && this.center) {
|
|
165
165
|
var divTitle = this.sums === null ||
|
|
166
166
|
typeof this.sums.title === 'undefined' ||
|
|
167
167
|
this.sums.title === '' ? this.cluster.getClusterer().getTitle() : this.sums.title;
|
|
168
168
|
// NOTE: values must be specified in px units
|
|
169
169
|
var bp = this.backgroundPosition.split(' ');
|
|
170
|
-
var spriteH = parseInt(bp[0].replace(/^\s+|\s+$/g, ''), 10);
|
|
171
|
-
var spriteV = parseInt(bp[1].replace(/^\s+|\s+$/g, ''), 10);
|
|
170
|
+
var spriteH = parseInt(((_a = bp[0]) === null || _a === void 0 ? void 0 : _a.replace(/^\s+|\s+$/g, '')) || '0', 10);
|
|
171
|
+
var spriteV = parseInt(((_b = bp[1]) === null || _b === void 0 ? void 0 : _b.replace(/^\s+|\s+$/g, '')) || '0', 10);
|
|
172
172
|
var pos = this.getPosFromLatLng(this.center);
|
|
173
173
|
this.div.className = this.className;
|
|
174
174
|
this.div.setAttribute('style', "cursor: pointer; position: absolute; top: ".concat(pos !== null ? "".concat(pos.y, "px") : '0', "; left: ").concat(pos !== null ? "".concat(pos.x, "px") : '0', "; width: ").concat(this.width, "px; height: ").concat(this.height, "px; "));
|
|
@@ -183,10 +183,10 @@ var ClusterIcon = /** @class */ (function () {
|
|
|
183
183
|
}
|
|
184
184
|
var textElm = document.createElement('div');
|
|
185
185
|
textElm.setAttribute('style', "position: absolute; top: ".concat(this.anchorText[0], "px; left: ").concat(this.anchorText[1], "px; color: ").concat(this.textColor, "; font-size: ").concat(this.textSize, "px; font-family: ").concat(this.fontFamily, "; font-weight: ").concat(this.fontWeight, "; fontStyle: ").concat(this.fontStyle, "; text-decoration: ").concat(this.textDecoration, "; text-align: center; width: ").concat(this.width, "px; line-height: ").concat(this.height, "px"));
|
|
186
|
-
if ((
|
|
187
|
-
textElm.innerText = "".concat((
|
|
188
|
-
if ((
|
|
189
|
-
textElm.innerHTML = "".concat((
|
|
186
|
+
if ((_c = this.sums) === null || _c === void 0 ? void 0 : _c.text)
|
|
187
|
+
textElm.innerText = "".concat((_d = this.sums) === null || _d === void 0 ? void 0 : _d.text);
|
|
188
|
+
if ((_e = this.sums) === null || _e === void 0 ? void 0 : _e.html)
|
|
189
|
+
textElm.innerHTML = "".concat((_f = this.sums) === null || _f === void 0 ? void 0 : _f.html);
|
|
190
190
|
this.div.innerHTML = '';
|
|
191
191
|
this.div.appendChild(img);
|
|
192
192
|
this.div.appendChild(textElm);
|
|
@@ -199,20 +199,23 @@ var ClusterIcon = /** @class */ (function () {
|
|
|
199
199
|
this.sums = sums;
|
|
200
200
|
var styles = this.cluster.getClusterer().getStyles();
|
|
201
201
|
var style = styles[Math.min(styles.length - 1, Math.max(0, sums.index - 1))];
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
202
|
+
if (style) {
|
|
203
|
+
this.url = style.url;
|
|
204
|
+
this.height = style.height;
|
|
205
|
+
this.width = style.width;
|
|
206
|
+
if (style.className) {
|
|
207
|
+
this.className = "".concat(this.clusterClassName, " ").concat(style.className);
|
|
208
|
+
}
|
|
209
|
+
this.anchorText = style.anchorText || [0, 0];
|
|
210
|
+
this.anchorIcon = style.anchorIcon || [this.height / 2, this.width / 2];
|
|
211
|
+
this.textColor = style.textColor || 'black';
|
|
212
|
+
this.textSize = style.textSize || 11;
|
|
213
|
+
this.textDecoration = style.textDecoration || 'none';
|
|
214
|
+
this.fontWeight = style.fontWeight || 'bold';
|
|
215
|
+
this.fontStyle = style.fontStyle || 'normal';
|
|
216
|
+
this.fontFamily = style.fontFamily || 'Arial,sans-serif';
|
|
217
|
+
this.backgroundPosition = style.backgroundPosition || '0 0';
|
|
218
|
+
}
|
|
216
219
|
};
|
|
217
220
|
ClusterIcon.prototype.setCenter = function (center) {
|
|
218
221
|
this.center = center;
|
|
@@ -228,6 +231,7 @@ var ClusterIcon = /** @class */ (function () {
|
|
|
228
231
|
return ClusterIcon;
|
|
229
232
|
}());
|
|
230
233
|
|
|
234
|
+
/* global google */
|
|
231
235
|
var Cluster = /** @class */ (function () {
|
|
232
236
|
function Cluster(markerClusterer) {
|
|
233
237
|
this.markerClusterer = markerClusterer;
|
|
@@ -270,8 +274,9 @@ var Cluster = /** @class */ (function () {
|
|
|
270
274
|
Cluster.prototype.getBounds = function () {
|
|
271
275
|
var bounds = new google.maps.LatLngBounds(this.center, this.center);
|
|
272
276
|
var markers = this.getMarkers();
|
|
273
|
-
for (var
|
|
274
|
-
var
|
|
277
|
+
for (var _i = 0, markers_1 = markers; _i < markers_1.length; _i++) {
|
|
278
|
+
var marker = markers_1[_i];
|
|
279
|
+
var position = marker.getPosition();
|
|
275
280
|
if (position) {
|
|
276
281
|
bounds.extend(position);
|
|
277
282
|
}
|
|
@@ -326,8 +331,9 @@ var Cluster = /** @class */ (function () {
|
|
|
326
331
|
}
|
|
327
332
|
else if (mCount === this.minClusterSize) {
|
|
328
333
|
// Hide the markers that were showing.
|
|
329
|
-
for (var
|
|
330
|
-
|
|
334
|
+
for (var _i = 0, _b = this.markers; _i < _b.length; _i++) {
|
|
335
|
+
var markerElement = _b[_i];
|
|
336
|
+
markerElement.setMap(null);
|
|
331
337
|
}
|
|
332
338
|
}
|
|
333
339
|
else {
|
|
@@ -457,9 +463,9 @@ var Clusterer = /** @class */ (function () {
|
|
|
457
463
|
this.repaint = this.repaint.bind(this);
|
|
458
464
|
this.onIdle = this.onIdle.bind(this);
|
|
459
465
|
this.redraw = this.redraw.bind(this);
|
|
460
|
-
this.extend = this.extend.bind(this);
|
|
461
466
|
this.onAdd = this.onAdd.bind(this);
|
|
462
467
|
this.draw = this.draw.bind(this);
|
|
468
|
+
this.extend = this.extend.bind(this);
|
|
463
469
|
this.extend(Clusterer, google.maps.OverlayView);
|
|
464
470
|
this.markers = [];
|
|
465
471
|
this.clusters = [];
|
|
@@ -534,25 +540,53 @@ var Clusterer = /** @class */ (function () {
|
|
|
534
540
|
};
|
|
535
541
|
Clusterer.prototype.onRemove = function () {
|
|
536
542
|
// Put all the managed markers back on the map:
|
|
537
|
-
for (var
|
|
538
|
-
|
|
539
|
-
|
|
543
|
+
for (var _i = 0, _a = this.markers; _i < _a.length; _i++) {
|
|
544
|
+
var marker = _a[_i];
|
|
545
|
+
if (marker.getMap() !== this.activeMap) {
|
|
546
|
+
marker.setMap(this.activeMap);
|
|
540
547
|
}
|
|
541
548
|
}
|
|
542
549
|
// Remove all clusters:
|
|
543
|
-
for (var
|
|
544
|
-
|
|
550
|
+
for (var _b = 0, _c = this.clusters; _b < _c.length; _b++) {
|
|
551
|
+
var cluster = _c[_b];
|
|
552
|
+
cluster.remove();
|
|
545
553
|
}
|
|
546
554
|
this.clusters = [];
|
|
547
555
|
// Remove map event listeners:
|
|
548
|
-
for (var
|
|
549
|
-
|
|
556
|
+
for (var _d = 0, _e = this.listeners; _d < _e.length; _d++) {
|
|
557
|
+
var listener = _e[_d];
|
|
558
|
+
google.maps.event.removeListener(listener);
|
|
550
559
|
}
|
|
551
560
|
this.listeners = [];
|
|
552
561
|
this.activeMap = null;
|
|
553
562
|
this.ready = false;
|
|
554
563
|
};
|
|
555
564
|
Clusterer.prototype.draw = function () { return; };
|
|
565
|
+
Clusterer.prototype.getMap = function () { return null; };
|
|
566
|
+
Clusterer.prototype.getPanes = function () { return null; };
|
|
567
|
+
Clusterer.prototype.getProjection = function () {
|
|
568
|
+
return {
|
|
569
|
+
fromContainerPixelToLatLng: function () { return null; },
|
|
570
|
+
fromDivPixelToLatLng: function () { return null; },
|
|
571
|
+
fromLatLngToContainerPixel: function () { return null; },
|
|
572
|
+
fromLatLngToDivPixel: function () { return null; },
|
|
573
|
+
getVisibleRegion: function () { return null; },
|
|
574
|
+
getWorldWidth: function () { return 0; }
|
|
575
|
+
};
|
|
576
|
+
};
|
|
577
|
+
Clusterer.prototype.setMap = function () { return; };
|
|
578
|
+
Clusterer.prototype.addListener = function () {
|
|
579
|
+
return {
|
|
580
|
+
remove: function () { return; }
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
Clusterer.prototype.bindTo = function () { return; };
|
|
584
|
+
Clusterer.prototype.get = function () { return; };
|
|
585
|
+
Clusterer.prototype.notify = function () { return; };
|
|
586
|
+
Clusterer.prototype.set = function () { return; };
|
|
587
|
+
Clusterer.prototype.setValues = function () { return; };
|
|
588
|
+
Clusterer.prototype.unbind = function () { return; };
|
|
589
|
+
Clusterer.prototype.unbindAll = function () { return; };
|
|
556
590
|
Clusterer.prototype.setupStyles = function () {
|
|
557
591
|
if (this.styles.length > 0) {
|
|
558
592
|
return;
|
|
@@ -560,16 +594,17 @@ var Clusterer = /** @class */ (function () {
|
|
|
560
594
|
for (var i = 0; i < this.imageSizes.length; i++) {
|
|
561
595
|
this.styles.push({
|
|
562
596
|
url: "".concat(this.imagePath + (i + 1), ".").concat(this.imageExtension),
|
|
563
|
-
height: this.imageSizes[i],
|
|
564
|
-
width: this.imageSizes[i],
|
|
597
|
+
height: this.imageSizes[i] || 0,
|
|
598
|
+
width: this.imageSizes[i] || 0,
|
|
565
599
|
});
|
|
566
600
|
}
|
|
567
601
|
};
|
|
568
602
|
Clusterer.prototype.fitMapToMarkers = function () {
|
|
569
603
|
var markers = this.getMarkers();
|
|
570
604
|
var bounds = new google.maps.LatLngBounds();
|
|
571
|
-
for (var
|
|
572
|
-
var
|
|
605
|
+
for (var _i = 0, markers_1 = markers; _i < markers_1.length; _i++) {
|
|
606
|
+
var marker = markers_1[_i];
|
|
607
|
+
var position = marker.getPosition();
|
|
573
608
|
if (position) {
|
|
574
609
|
bounds.extend(position);
|
|
575
610
|
}
|
|
@@ -690,7 +725,10 @@ var Clusterer = /** @class */ (function () {
|
|
|
690
725
|
Clusterer.prototype.addMarkers = function (markers, optNoDraw) {
|
|
691
726
|
for (var key in markers) {
|
|
692
727
|
if (Object.prototype.hasOwnProperty.call(markers, key)) {
|
|
693
|
-
|
|
728
|
+
var marker = markers[key];
|
|
729
|
+
if (marker) {
|
|
730
|
+
this.pushMarkerTo(marker);
|
|
731
|
+
}
|
|
694
732
|
}
|
|
695
733
|
}
|
|
696
734
|
if (!optNoDraw) {
|
|
@@ -741,8 +779,9 @@ var Clusterer = /** @class */ (function () {
|
|
|
741
779
|
};
|
|
742
780
|
Clusterer.prototype.removeMarkers = function (markers, optNoDraw) {
|
|
743
781
|
var removed = false;
|
|
744
|
-
for (var
|
|
745
|
-
|
|
782
|
+
for (var _i = 0, markers_2 = markers; _i < markers_2.length; _i++) {
|
|
783
|
+
var marker = markers_2[_i];
|
|
784
|
+
removed = removed || this.removeMarker_(marker);
|
|
746
785
|
}
|
|
747
786
|
if (!optNoDraw && removed) {
|
|
748
787
|
this.repaint();
|
|
@@ -761,8 +800,9 @@ var Clusterer = /** @class */ (function () {
|
|
|
761
800
|
// Remove the old clusters.
|
|
762
801
|
// Do it in a timeout to prevent blinking effect.
|
|
763
802
|
setTimeout(function timeout() {
|
|
764
|
-
for (var
|
|
765
|
-
|
|
803
|
+
for (var _i = 0, oldClusters_1 = oldClusters; _i < oldClusters_1.length; _i++) {
|
|
804
|
+
var oldCluster = oldClusters_1[_i];
|
|
805
|
+
oldCluster.remove();
|
|
766
806
|
}
|
|
767
807
|
}, 0);
|
|
768
808
|
};
|
|
@@ -806,13 +846,14 @@ var Clusterer = /** @class */ (function () {
|
|
|
806
846
|
};
|
|
807
847
|
Clusterer.prototype.resetViewport = function (optHide) {
|
|
808
848
|
// Remove all the clusters
|
|
809
|
-
for (var
|
|
810
|
-
|
|
849
|
+
for (var _i = 0, _a = this.clusters; _i < _a.length; _i++) {
|
|
850
|
+
var cluster = _a[_i];
|
|
851
|
+
cluster.remove();
|
|
811
852
|
}
|
|
812
853
|
this.clusters = [];
|
|
813
854
|
// Reset the markers to not be added and to be removed from the map.
|
|
814
|
-
for (var
|
|
815
|
-
var marker =
|
|
855
|
+
for (var _b = 0, _c = this.markers; _b < _c.length; _b++) {
|
|
856
|
+
var marker = _c[_b];
|
|
816
857
|
marker.isAdded = false;
|
|
817
858
|
if (optHide) {
|
|
818
859
|
marker.setMap(null);
|
|
@@ -841,8 +882,9 @@ var Clusterer = /** @class */ (function () {
|
|
|
841
882
|
var cluster;
|
|
842
883
|
var distance = 40000; // Some large number
|
|
843
884
|
var clusterToAddTo = null;
|
|
844
|
-
for (var
|
|
845
|
-
|
|
885
|
+
for (var _i = 0, _a = this.clusters; _i < _a.length; _i++) {
|
|
886
|
+
var clusterElement = _a[_i];
|
|
887
|
+
cluster = clusterElement;
|
|
846
888
|
var center = cluster.getCenter();
|
|
847
889
|
var position = marker.getPosition();
|
|
848
890
|
if (center && position) {
|
|
@@ -898,7 +940,7 @@ var Clusterer = /** @class */ (function () {
|
|
|
898
940
|
var iLast = Math.min(iFirst + this.batchSize, this.markers.length);
|
|
899
941
|
for (var i = iFirst; i < iLast; i++) {
|
|
900
942
|
var marker = this.markers[i];
|
|
901
|
-
if (!marker.isAdded && this.isMarkerInBounds(marker, extendedMapBounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {
|
|
943
|
+
if (marker && !marker.isAdded && this.isMarkerInBounds(marker, extendedMapBounds) && (!this.ignoreHidden || (this.ignoreHidden && marker.getVisible()))) {
|
|
902
944
|
this.addToClosestCluster(marker);
|
|
903
945
|
}
|
|
904
946
|
}
|
|
@@ -917,16 +959,20 @@ var Clusterer = /** @class */ (function () {
|
|
|
917
959
|
* @event
|
|
918
960
|
*/
|
|
919
961
|
google.maps.event.trigger(this, 'clusteringend', this);
|
|
920
|
-
for (var
|
|
921
|
-
|
|
962
|
+
for (var _i = 0, _a = this.clusters; _i < _a.length; _i++) {
|
|
963
|
+
var cluster = _a[_i];
|
|
964
|
+
cluster.updateIcon();
|
|
922
965
|
}
|
|
923
966
|
}
|
|
924
967
|
};
|
|
925
968
|
Clusterer.prototype.extend = function (obj1, obj2) {
|
|
926
969
|
return function applyExtend(object) {
|
|
927
970
|
for (var property in object.prototype) {
|
|
971
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
972
|
+
var prop = property;
|
|
973
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
928
974
|
// @ts-ignore
|
|
929
|
-
this.prototype[
|
|
975
|
+
this.prototype[prop] = object.prototype[prop];
|
|
930
976
|
}
|
|
931
977
|
return this;
|
|
932
978
|
}.apply(obj1, [obj2]);
|