(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
parent a1ccc876a3
commit 2b01db451d
2 changed files with 13 additions and 0 deletions

View File

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

View File

@ -316,6 +316,11 @@ DynMap.prototype = {
if (worldChanged) { if (worldChanged) {
$(me).trigger('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'); $(me).trigger('mapchanged');
if (completed) { if (completed) {
completed(); completed();