mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-05 10:09:53 +01:00
31 lines
856 B
JavaScript
31 lines
856 B
JavaScript
componentconstructors['projectiontest'] = function(dynmap, configuration) {
|
|
var me = this;
|
|
var marker = new L.CustomMarker(new L.LatLng(0,0,true), {
|
|
elementCreator: function() {
|
|
var div = document.createElement('div');
|
|
var textContainer;
|
|
$(div)
|
|
.css({margin: '10px 10px 10px 10px'})
|
|
.append(
|
|
textContainer = $('<span/>')
|
|
.css({'white-space': 'pre'})
|
|
.text('')
|
|
);
|
|
marker.setText = function(text) {
|
|
$(textContainer).text(text);
|
|
};
|
|
return div;
|
|
}
|
|
});
|
|
dynmap.map.addLayer(marker);
|
|
|
|
dynmap.map.on('mousemove', function(event) {
|
|
marker.setLatLng(event.latlng);
|
|
if (marker.setText) {
|
|
marker.setText('LatLng: (' + event.latlng.lat + ',' + event.latlng.lng + ')\n'+
|
|
'LayerPoint: (' + event.layerPoint.x + ',' + event.layerPoint.y + ')\n'+
|
|
'World: (?,?,?)'
|
|
);
|
|
}
|
|
});
|
|
}; |