Adding eventListeners property to layer, control, and map. Setting this property at construction registers the given listeners based on event type key. r=elemoine (closes #1404)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6435 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -336,6 +336,15 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
*/
|
||||
panTween: null,
|
||||
|
||||
/**
|
||||
* APIProperty: eventListeners
|
||||
* {Object} If set as an option at construction, the eventListeners
|
||||
* object will be registered with <OpenLayers.Events.on>. Object
|
||||
* structure must be a listeners object as shown in the example for
|
||||
* the events.on method.
|
||||
*/
|
||||
eventListeners: null,
|
||||
|
||||
/**
|
||||
* Property: panMethod
|
||||
* {Function} The Easing function to be used for tweening. Default is
|
||||
@@ -408,6 +417,9 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
this.EVENT_TYPES,
|
||||
this.fallThrough);
|
||||
this.updateSize();
|
||||
if(this.eventListeners instanceof Object) {
|
||||
this.events.on(this.eventListeners);
|
||||
}
|
||||
|
||||
// update the map size and location before the map moves
|
||||
this.events.register("movestart", this, this.updateSize);
|
||||
|
||||
Reference in New Issue
Block a user