diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt
index 1a80ffb7..5e7482e6 100644
--- a/src/main/resources/configuration.txt
+++ b/src/main/resources/configuration.txt
@@ -77,6 +77,11 @@ components:
type: timeofdayclock
showdigitalclock: true
#showweather: true
+ # Mouse pointer world coordinate display
+ - class: org.dynmap.ClientComponent
+ type: coord
+ label: "Location"
+
#- class: org.dynmap.ClientComponent
# type: logo
# text: "Dynmap"
diff --git a/web/css/dynmap_style.css b/web/css/dynmap_style.css
index 2e96a9e6..1aa75f4a 100644
--- a/web/css/dynmap_style.css
+++ b/web/css/dynmap_style.css
@@ -779,3 +779,24 @@
left: -8px;
z-index: 18;
}
+
+.dynmap .coord-control {
+ color: #000;
+
+ border: 1px solid rgba(128,128,128,0.6);
+ background-color: #bbb;
+ border-style: solid;
+
+ padding: 2px;
+ width: 80px;
+ -moz-border-radius: 5px;
+ border-radius: 5px;
+}
+
+.dynmap .coord-control .coord-control-label {
+
+}
+
+.dynmap .coord-control .coord-control-value {
+ font-weight: bold;
+}
diff --git a/web/js/coord.js b/web/js/coord.js
new file mode 100644
index 00000000..7441be9f
--- /dev/null
+++ b/web/js/coord.js
@@ -0,0 +1,40 @@
+componentconstructors['coord'] = function(dynmap, configuration) {
+
+ var Coord = L.Class.extend({
+ valfield: $(''),
+
+ onAdd: function(map) {
+ this._container = L.DomUtil.create('div', 'coord-control');
+ this._map = map;
+ $('').addClass('coord-control-label').text((configuration.label || 'x,y,z') + ': ').appendTo(this._container);
+ $('
').appendTo(this._container);
+ this.valfield.addClass('coord-control-value').text('').appendTo(this._container);
+
+ this._update();
+ },
+
+ getPosition: function() {
+ return L.Control.Position.TOP_LEFT;
+ },
+
+ getContainer: function() {
+ return this._container;
+ },
+
+ _update: function() {
+ if (!this._map) return;
+ }
+ });
+
+ var coord = new Coord();
+ dynmap.map.addControl(coord);
+ dynmap.map.on('mousemove', function(mevent) {
+ if(!dynmap.map) return;
+ var loc = dynmap.getProjection().fromLatLngToLocation(mevent.latlng, 64);
+ coord.valfield.text(Math.round(loc.x) + ',' + loc.y + ',' + Math.round(loc.z));
+ });
+ dynmap.map.on('mouseout', function(mevent) {
+ if(!dynmap.map) return;
+ coord.valfield.text('---,---,---');
+ });
+};
\ No newline at end of file