Skip to content

Commit

Permalink
Merge pull request #5184 from camptocamp/fix_escapeKey
Browse files Browse the repository at this point in the history
Fix escape key
  • Loading branch information
llienher authored Oct 1, 2019
2 parents 547a053 + bc3d0ad commit ecd98ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions contribs/gmf/src/drawing/drawFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
};
Expand Down
2 changes: 2 additions & 0 deletions contribs/gmf/src/editing/editFeatureComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 3 additions & 1 deletion src/draw/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -199,6 +199,8 @@ exports.prototype.handleActiveChange = function(event) {
this
)
);
} else {
this.ngeoEventHelper_.clearListenerKey(uid);
}
};

Expand Down

0 comments on commit ecd98ab

Please sign in to comment.