Trigger feature related events with feature information and layer related events with layer information. Also adding events.on and events.un convenience methods. r=crschmidt (closes #1343)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6149 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+30
-5
@@ -37,9 +37,26 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
*/
|
||||
opacity: null,
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constant: EVENT_TYPES
|
||||
* {Array(String)} Supported application event types
|
||||
* {Array(String)} Supported application event types. Register a listener
|
||||
* for a particular event with the following syntax:
|
||||
* (code)
|
||||
* layer.events.register(type, obj, listener);
|
||||
* (end)
|
||||
*
|
||||
* Listeners will be called with a reference to an event object. The
|
||||
* properties of this event depends on exactly what happened.
|
||||
*
|
||||
* All event objects have at least the following properties:
|
||||
* - *object* {Object} A reference to layer.events.object.
|
||||
* - *element* {DOMElement} A reference to layer.events.element.
|
||||
*
|
||||
* Supported map event types:
|
||||
* - *loadstart* Triggered when layer loading starts.
|
||||
* - *loadend* Triggered when layer loading ends.
|
||||
* - *loadcancel* Triggered when layer loading is canceled.
|
||||
* - *visibilitychanged* Triggered when layer visibility is changed.
|
||||
*/
|
||||
EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged"],
|
||||
|
||||
@@ -327,7 +344,10 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
if (newName != this.name) {
|
||||
this.name = newName;
|
||||
if (this.map != null) {
|
||||
this.map.events.triggerEvent("changelayer");
|
||||
this.map.events.triggerEvent("changelayer", {
|
||||
layer: this,
|
||||
property: "name"
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -530,7 +550,10 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
this.display(visibility);
|
||||
this.redraw();
|
||||
if (this.map != null) {
|
||||
this.map.events.triggerEvent("changelayer");
|
||||
this.map.events.triggerEvent("changelayer", {
|
||||
layer: this,
|
||||
property: "visibility"
|
||||
});
|
||||
}
|
||||
this.events.triggerEvent("visibilitychanged");
|
||||
}
|
||||
@@ -576,7 +599,9 @@ OpenLayers.Layer = OpenLayers.Class({
|
||||
if (isBaseLayer != this.isBaseLayer) {
|
||||
this.isBaseLayer = isBaseLayer;
|
||||
if (this.map != null) {
|
||||
this.map.events.triggerEvent("changebaselayer");
|
||||
this.map.events.triggerEvent("changebaselayer", {
|
||||
layer: this
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user