BBOX strategy register for layer visibilitychanged, r=tschaub (closes #1835)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9195 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2009-04-06 11:50:30 +00:00
parent bcf29b8a65
commit f5269f8acd
2 changed files with 17 additions and 3 deletions

View File

@@ -458,7 +458,10 @@ OpenLayers.Layer = OpenLayers.Class({
var extent = this.getExtent();
if (extent && this.inRange && this.visibility) {
this.moveTo(extent, true, false);
var zoomChanged = true;
this.moveTo(extent, zoomChanged, false);
this.events.triggerEvent("moveend",
{"zoomChanged": zoomChanged});
redrawn = true;
}
}

View File

@@ -294,7 +294,7 @@
}
function test_Layer_redraw(t) {
t.plan(8)
t.plan(11)
var name = 'Test Layer';
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
@@ -325,6 +325,18 @@
t.ok(layer.redraw(),
"redraw returns true even if extent has not changed");
var log = {};
var onMoveend = function(e) {
log.event = e;
};
layer.events.on({"moveend": onMoveend});
layer.redraw();
layer.events.un({"moveend": onMoveend});
// test that the moveend event was triggered
t.ok(log.event, "an event was logged");
t.eq(log.event.type, "moveend", "moveend was triggered");
t.eq(log.event.zoomChanged, true, "event says zoomChanged true - poor name");
layer.moveTo = function(bounds, zoomChanged, dragging) {
var extent = layer.map.getExtent();
t.ok(bounds.equals(extent),
@@ -335,7 +347,6 @@
"redraw calls moveTo with dragging false");
}
layer.redraw();
}
function test_layer_setIsBaseLayer(t) {