oops - can only bringToFront when a layer is acutally on the map - so check debug layer is enabled

This commit is contained in:
Jon Atkins 2014-03-11 13:59:02 +00:00
parent 4f6631d1f7
commit 6c50fc9eb1

View File

@ -29,7 +29,10 @@ window.RenderDebugTiles.prototype.create = function(id,bounds) {
var l = L.rectangle(bounds,s); var l = L.rectangle(bounds,s);
this.debugTileToRectangle[id] = l; this.debugTileToRectangle[id] = l;
this.debugTileLayer.addLayer(l); this.debugTileLayer.addLayer(l);
l.bringToBack(); if (map.hasLayer(this.debugTileLayer)) {
// only bring to back if we have the debug layer turned on
l.bringToBack();
}
} }
window.RenderDebugTiles.prototype.setColour = function(id,bordercol,fillcol) { window.RenderDebugTiles.prototype.setColour = function(id,bordercol,fillcol) {