diff --git a/resources/js/public/map-popup.ts b/resources/js/public/map-popup.ts index 7007885..af83c9b 100644 --- a/resources/js/public/map-popup.ts +++ b/resources/js/public/map-popup.ts @@ -40,7 +40,10 @@ export default () => { event.stopPropagation(); } }; - this.containerDiv.addEventListener('contextmenu', allowAnchorRightClicksHandler); + this.containerDiv.addEventListener( + 'contextmenu', + allowAnchorRightClicksHandler, + ); } /** Called when the popup is added to the map. */ @@ -57,10 +60,15 @@ export default () => { /** Called each frame when the popup needs to draw itself. */ draw() { - const divPosition = this.getProjection().fromLatLngToDivPixel(this.position)!; + const divPosition = this.getProjection().fromLatLngToDivPixel( + this.position, + )!; // Hide the popup when it is far out of view. - const display = Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ? 'block' : 'none'; + const display = + Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 + ? 'block' + : 'none'; if (display === 'block') { this.containerDiv.style.left = divPosition.x + 'px'; diff --git a/resources/js/public/map.ts b/resources/js/public/map.ts index 3dae6bf..1ce5dcd 100644 --- a/resources/js/public/map.ts +++ b/resources/js/public/map.ts @@ -1,7 +1,10 @@ declare var google: any; import styles from './map-styles'; import getMarkerPopup from './map-popup'; -import { MarkerClusterer, SuperClusterAlgorithm } from '@googlemaps/markerclusterer'; +import { + MarkerClusterer, + SuperClusterAlgorithm, +} from '@googlemaps/markerclusterer'; export default async (): Promise => { const mapElement = document.getElementById('map') as HTMLElement, @@ -15,13 +18,16 @@ export default async (): Promise => { places: any[] = [], markers: google.maps.marker = []; const infoWindow = new google.maps.InfoWindow(); - const map = new google.maps.Map(document.getElementById('map') as HTMLElement, { - mapTypeId: 'roadmap', - zoom: 12, - mapTypeControl: false, - streetViewControl: false, - styles, - }); + const map = new google.maps.Map( + document.getElementById('map') as HTMLElement, + { + mapTypeId: 'roadmap', + zoom: 12, + mapTypeControl: false, + streetViewControl: false, + styles, + }, + ); try { const response = await fetch(apiUrl, { @@ -38,7 +44,11 @@ export default async (): Promise => { const buildContent = ({ place }: { place: any }): string => { let coords = []; let htmlString = ''; if (!noButton) { - htmlString += ''; + htmlString += + ''; htmlString += buttonLabel ?? 'More info'; htmlString += ''; }