mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-28 21:25:46 +01:00
Recenter map only on projection change.
This commit is contained in:
parent
32da02ffaa
commit
c2d596e433
@ -307,6 +307,7 @@ DynMap.prototype = {
|
|||||||
}
|
}
|
||||||
$('.compass').addClass('compass_' + map.name);
|
$('.compass').addClass('compass_' + map.name);
|
||||||
var worldChanged = me.world !== map.world;
|
var worldChanged = me.world !== map.world;
|
||||||
|
var projectionChanged = me.map.getProjection() !== map.projection;
|
||||||
me.map.setMapTypeId('none');
|
me.map.setMapTypeId('none');
|
||||||
me.world = map.world;
|
me.world = map.world;
|
||||||
me.maptype = map;
|
me.maptype = map;
|
||||||
@ -316,11 +317,13 @@ DynMap.prototype = {
|
|||||||
if (worldChanged) {
|
if (worldChanged) {
|
||||||
$(me).trigger('worldchanged');
|
$(me).trigger('worldchanged');
|
||||||
}
|
}
|
||||||
|
if (projectionChanged || worldChanged) {
|
||||||
if (map.world.center) {
|
if (map.world.center) {
|
||||||
me.map.panTo(map.projection.fromWorldToLatLng(map.world.center.x||0,map.world.center.y||0,map.world.center.z||0));
|
me.map.panTo(map.projection.fromWorldToLatLng(map.world.center.x||0,map.world.center.y||64,map.world.center.z||0));
|
||||||
} else {
|
} else {
|
||||||
me.map.panTo(map.projection.fromWorldToLatLng(0,64,0));
|
me.map.panTo(map.projection.fromWorldToLatLng(0,64,0));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$(me).trigger('mapchanged');
|
$(me).trigger('mapchanged');
|
||||||
if (completed) {
|
if (completed) {
|
||||||
completed();
|
completed();
|
||||||
|
Loading…
Reference in New Issue
Block a user