Fire the 'changelayer:visibility' event from layer's display method

Move the changelayer event firing logic for in / out of resolution range
from the Map class to the Layer class. Tests have been also been created
to specifically test that the display method works correctly and fires
events only when needed.
This commit is contained in:
Matt Priour
2012-10-09 11:10:55 -05:00
parent 74103ec3e0
commit f17a3c70e4
4 changed files with 60 additions and 4 deletions

View File

@@ -1976,9 +1976,7 @@ OpenLayers.Map = OpenLayers.Class({
if (!inRange) {
layer.display(false);
}
this.events.triggerEvent("changelayer", {
layer: layer, property: "visibility"
});
}
if (inRange && layer.visibility) {
layer.moveTo(bounds, zoomChanged, options.dragging);