diff --git a/contribs/gmf/src/drawing/drawFeatureComponent.js b/contribs/gmf/src/drawing/drawFeatureComponent.js index 0407262c629a..625e3c2883f1 100644 --- a/contribs/gmf/src/drawing/drawFeatureComponent.js +++ b/contribs/gmf/src/drawing/drawFeatureComponent.js @@ -608,6 +608,7 @@ exports.Controller_.prototype.handleCancelKeyEvent_ = function() { const escPressed = event.keyCode === 27; // Escape key if (escPressed && this.selectedFeature) { this.selectedFeature = null; + this.scope_.$apply(); } }); }; diff --git a/contribs/gmf/src/editing/editFeatureComponent.js b/contribs/gmf/src/editing/editFeatureComponent.js index 85c928c91bfe..b9bdb0cb5066 100644 --- a/contribs/gmf/src/editing/editFeatureComponent.js +++ b/contribs/gmf/src/editing/editFeatureComponent.js @@ -995,6 +995,8 @@ exports.Controller_.prototype.handleMapClick_ = function(evt) { const escPressed = event.keyCode === 27; // Escape key if (escPressed && activeInteraction.getActive()) { this.cancel(); + this.scope_.$apply(); + olEvents.unlistenByKey(this.cancelEventKey_); this.cancelEventKey_ = undefined; } diff --git a/src/draw/Controller.js b/src/draw/Controller.js index e6342284d2f4..0a4c5e6c7783 100644 --- a/src/draw/Controller.js +++ b/src/draw/Controller.js @@ -187,9 +187,9 @@ exports.prototype.registerInteraction = function( exports.prototype.handleActiveChange = function(event) { this.active = this.interactions_.some(interaction => interaction.getActive(), this); this.interaction_ = this.interactions_.find(interaction => interaction.getActive() === true); + const uid = getUid(this); if (this.interaction_) { - const uid = getUid(this); this.ngeoEventHelper_.addListenerKey( uid, listen( @@ -199,6 +199,8 @@ exports.prototype.handleActiveChange = function(event) { this ) ); + } else { + this.ngeoEventHelper_.clearListenerKey(uid); } };