From 7ff33f04a098a34ae126b780193df261a345ccce Mon Sep 17 00:00:00 2001 From: zeeZ Date: Sat, 14 May 2011 01:16:26 +0200 Subject: [PATCH] (Optionally) set map center in web config, automagically pan there on map change. --- configuration.txt | 8 ++++++++ web/js/map.js | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/configuration.txt b/configuration.txt index 8bdf9bfa..31b7be9b 100644 --- a/configuration.txt +++ b/configuration.txt @@ -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 diff --git a/web/js/map.js b/web/js/map.js index 0380c569..0ae78f17 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -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();