Clean up when propagation is stopped
This commit is contained in:
@@ -70,11 +70,13 @@ ol.events.EventTarget.prototype.dispatchEvent = function(event) {
|
|||||||
var type = evt.type;
|
var type = evt.type;
|
||||||
evt.target = this;
|
evt.target = this;
|
||||||
var listeners = this.listeners_[type];
|
var listeners = this.listeners_[type];
|
||||||
|
var propagate;
|
||||||
if (listeners) {
|
if (listeners) {
|
||||||
this.pendingRemovals_[type] = 0;
|
this.pendingRemovals_[type] = 0;
|
||||||
for (var i = 0, ii = listeners.length; i < ii; ++i) {
|
for (var i = 0, ii = listeners.length; i < ii; ++i) {
|
||||||
if (listeners[i].call(this, evt) === false || evt.propagationStopped) {
|
if (listeners[i].call(this, evt) === false || evt.propagationStopped) {
|
||||||
return false;
|
propagate = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var pendingRemovals = this.pendingRemovals_[type];
|
var pendingRemovals = this.pendingRemovals_[type];
|
||||||
@@ -82,6 +84,7 @@ ol.events.EventTarget.prototype.dispatchEvent = function(event) {
|
|||||||
while (pendingRemovals--) {
|
while (pendingRemovals--) {
|
||||||
this.removeEventListener(type, ol.nullFunction);
|
this.removeEventListener(type, ol.nullFunction);
|
||||||
}
|
}
|
||||||
|
return propagate;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user