Pullups for 2.8 RC5:
Google Layer resizing (Closes #1797) SelectFeature default scope (Closes #2115) git-svn-id: http://svn.openlayers.org/branches/openlayers/2.8@9423 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -111,7 +111,7 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Object} The scope to use with the onBeforeSelect, onSelect, onUnselect
|
||||
* callbacks. If null the scope will be this control.
|
||||
*/
|
||||
scope: this,
|
||||
scope: null,
|
||||
|
||||
/**
|
||||
* APIProperty: geometryTypes
|
||||
@@ -178,6 +178,10 @@ OpenLayers.Control.SelectFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
OpenLayers.Control.prototype.EVENT_TYPES
|
||||
);
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
|
||||
if(this.scope === null) {
|
||||
this.scope = this;
|
||||
}
|
||||
if(layers instanceof Array) {
|
||||
this.layers = layers;
|
||||
this.layer = new OpenLayers.Layer.Vector.RootContainer(
|
||||
|
||||
@@ -213,7 +213,7 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
*/
|
||||
onMapResize: function() {
|
||||
// workaround for resizing of invisible or not yet fully loaded layers
|
||||
// where GMap2.checkResize() does not work. We need to load all tiles
|
||||
// where GMap2.checkResize() does not work. We need to load the GMap
|
||||
// for the old div size, then checkResize(), and then call
|
||||
// layer.moveTo() to trigger GMap.setCenter() (which will finish
|
||||
// the GMap initialization).
|
||||
@@ -222,7 +222,7 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
} else {
|
||||
if(!this._resized) {
|
||||
var layer = this;
|
||||
var handle = GEvent.addListener(this.mapObject, "tilesloaded", function() {
|
||||
var handle = GEvent.addListener(this.mapObject, "load", function() {
|
||||
GEvent.removeListener(handle);
|
||||
delete layer._resized;
|
||||
layer.mapObject.checkResize();
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
|
||||
function test_Control_SelectFeature_clickFeature(t) {
|
||||
t.plan(4);
|
||||
t.plan(6);
|
||||
// mock up layer
|
||||
var layer = {
|
||||
selectedFeatures: [],
|
||||
@@ -100,6 +100,7 @@
|
||||
"onSelect called with proper feature (" + feature.index + ")");
|
||||
t.eq(feature.tested, feature.test,
|
||||
"onSelect called only once for feature (" + feature.index + ")");
|
||||
t.ok(this == control, "onSelect called in the scope of the control if control.scope is not provided");
|
||||
}
|
||||
|
||||
// test that onUnselect gets called properly
|
||||
@@ -109,9 +110,10 @@
|
||||
"onUnselect called with proper feature (" + feature.index + ")");
|
||||
t.eq(feature.tested, feature.test,
|
||||
"onUnselect called only once for feature (" + feature.index + ")");
|
||||
t.ok(this == control, "onUnselect called in the scope of the control if control.scope is not provided");
|
||||
}
|
||||
|
||||
// mock up first click on first feature (runs 2 tests from onSelect)
|
||||
// mock up first click on first feature (runs 3 tests from onSelect)
|
||||
var feature = features[0];
|
||||
feature.index = 0;
|
||||
feature.test = 1;
|
||||
@@ -121,7 +123,7 @@
|
||||
control.toggle = false;
|
||||
control.clickFeature(feature);
|
||||
|
||||
// mock up second click on first feature (runs 2 tests from onUnselect)
|
||||
// mock up second click on first feature (runs 3 tests from onUnselect)
|
||||
control.toggle = true;
|
||||
feature.test = 2;
|
||||
control.clickFeature(feature);
|
||||
|
||||
Reference in New Issue
Block a user