I think we decided to name events in a noun+verb fashion.
This commit is contained in:
@@ -17,7 +17,7 @@ goog.require('goog.asserts');
|
|||||||
* @export
|
* @export
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @event addlayer Fires when a layer is added to the map. The event object
|
* @event layeradd Fires when a layer is added to the map. The event object
|
||||||
* contains a 'layer' property referencing the added layer.
|
* contains a 'layer' property referencing the added layer.
|
||||||
*/
|
*/
|
||||||
ol.Map = function() {
|
ol.Map = function() {
|
||||||
@@ -394,7 +394,7 @@ ol.Map.prototype.addLayers = function(layers) {
|
|||||||
for (var i=0, ii=layers.length; i<ii; ++i) {
|
for (var i=0, ii=layers.length; i<ii; ++i) {
|
||||||
layer = layers[i];
|
layer = layers[i];
|
||||||
this.layers_.push(layer);
|
this.layers_.push(layer);
|
||||||
this.events_.triggerEvent('addlayer', {'layer': layer});
|
this.events_.triggerEvent('layeradd', {'layer': layer});
|
||||||
}
|
}
|
||||||
this.conditionallyRender();
|
this.conditionallyRender();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ ol.control.Attribution.prototype.setMap = function(map) {
|
|||||||
ol.control.Attribution.prototype.activate = function() {
|
ol.control.Attribution.prototype.activate = function() {
|
||||||
var active = goog.base(this, 'activate');
|
var active = goog.base(this, 'activate');
|
||||||
if (active) {
|
if (active) {
|
||||||
this.map_.getEvents().register('addlayer', this.update, this);
|
this.map_.getEvents().register('layeradd', this.update, this);
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
return active;
|
return active;
|
||||||
@@ -57,7 +57,7 @@ ol.control.Attribution.prototype.activate = function() {
|
|||||||
ol.control.Attribution.prototype.deactivate = function() {
|
ol.control.Attribution.prototype.deactivate = function() {
|
||||||
var inactive = goog.base(this, 'deactivate');
|
var inactive = goog.base(this, 'deactivate');
|
||||||
if (inactive) {
|
if (inactive) {
|
||||||
this.map_.getEvents().unregister('addlayer', this.update, this);
|
this.map_.getEvents().unregister('layeradd', this.update, this);
|
||||||
}
|
}
|
||||||
return inactive;
|
return inactive;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user