Propagate change events from sources via layers
This commit is contained in:
@@ -28,6 +28,9 @@ ol.layer.Layer = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.source_ = options.source;
|
this.source_ = options.source;
|
||||||
|
|
||||||
|
goog.events.listen(this.source_, goog.events.EventType.CHANGE,
|
||||||
|
this.handleSourceChange_, false, this);
|
||||||
|
|
||||||
if (!this.source_.isReady()) {
|
if (!this.source_.isReady()) {
|
||||||
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
|
goog.events.listenOnce(this.source_, goog.events.EventType.LOAD,
|
||||||
this.handleSourceLoad_, false, this);
|
this.handleSourceLoad_, false, this);
|
||||||
@@ -78,6 +81,14 @@ ol.layer.Layer.prototype.getSource = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
||||||
|
this.dispatchChangeEvent();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user