0

Added mouseover coords

This commit is contained in:
Eric Carr
2011-06-15 15:09:04 +02:00
committed by Aaron Griffith
parent c3e79459d4
commit 0bb484bdf7
2 changed files with 12 additions and 1 deletions

View File

@@ -82,7 +82,7 @@ body {
} }
#link { #link, #coordsDiv {
background-color: #fff; /* fallback */ background-color: #fff; /* fallback */
background-color: rgba(255,255,255,0.55); background-color: rgba(255,255,255,0.55);
border: 1px solid rgb(0, 0, 0); border: 1px solid rgb(0, 0, 0);

View File

@@ -591,6 +591,17 @@ var overviewer = {
overviewer.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv); 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. // only need to create the control if there are items in the list.
// as defined in config.js // as defined in config.js
if (overviewerConfig.objectGroups.signs.length > 0) { if (overviewerConfig.objectGroups.signs.length > 0) {