From 3d385106e9464d2a87a71b729003dd0d55ebe90b Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 26 Aug 2011 01:22:03 -0500 Subject: [PATCH] Add hidebydefault setting to playermarkers component too --- src/main/resources/configuration.txt | 2 ++ web/js/map.js | 6 ++++-- web/js/playermarkers.js | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/resources/configuration.txt b/src/main/resources/configuration.txt index c5f218a9..ca3ea984 100644 --- a/src/main/resources/configuration.txt +++ b/src/main/resources/configuration.txt @@ -55,6 +55,8 @@ components: showplayerhealth: true # Option to make player faces small - don't use with showplayerhealth smallplayerfaces: false + # # Optional - make player faces layer hidden by default + # hidebydefault: true #- class: org.dynmap.ClientComponent # type: digitalclock - class: org.dynmap.ClientComponent diff --git a/web/js/map.js b/web/js/map.js index 6693021b..a571cdec 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -284,13 +284,15 @@ DynMap.prototype = { me.selectMap(me.defaultworld.defaultmap); + var componentstoload = 0; var configset = { }; $.each(me.options.components, function(index, configuration) { - if(!configset[configuration.type]) + if(!configset[configuration.type]) { configset[configuration.type] = []; + componentstoload++; + } configset[configuration.type].push(configuration); }); - var componentstoload = configset.length; $.each(configset, function(type, configlist) { loadjs('js/' + type + '.js', function() { diff --git a/web/js/playermarkers.js b/web/js/playermarkers.js index 60268547..e4d2d77a 100644 --- a/web/js/playermarkers.js +++ b/web/js/playermarkers.js @@ -128,6 +128,7 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) { } }); dynmap.playermarkergroup = new L.LayerGroup(); - dynmap.map.addLayer(dynmap.playermarkergroup); + if(!configuration.hidebydefault) + dynmap.map.addLayer(dynmap.playermarkergroup); dynmap.layercontrol.addOverlay(dynmap.playermarkergroup, 'Players'); };