Add hidebydefault setting to playermarkers component too

This commit is contained in:
Mike Primm 2011-08-26 01:22:03 -05:00
parent ace7fbf838
commit 3d385106e9
3 changed files with 8 additions and 3 deletions

View File

@ -55,6 +55,8 @@ components:
showplayerhealth: true showplayerhealth: true
# Option to make player faces small - don't use with showplayerhealth # Option to make player faces small - don't use with showplayerhealth
smallplayerfaces: false smallplayerfaces: false
# # Optional - make player faces layer hidden by default
# hidebydefault: true
#- class: org.dynmap.ClientComponent #- class: org.dynmap.ClientComponent
# type: digitalclock # type: digitalclock
- class: org.dynmap.ClientComponent - class: org.dynmap.ClientComponent

View File

@ -284,13 +284,15 @@ DynMap.prototype = {
me.selectMap(me.defaultworld.defaultmap); me.selectMap(me.defaultworld.defaultmap);
var componentstoload = 0;
var configset = { }; var configset = { };
$.each(me.options.components, function(index, configuration) { $.each(me.options.components, function(index, configuration) {
if(!configset[configuration.type]) if(!configset[configuration.type]) {
configset[configuration.type] = []; configset[configuration.type] = [];
componentstoload++;
}
configset[configuration.type].push(configuration); configset[configuration.type].push(configuration);
}); });
var componentstoload = configset.length;
$.each(configset, function(type, configlist) { $.each(configset, function(type, configlist) {
loadjs('js/' + type + '.js', function() { loadjs('js/' + type + '.js', function() {

View File

@ -128,6 +128,7 @@ componentconstructors['playermarkers'] = function(dynmap, configuration) {
} }
}); });
dynmap.playermarkergroup = new L.LayerGroup(); dynmap.playermarkergroup = new L.LayerGroup();
dynmap.map.addLayer(dynmap.playermarkergroup); if(!configuration.hidebydefault)
dynmap.map.addLayer(dynmap.playermarkergroup);
dynmap.layercontrol.addOverlay(dynmap.playermarkergroup, 'Players'); dynmap.layercontrol.addOverlay(dynmap.playermarkergroup, 'Players');
}; };