(Optionally) set map center in web config, automagically pan there on map change.

This commit is contained in:
zeeZ 2011-05-14 01:16:26 +02:00 committed by FrozenCow
parent 31584804aa
commit 7ff33f04a0
2 changed files with 13 additions and 0 deletions

View File

@ -126,6 +126,10 @@ web:
worlds:
- title: World
name: world
center:
x: 0
y: 64
z: 0
maps:
- type: FlatMapType
title: Flat
@ -145,6 +149,10 @@ web:
prefix: ct
- title: Nether
name: nether
center:
x: 0
y: 64
z: 0
maps:
- type: FlatMapType
title: Flat

View File

@ -316,6 +316,11 @@ DynMap.prototype = {
if (worldChanged) {
$(me).trigger('worldchanged');
}
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));
} else {
me.map.panTo(map.projection.fromWorldToLatLng(0,64,0));
}
$(me).trigger('mapchanged');
if (completed) {
completed();