From 514e96605badf3f6668320f9e2e094e8ab6cfa07 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Sat, 31 Dec 2011 08:26:55 +0800 Subject: [PATCH] Add 'pinned' choice for showlayercontrol: setting - show expanded layer control --- .../java/org/dynmap/ClientConfigurationComponent.java | 2 +- web/js/map.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/dynmap/ClientConfigurationComponent.java b/src/main/java/org/dynmap/ClientConfigurationComponent.java index f45ac6ac..8d3e37db 100644 --- a/src/main/java/org/dynmap/ClientConfigurationComponent.java +++ b/src/main/java/org/dynmap/ClientConfigurationComponent.java @@ -25,7 +25,7 @@ public class ClientConfigurationComponent extends Component { s(t, "sidebaropened", c.getString("sidebaropened", "false")); s(t, "dynmapversion", plugin.getDescription().getVersion()); s(t, "cyrillic", c.getBoolean("cyrillic-support", false)); - s(t, "showlayercontrol", c.getBoolean("showlayercontrol", true)); + s(t, "showlayercontrol", c.getString("showlayercontrol", "true")); s(t, "grayplayerswhenhidden", c.getBoolean("grayplayerswhenhidden", true)); String sn = plugin.getServer().getServerName(); if(sn.equals("Unknown Server")) diff --git a/web/js/map.js b/web/js/map.js index 38433e33..1798a662 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -109,8 +109,8 @@ DynMap.prototype = { if(urlzoom != null) me.options.defaultzoom = urlzoom; - var showlayerctl = me.getBoolParameterByName('showlayercontrol'); - if(showlayerctl != null) + var showlayerctl = me.getParameterByName('showlayercontrol'); + if(showlayerctl != "") me.options.showlayercontrol = showlayerctl; if(typeof me.options.defaultzoom == 'undefined') @@ -786,8 +786,10 @@ DynMap.prototype = { addToLayerSelector: function(layer, name, priority) { var me = this; - if(me.options.showlayercontrol && (!me.layercontrol)) { + if(me.options.showlayercontrol != "false" && (!me.layercontrol)) { me.layercontrol = new DynmapLayerControl(); + if(me.options.showlayercontrol == "pinned") + me.layercontrol.options.collapsed = false; map.addControl(me.layercontrol); }