Open rodrigojp2005 opened 2 years ago
ubuntu 22.04
Chrome 104.0.5112.101 (oficial) 64 bits
moderate
function initMap() { const myLatlng = { lat: -25.363, lng: 131.044 };
const map = new google.maps.Map(document.getElementById("map")!, { zoom: 4, center: myLatlng, });
// Create the initial InfoWindow. let infoWindow = new google.maps.InfoWindow({ content: "Click the map to get Lat/Lng!", position: myLatlng, });
infoWindow.open(map);
// Configure the click listener. map.addListener("click", (mapsMouseEvent) => { // Close the current InfoWindow. infoWindow.close();
// Create a new InfoWindow. infoWindow = new google.maps.InfoWindow({ position: mapsMouseEvent.latLng, }); infoWindow.setContent( JSON.stringify(mapsMouseEvent.latLng.toJSON(), null, 2) ); infoWindow.open(map);
}); }
declare global { interface Window { initMap: () => void; } } window.initMap = initMap; export {};
Just run.
I fixed it by commenting some parts below <script> function initMap() { const myLatlng = { lat: -25.363, lng: 131.044 }; const map = new google.maps.Map(document.getElementById('map'), { zoom: 4, center: myLatlng, }); // Create the initial InfoWindow. let infoWindow = new google.maps.InfoWindow({ content: "Click the map to get Lat/Lng!", position: myLatlng, }); infoWindow.open(map); // Configure the click listener. map.addListener("click", (mapsMouseEvent) => { // Close the current InfoWindow. infoWindow.close(); // Create a new InfoWindow. infoWindow = new google.maps.InfoWindow({ position: mapsMouseEvent.latLng, }); infoWindow.setContent( JSON.stringify(mapsMouseEvent.latLng.toJSON(), null, 2) ); infoWindow.open(map); }); } /* declare global { interface Window { initMap: () => void; } }*/ window.initMap = initMap; //export {}; </script>
Hi, please describe the issue. What is the expected behavior and what happens instead? If you are seeing an error message in the JavaScript console, share that as well.
Operating system
ubuntu 22.04
Browser Version
Chrome 104.0.5112.101 (oficial) 64 bits
How severe is the bug?
moderate
Bug description
function initMap() { const myLatlng = { lat: -25.363, lng: 131.044 };
const map = new google.maps.Map(document.getElementById("map")!, { zoom: 4, center: myLatlng, });
// Create the initial InfoWindow. let infoWindow = new google.maps.InfoWindow({ content: "Click the map to get Lat/Lng!", position: myLatlng, });
infoWindow.open(map);
// Configure the click listener. map.addListener("click", (mapsMouseEvent) => { // Close the current InfoWindow. infoWindow.close();
}); }
declare global { interface Window { initMap: () => void; } } window.initMap = initMap; export {};
Steps to reproduce
Just run.
Console log output