0

added per-rendermode bg_color setting

This commit is contained in:
Alex Headley
2011-04-22 11:11:14 -04:00
parent b513977a79
commit eea97d1b1c
3 changed files with 13 additions and 7 deletions

View File

@@ -7,7 +7,6 @@
//center: [0,0,0],
center: {spawn_coords},
cacheMinutes: 0, // Change this to have browsers automatically request new images every x minutes
bg_color: '{bg_color}', // You can set this in settings.py
debug: false
};

View File

@@ -95,11 +95,12 @@ class MapGen(object):
config = config.replace("{spawn_coords}",
json.dumps(list(self.world.spawn)))
config = config.replace("{bg_color}", self.bg_color)
#config = config.replace("{bg_color}", self.bg_color)
# create generated map type data, from given quadtrees
maptypedata = map(lambda q: {'label' : q.rendermode.capitalize(),
'path' : q.tiledir,
'bg_color': self.bg_color,
'overlay' : 'overlay' in get_render_mode_inheritance(q.rendermode),
'imgformat' : q.imgformat},
self.quadtrees)

View File

@@ -477,7 +477,6 @@ function initialize() {
},
mapTypeId: mapTypeIdDefault,
streetViewControl: false,
backgroundColor: config.bg_color,
};
map = new google.maps.Map(document.getElementById('mcmap'), mapOptions);
@@ -501,9 +500,6 @@ function initialize() {
map.mapTypes.set('mcmap' + MCMapType[idx].name, MCMapType[idx]);
}
// We can now set the map to use the 'coordinate' map type
map.setMapTypeId(mapTypeIdDefault);
// initialize the markers and regions
initMarkers();
initRegions();
@@ -518,7 +514,17 @@ function initialize() {
google.maps.event.addListener(map, 'center_changed', function() {
makeLink();
});
google.maps.event.addListener(map, 'maptypeid_changed', function() {
var newType = map.getMapTypeId();
for(i in mapTypeData) {
if( 'mcmap' + mapTypeData[i].label == newType ) {
$('#mcmap').css('background-color', mapTypeData[i].bg_color);
break;
}
}
});
// We can now set the map to use the 'coordinate' map type
map.setMapTypeId(mapTypeIdDefault);
}