Re-implement spawn marker
Let's hope this works, any bugs are totally my fault.
This commit is contained in:
@@ -103,8 +103,8 @@ directory.
|
||||
'defaultMarker': 'signpost.png',
|
||||
'signMarker': 'signpost_icon.png',
|
||||
'bedMarker': 'bed.png',
|
||||
'spawnMarker': 'https://google-maps-icons.googlecode.com/files/home.png',
|
||||
'queryMarker': 'https://google-maps-icons.googlecode.com/files/regroup.png'
|
||||
'spawnMarker': 'icons/marker_home.png',
|
||||
'queryMarker': 'icons/marker_location.png'
|
||||
}
|
||||
dump['CONST']['mapDivId'] = 'mcmap'
|
||||
dump['CONST']['regionStrokeWeight'] = 2 # Obselete
|
||||
|
||||
@@ -52,9 +52,13 @@ overviewer.collections = {
|
||||
'markerInfo': {},
|
||||
|
||||
/**
|
||||
* holds a reference to the spawn marker.
|
||||
* holds a reference to the current spawn marker.
|
||||
*/
|
||||
'spawnMarker': null,
|
||||
/**
|
||||
* contains the spawn marker for each world
|
||||
*/
|
||||
'spawnMarkers': {},
|
||||
|
||||
/**
|
||||
* if a user visits a specific URL, this marker will point to the coordinates in the hash
|
||||
|
||||
@@ -109,6 +109,18 @@ overviewer.util = {
|
||||
|
||||
overviewer.map.on('baselayerchange', function(ev) {
|
||||
overviewer.current_layer[overviewer.current_world] = ev.name;
|
||||
|
||||
// Remove old spawn marker, add new one
|
||||
if (overviewer.collections.spawnMarker) {
|
||||
overviewer.collections.spawnMarker.remove();
|
||||
}
|
||||
if (overviewer.collections.spawnMarkers[overviewer.current_world]) {
|
||||
overviewer.collections.spawnMarker = overviewer.collections
|
||||
.spawnMarkers[overviewer.current_world];
|
||||
overviewer.collections.spawnMarker.addTo(overviewer.map);
|
||||
} else {
|
||||
overviewer.collections.spawnMarker = null;
|
||||
}
|
||||
});
|
||||
|
||||
var tset = overviewerConfig.tilesets[0];
|
||||
@@ -152,6 +164,13 @@ overviewer.util = {
|
||||
if (typeof(obj.spawn) == "object") {
|
||||
var latlng = overviewer.util.fromWorldToLatLng(obj.spawn[0], obj.spawn[1], obj.spawn[2], obj);
|
||||
overviewer.collections.centers[obj.world] = [ latlng, 1 ];
|
||||
|
||||
/// TODO: Retina Icon
|
||||
var spawnIcon = L.icon({
|
||||
iconUrl: overviewerConfig.CONST.image.spawnMarker,
|
||||
});
|
||||
var ohaimark = L.marker(latlng, {icon: spawnIcon, title: "Spawn"});
|
||||
overviewer.collections.spawnMarkers[obj.world] = ohaimark;
|
||||
} else {
|
||||
overviewer.collections.centers[obj.world] = [ [0, 0], 1 ];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user