@react-google-maps/marker-clusterer 2.10.1 → 2.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"umd.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 this.cluster = cluster\n this.clusterClassName = this.cluster.getClusterer().getClusterClass()\n this.className = this.clusterClassName\n this.styles = styles\n this.center = undefined\n this.div = null\n this.sums = null\n this.visible = false\n this.boundsChangedListener = null\n this.url = ''\n this.height = 0\n this.width = 0\n this.anchorText = [0, 0]\n this.anchorIcon = [0, 0]\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 this.backgroundPosition = '0 0'\n\n this.cMouseDownInCluster = null\n this.cDraggingMapByCluster = null\n this.timeOut = null\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.setMap(cluster.getMap()) // Note: this causes onAdd to be called\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n markerClusterer.getMap().fitBounds(bounds)\n\n // There is a fix for Issue 170 here:\n this.timeOut = window.setTimeout(() => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n markerClusterer.getMap().fitBounds(bounds)\n\n // Don't zoom beyond the max zoom level\n if (\n maxZoom !== null &&\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n markerClusterer.getMap().getZoom() > maxZoom\n ) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n markerClusterer.getMap().setZoom(maxZoom + 1)\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 this.div.className = this.className\n if (this.visible) {\n this.show()\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getPanes().overlayMouseTarget.appendChild(this.div)\n // Fix for Issue 157\n this.boundsChangedListener = google.maps.event.addListener(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap(),\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 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 { x, y } = this.getPosFromLatLng(this.center)\n\n this.div.style.top = `${y}px`\n this.div.style.left = `${x}px`\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 let divTitle = ''\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 if (\n this.sums === null ||\n typeof this.sums.title === 'undefined' ||\n this.sums.title === ''\n ) {\n divTitle = this.cluster.getClusterer().getTitle()\n } else {\n divTitle = this.sums.title\n }\n\n this.div.style.cursor = 'pointer'\n this.div.style.position = 'absolute'\n this.div.style.top = `${pos.y}px`\n this.div.style.left = `${pos.x}px`\n this.div.style.width = `${this.width}px`\n this.div.style.height = `${this.height}px`\n\n const img = document.createElement('img')\n img.alt = divTitle\n img.src = this.url\n img.style.position = 'absolute'\n img.style.top = `${spriteV}px`\n img.style.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.style.position = 'absolute'\n textElm.style.top = `${this.anchorText[0]}px`\n textElm.style.left = `${this.anchorText[1]}px`\n textElm.style.color = this.textColor\n textElm.style.fontSize = `${this.textSize}px`\n textElm.style.fontFamily = this.fontFamily\n textElm.style.fontWeight = this.fontWeight\n textElm.style.fontStyle = this.fontStyle\n textElm.style.textDecoration = this.textDecoration\n textElm.style.textAlign = 'center'\n textElm.style.width = `${this.width}px`\n textElm.style.lineHeight = `${this.height}px`\n textElm.innerText = `${this.sums?.text}`\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 {\n // @ts-ignore\n const pos = this.getProjection().fromLatLngToDivPixel(latlng)\n\n pos.x -= this.anchorIcon[1]\n\n pos.y -= this.anchorIcon[0]\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\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.map = this.markerClusterer.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\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 {\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.clusterIcon.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'\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 */\nconst CALCULATOR = function 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.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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.setMap(map) // Note: this causes onAdd to be called\n }\n\n onAdd() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.activeMap = this.getMap()\n\n this.ready = true\n\n this.repaint()\n\n // Add the map event listeners\n this.listeners = [\n google.maps.event.addListener(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap(),\n 'zoom_changed',\n () => {\n this.resetViewport(false)\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap().getZoom() === (this.get('minZoom') || 0) ||\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap().getZoom() === this.get('maxZoom')\n ) {\n google.maps.event.trigger(this, 'idle')\n }\n }\n ),\n google.maps.event.addListener(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap(),\n 'idle',\n () => {\n this.redraw()\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 // eslint-disable-next-line @typescript-eslint/no-empty-function\n draw() {}\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 if (position) {\n bounds.extend(position)\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap().fitBounds(bounds)\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 // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const projection = this.getProjection()\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 trPix.x += this.gridSize\n trPix.y -= this.gridSize\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 blPix.x -= this.gridSize\n blPix.y += this.gridSize\n\n // Extend the bounds to contain the new bounds.\n bounds.extend(\n // Convert the pixel points back to LatLng nw\n projection.fromDivPixelToLatLng(trPix)\n )\n\n bounds.extend(\n // Convert the pixel points back to LatLng sw\n projection.fromDivPixelToLatLng(blPix)\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 // 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 =\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap().getZoom() > 3\n ? new google.maps.LatLngBounds(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap()\n .getBounds()\n .getSouthWest(),\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.getMap()\n .getBounds()\n .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 bounds = 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, bounds) && (!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(obj1: any, obj2: any): any {\n return function applyExtend(object: any) {\n // eslint-disable-next-line guard-for-in\n for (const property in object.prototype) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n this.prototype[property] = object.prototype[property]\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return this\n }.apply(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","prototype","onBoundsChanged","onMouseDown","onClick","event","markerClusterer_1","trigger","getZoomOnClick","maxZoom_1","getMaxZoom","bounds_1","getBounds","fitBounds","window","setTimeout","getZoom","setZoom","cancelBubble","stopPropagation","onMouseOver","onMouseOut","onAdd","document","createElement","show","getPanes","overlayMouseTarget","appendChild","addListener","addEventListener","onRemove","parentNode","hide","removeListener","removeEventListener","removeChild","clearTimeout","draw","_a","getPosFromLatLng","x","y","style","top","concat","left","display","divTitle","bp","split","spriteH","parseInt","replace","spriteV","pos","title","getTitle","cursor","position","img","alt","src","enableRetinaIcons","clip","textElm","color","fontSize","textAlign","lineHeight","innerText","text","innerHTML","useStyle","getStyles","Math","min","length","max","index","setCenter","latlng","getProjection","fromLatLngToDivPixel","Cluster","markerClusterer","map","gridSize","getGridSize","minClusterSize","getMinimumClusterSize","averageCenter","getAverageCenter","markers","bounds","clusterIcon","getSize","getMarkers","getCenter","LatLngBounds","i","getPosition","remove","addMarker","marker","isMarkerAlreadyAdded","length_1","LatLng","lat","lng","calculateBounds","isAdded","push","mCount","maxZoom","zoom","isMarkerInClusterBounds","contains","getExtendedBounds","updateIcon","getCalculator","includes","CALCULATOR","numStyles","count","numberOfDigits","toString","IMAGE_SIZES","Clusterer","optMarkers","optOptions","clusters","listeners","activeMap","ready","minimumClusterSize","zoomOnClick","ignoreHidden","imagePath","imageExtension","imageSizes","calculator","batchSize","batchSizeIE","clusterClass","navigator","userAgent","toLowerCase","indexOf","timerRefStatic","setupStyles","addMarkers","_this","repaint","resetViewport","get","redraw","fitMapToMarkers","setGridSize","setMinimumClusterSize","setMaxZoom","setStyles","setTitle","setZoomOnClick","setAverageCenter","getIgnoreHidden","setIgnoreHidden","getEnableRetinaIcons","setEnableRetinaIcons","getImageExtension","setImageExtension","getImagePath","setImagePath","getImageSizes","setImageSizes","setCalculator","getBatchSizeIE","setBatchSizeIE","setClusterClass","getTotalMarkers","getClusters","getTotalClusters","optNoDraw","pushMarkerTo","key","Object","hasOwnProperty","call","getDraggable","removeMarker_","splice","removeMarker","removed","removeMarkers","clearMarkers","oldClusters","slice","projection","trPix","getNorthEast","blPix","getSouthWest","fromDivPixelToLatLng","createClusters","optHide","distanceBetweenPoints","p1","p2","dLat","PI","dLon","a","sin","cos","atan2","sqrt","isMarkerInBounds","addToClosestCluster","distance","clusterToAddTo","d","iFirst","mapBounds","iLast","getVisible","obj1","obj2","object","property","apply"],"mappings":"uPAMA,IAAAA,EAAA,WA2BE,SAAYA,EAAAC,EAAkBC,GAC5BD,EAAQE,eAAeC,OAAOJ,EAAaK,OAAOC,KAAKC,aACvDC,KAAKP,QAAUA,EACfO,KAAKC,iBAAmBD,KAAKP,QAAQE,eAAeO,kBACpDF,KAAKG,UAAYH,KAAKC,iBACtBD,KAAKN,OAASA,EACdM,KAAKI,YAASC,EACdL,KAAKM,IAAM,KACXN,KAAKO,KAAO,KACZP,KAAKQ,SAAU,EACfR,KAAKS,sBAAwB,KAC7BT,KAAKU,IAAM,GACXV,KAAKW,OAAS,EACdX,KAAKY,MAAQ,EACbZ,KAAKa,WAAa,CAAC,EAAG,GACtBb,KAAKc,WAAa,CAAC,EAAG,GACtBd,KAAKe,UAAY,QACjBf,KAAKgB,SAAW,GAChBhB,KAAKiB,eAAiB,OACtBjB,KAAKkB,WAAa,OAClBlB,KAAKmB,UAAY,SACjBnB,KAAKoB,WAAa,mBAClBpB,KAAKqB,mBAAqB,MAE1BrB,KAAKsB,oBAAsB,KAC3BtB,KAAKuB,sBAAwB,KAC7BvB,KAAKwB,QAAU,KAGfxB,KAAKyB,OAAOhC,EAAQiC,UAgSxB,OA7RElC,EAAAmC,UA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terIcon.tsx","../src/Cluster.tsx","../src/Clusterer.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n","/* 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\n (this as unknown as google.maps.OverlayView).setMap(cluster.getMap()) // Note: this causes onAdd to be called\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.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.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 let divTitle = ''\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 if (\n this.sums === null ||\n typeof this.sums.title === 'undefined' ||\n this.sums.title === ''\n ) {\n divTitle = this.cluster.getClusterer().getTitle()\n } else {\n divTitle = this.sums.title\n }\n\n this.div.style.cursor = 'pointer'\n this.div.style.position = 'absolute'\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 this.div.style.width = `${this.width}px`\n this.div.style.height = `${this.height}px`\n\n const img = document.createElement('img')\n\n img.alt = divTitle\n img.src = this.url\n img.style.position = 'absolute'\n img.style.top = `${spriteV}px`\n img.style.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.style.position = 'absolute'\n textElm.style.top = `${this.anchorText[0]}px`\n textElm.style.left = `${this.anchorText[1]}px`\n textElm.style.color = this.textColor\n textElm.style.fontSize = `${this.textSize}px`\n textElm.style.fontFamily = this.fontFamily\n textElm.style.fontWeight = this.fontWeight\n textElm.style.fontStyle = this.fontStyle\n textElm.style.textDecoration = this.textDecoration\n textElm.style.textAlign = 'center'\n textElm.style.width = `${this.width}px`\n textElm.style.lineHeight = `${this.height}px`\n textElm.innerText = `${this.sums?.text}`\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.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\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 */\nconst CALCULATOR = function 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 extends 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 super()\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.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.getMap()?.getZoom() === (this.get('minZoom') || 0) ||\n\n this.getMap()?.getZoom() === this.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.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 // eslint-disable-next-line @typescript-eslint/no-empty-function\n draw() {}\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.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.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.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 (this.prototype as unknown as google.maps.OverlayView).set(property, object.prototype.get(property))\n }\n\n return this\n }.apply<A, [typeof google.maps.OverlayView], any>(obj1, [obj2])\n }\n}\n"],"names":["extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","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","onMouseDown","onClick","event","markerClusterer_1","trigger","getZoomOnClick","maxZoom_1","getMaxZoom","bounds_1","getBounds","map","fitBounds","window","setTimeout","zoom","getZoom","setZoom","cancelBubble","stopPropagation","onMouseOver","onMouseOut","onAdd","document","createElement","show","_a","getPanes","overlayMouseTarget","appendChild","addListener","addEventListener","onRemove","parentNode","hide","removeListener","removeEventListener","removeChild","clearTimeout","draw","pos","getPosFromLatLng","style","top","concat","y","left","x","display","divTitle","bp","split","spriteH","parseInt","replace","spriteV","title","getTitle","cursor","position","img","alt","src","enableRetinaIcons","clip","textElm","color","fontSize","textAlign","lineHeight","innerText","text","innerHTML","useStyle","getStyles","Math","min","length","max","index","setCenter","latlng","getProjection","fromLatLngToDivPixel","Cluster","markerClusterer","gridSize","getGridSize","minClusterSize","getMinimumClusterSize","averageCenter","getAverageCenter","markers","bounds","clusterIcon","getSize","getMarkers","getCenter","LatLngBounds","i","getPosition","remove","addMarker","marker","isMarkerAlreadyAdded","length_1","LatLng","lat","lng","calculateBounds","isAdded","push","mCount","maxZoom","isMarkerInClusterBounds","contains","getExtendedBounds","updateIcon","getCalculator","includes","CALCULATOR","numStyles","count","numberOfDigits","toString","IMAGE_SIZES","Clusterer","_super","optMarkers","optOptions","_this","clusters","listeners","activeMap","ready","minimumClusterSize","zoomOnClick","ignoreHidden","imagePath","imageExtension","imageSizes","calculator","batchSize","batchSizeIE","clusterClass","navigator","userAgent","toLowerCase","indexOf","timerRefStatic","setupStyles","addMarkers","TypeError","String","__","constructor","create","__extends","onZoomChanged","resetViewport","get","_b","onIdle","redraw","repaint","fitMapToMarkers","setGridSize","setMinimumClusterSize","setMaxZoom","setStyles","setTitle","setZoomOnClick","setAverageCenter","getIgnoreHidden","setIgnoreHidden","getEnableRetinaIcons","setEnableRetinaIcons","getImageExtension","setImageExtension","getImagePath","setImagePath","getImageSizes","setImageSizes","setCalculator","getBatchSizeIE","setBatchSizeIE","setClusterClass","getTotalMarkers","getClusters","getTotalClusters","optNoDraw","pushMarkerTo","key","getDraggable","removeMarker_","splice","removeMarker","removed","removeMarkers","clearMarkers","oldClusters","slice","projection","trPix","getNorthEast","blPix","getSouthWest","point1","fromDivPixelToLatLng","point2","createClusters","optHide","distanceBetweenPoints","p1","p2","dLat","PI","dLon","a","sin","cos","atan2","sqrt","isMarkerInBounds","addToClosestCluster","distance","clusterToAddTo","iFirst","mapBounds","extendedMapBounds","iLast","getVisible","obj1","obj2","object","property","set","apply"],"mappings":"uPAgBA,IAAIA,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,I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O,SAAWzI,KAAK0P,iBAAiBxH,EAAQ8H,MAAwBhQ,KAAKoK,cAAiBpK,KAAKoK,cAAgBlC,EAAOgI,eAC7HlQ,KAAK2P,oBAAoBzH,GAI7B,GAAI+H,EAAQjQ,KAAKuH,QAAQf,OACvBxG,KAAKgL,eAAiBxI,OAAOC,YAC3B,WACEoH,EAAKgF,eAAeoB,KAEtB,OAEG,CACLjQ,KAAKgL,eAAiB,KAStBnL,OAAOC,KAAKgC,MAAME,QAAQhC,KAAM,gBAAiBA,MAEjD,IAAS8H,EAAI,EAAGA,EAAI9H,KAAK8J,SAAStD,OAAQsB,IACxC9H,KAAK8J,SAAShC,GAAGkB,gBAKvBS,EAAApK,UAAAO,OAAA,SAAwDuQ,EAASC,GAC/D,OAAO,SAA8BC,GACnC,IAAK,IAAMC,KAAYD,EAAOhR,UAC3BW,KAAKX,UAAiDkR,IAAID,EAAUD,EAAOhR,UAAUsM,IAAI2E,IAG5F,OAAOtQ,MACPwQ,MAAgDL,EAAM,CAACC,KAE5D3G,EA3qBD,CAA+B5J,OAAOC,KAAKC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-google-maps/marker-clusterer",
3
3
  "sideEffects": false,
4
- "version": "2.10.1",
4
+ "version": "2.11.2",
5
5
  "description": "Marker Clusterer for React.js Google Maps API",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -61,7 +61,7 @@
61
61
  "jest": "28.1.0",
62
62
  "jest-cli": "28.1.0",
63
63
  "rimraf": "3.0.2",
64
- "rollup": "2.73.0",
64
+ "rollup": "2.74.1",
65
65
  "rollup-plugin-dts": "4.2.1",
66
66
  "rollup-plugin-terser": "7.0.2"
67
67
  },
package/src/Cluster.tsx CHANGED
@@ -8,7 +8,7 @@ import { MarkerExtended } from './types'
8
8
 
9
9
  export class Cluster {
10
10
  markerClusterer: Clusterer
11
- map: google.maps.Map | google.maps.StreetViewPanorama
11
+ map: google.maps.Map | google.maps.StreetViewPanorama | null
12
12
  gridSize: number
13
13
  minClusterSize: number
14
14
  averageCenter: boolean
@@ -20,8 +20,6 @@ export class Cluster {
20
20
  constructor(markerClusterer: Clusterer) {
21
21
  this.markerClusterer = markerClusterer
22
22
 
23
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
- // @ts-ignore
25
23
  this.map = this.markerClusterer.getMap()
26
24
 
27
25
  this.gridSize = this.markerClusterer.getGridSize()
@@ -51,7 +49,7 @@ export class Cluster {
51
49
  return this.center
52
50
  }
53
51
 
54
- getMap(): google.maps.Map | google.maps.StreetViewPanorama {
52
+ getMap(): google.maps.Map | google.maps.StreetViewPanorama | null {
55
53
  return this.map
56
54
  }
57
55
 
@@ -76,9 +74,7 @@ export class Cluster {
76
74
  }
77
75
 
78
76
  remove() {
79
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
80
- // @ts-ignore
81
- this.clusterIcon.setMap(null)
77
+ (this.clusterIcon as unknown as google.maps.OverlayView).setMap(null)
82
78
 
83
79
  this.markers = []
84
80
 
@@ -125,7 +121,7 @@ export class Cluster {
125
121
 
126
122
  const maxZoom = this.markerClusterer.getMaxZoom()
127
123
 
128
- const zoom = this.map.getZoom()
124
+ const zoom = this.map?.getZoom()
129
125
 
130
126
  if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {
131
127
  // Zoomed in past max zoom, so show the marker.
@@ -172,7 +168,7 @@ export class Cluster {
172
168
 
173
169
  const maxZoom = this.markerClusterer.getMaxZoom()
174
170
 
175
- const zoom = this.map.getZoom()
171
+ const zoom = this.map?.getZoom()
176
172
 
177
173
  if (maxZoom !== null && typeof zoom !== 'undefined' && zoom > maxZoom) {
178
174
  this.clusterIcon.hide()
@@ -33,34 +33,48 @@ export class ClusterIcon {
33
33
 
34
34
  constructor(cluster: Cluster, styles: ClusterIconStyle[]) {
35
35
  cluster.getClusterer().extend(ClusterIcon, google.maps.OverlayView)
36
+
36
37
  this.cluster = cluster
38
+
37
39
  this.clusterClassName = this.cluster.getClusterer().getClusterClass()
40
+
38
41
  this.className = this.clusterClassName
42
+
39
43
  this.styles = styles
44
+
40
45
  this.center = undefined
46
+
41
47
  this.div = null
48
+
42
49
  this.sums = null
50
+
43
51
  this.visible = false
52
+
44
53
  this.boundsChangedListener = null
54
+
45
55
  this.url = ''
56
+
46
57
  this.height = 0
47
58
  this.width = 0
59
+
48
60
  this.anchorText = [0, 0]
49
61
  this.anchorIcon = [0, 0]
62
+
50
63
  this.textColor = 'black'
51
64
  this.textSize = 11
52
65
  this.textDecoration = 'none'
53
66
  this.fontWeight = 'bold'
54
67
  this.fontStyle = 'normal'
55
68
  this.fontFamily = 'Arial,sans-serif'
69
+
56
70
  this.backgroundPosition = '0 0'
57
71
 
58
72
  this.cMouseDownInCluster = null
59
73
  this.cDraggingMapByCluster = null
60
- this.timeOut = null
61
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
62
- // @ts-ignore
63
- this.setMap(cluster.getMap()) // Note: this causes onAdd to be called
74
+ this.timeOut = null;
75
+
76
+
77
+ (this as unknown as google.maps.OverlayView).setMap(cluster.getMap()) // Note: this causes onAdd to be called
64
78
  }
65
79
 
66
80
  onBoundsChanged() {
@@ -96,26 +110,31 @@ export class ClusterIcon {
96
110
 
97
111
  const bounds = this.cluster.getBounds()
98
112
 
99
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
100
- // @ts-ignore
101
- markerClusterer.getMap().fitBounds(bounds)
113
+ const map = markerClusterer.getMap()
114
+
115
+ if (map !== null && 'fitBounds' in map) {
116
+ map.fitBounds(bounds)
117
+ }
118
+
102
119
 
103
120
  // There is a fix for Issue 170 here:
104
121
  this.timeOut = window.setTimeout(() => {
105
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
106
- // @ts-ignore
107
- markerClusterer.getMap().fitBounds(bounds)
108
-
109
- // Don't zoom beyond the max zoom level
110
- if (
111
- maxZoom !== null &&
112
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
113
- // @ts-ignore
114
- markerClusterer.getMap().getZoom() > maxZoom
115
- ) {
116
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
117
- // @ts-ignore
118
- markerClusterer.getMap().setZoom(maxZoom + 1)
122
+ const map = markerClusterer.getMap()
123
+
124
+ if (map !== null) {
125
+ if ('fitBounds' in map) {
126
+ map.fitBounds(bounds)
127
+ }
128
+
129
+ const zoom = map.getZoom() || 0
130
+
131
+ // Don't zoom beyond the max zoom level
132
+ if (
133
+ maxZoom !== null &&
134
+ zoom > maxZoom
135
+ ) {
136
+ map.setZoom(maxZoom + 1)
137
+ }
119
138
  }
120
139
  }, 100)
121
140
  }
@@ -159,30 +178,33 @@ export class ClusterIcon {
159
178
 
160
179
  onAdd() {
161
180
  this.div = document.createElement('div')
181
+
162
182
  this.div.className = this.className
183
+
163
184
  if (this.visible) {
164
185
  this.show()
165
186
  }
166
187
 
167
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
168
- // @ts-ignore
169
- this.getPanes().overlayMouseTarget.appendChild(this.div)
170
- // Fix for Issue 157
171
- this.boundsChangedListener = google.maps.event.addListener(
172
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
173
- // @ts-ignore
174
- this.getMap(),
175
- 'bounds_changed',
176
- this.onBoundsChanged
177
- )
188
+ ;(this as unknown as google.maps.OverlayView).getPanes()?.overlayMouseTarget.appendChild(this.div)
189
+
190
+ const map = (this as unknown as google.maps.OverlayView).getMap()
178
191
 
179
- this.div.addEventListener('mousedown', this.onMouseDown)
192
+ if (map !== null) {
193
+ // Fix for Issue 157
194
+ this.boundsChangedListener = google.maps.event.addListener(
195
+ map,
196
+ 'bounds_changed',
197
+ this.onBoundsChanged
198
+ )
180
199
 
181
- this.div.addEventListener('click', this.onClick)
200
+ this.div.addEventListener('mousedown', this.onMouseDown)
182
201
 
183
- this.div.addEventListener('mouseover', this.onMouseOver)
202
+ this.div.addEventListener('click', this.onClick)
184
203
 
185
- this.div.addEventListener('mouseout', this.onMouseOut)
204
+ this.div.addEventListener('mouseover', this.onMouseOver)
205
+
206
+ this.div.addEventListener('mouseout', this.onMouseOut)
207
+ }
186
208
  }
187
209
 
188
210
  onRemove() {
@@ -215,10 +237,10 @@ export class ClusterIcon {
215
237
 
216
238
  draw() {
217
239
  if (this.visible && this.div !== null && this.center) {
218
- const { x, y } = this.getPosFromLatLng(this.center)
240
+ const pos = this.getPosFromLatLng(this.center)
219
241
 
220
- this.div.style.top = `${y}px`
221
- this.div.style.left = `${x}px`
242
+ this.div.style.top = pos !== null ? `${pos.y}px` : '0'
243
+ this.div.style.left = pos !== null ? `${pos.x}px` : '0'
222
244
  }
223
245
  }
224
246
 
@@ -254,12 +276,15 @@ export class ClusterIcon {
254
276
 
255
277
  this.div.style.cursor = 'pointer'
256
278
  this.div.style.position = 'absolute'
257
- this.div.style.top = `${pos.y}px`
258
- this.div.style.left = `${pos.x}px`
279
+
280
+ this.div.style.top = pos !== null ? `${pos.y}px` : '0'
281
+ this.div.style.left = pos !== null ? `${pos.x}px` : '0'
282
+
259
283
  this.div.style.width = `${this.width}px`
260
284
  this.div.style.height = `${this.height}px`
261
285
 
262
286
  const img = document.createElement('img')
287
+
263
288
  img.alt = divTitle
264
289
  img.src = this.url
265
290
  img.style.position = 'absolute'
@@ -338,13 +363,14 @@ export class ClusterIcon {
338
363
  this.center = center
339
364
  }
340
365
 
341
- getPosFromLatLng(latlng: google.maps.LatLng): google.maps.Point {
342
- // @ts-ignore
343
- const pos = this.getProjection().fromLatLngToDivPixel(latlng)
366
+ getPosFromLatLng(latlng: google.maps.LatLng): google.maps.Point | null {
367
+ const pos = (this as unknown as google.maps.OverlayView).getProjection().fromLatLngToDivPixel(latlng)
344
368
 
345
- pos.x -= this.anchorIcon[1]
369
+ if (pos !== null) {
370
+ pos.x -= this.anchorIcon[1]
346
371
 
347
- pos.y -= this.anchorIcon[0]
372
+ pos.y -= this.anchorIcon[0]
373
+ }
348
374
 
349
375
  return pos
350
376
  }