diff --git a/web_assets/overviewer.css b/web_assets/overviewer.css index dc435fa..dbb3830 100644 --- a/web_assets/overviewer.css +++ b/web_assets/overviewer.css @@ -82,7 +82,7 @@ body { } -#link { +#link, #coordsDiv { background-color: #fff; /* fallback */ background-color: rgba(255,255,255,0.55); border: 1px solid rgb(0, 0, 0); diff --git a/web_assets/overviewer.js b/web_assets/overviewer.js index ceeb7dc..ea87a19 100644 --- a/web_assets/overviewer.js +++ b/web_assets/overviewer.js @@ -591,6 +591,17 @@ var overviewer = { overviewer.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv); } + // Coords box + var coordsDiv = document.createElement('DIV'); + coordsDiv.id = 'coordsDiv'; + coordsDiv.innerHTML = ''; + overviewer.map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(coordsDiv); + // Update coords on mousemove + google.maps.event.addListener(overviewer.map, 'mousemove', function (event) { + var worldcoords = overviewer.util.fromLatLngToWorld(event.latLng.lat(), event.latLng.lng()); + coordsDiv.innerHTML = "Coords: X " + Math.round(worldcoords.x) + ", Z " + Math.round(worldcoords.z); + }); + // only need to create the control if there are items in the list. // as defined in config.js if (overviewerConfig.objectGroups.signs.length > 0) {