Skip to content

Commit

Permalink
Merge pull request #3093 from camptocamp/rm_goog.events_interaction
Browse files Browse the repository at this point in the history
Remove goog.events usage in ngeo.interaction
  • Loading branch information
fredj committed Nov 15, 2017
2 parents 670030e + 02ce604 commit 1adcf37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 4 additions & 6 deletions src/ol-ext/interaction/rotate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ goog.provide('ngeo.RotateEventType');
goog.provide('ngeo.interaction.Rotate');

goog.require('goog.asserts');
goog.require('goog.events');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.Feature');
Expand Down Expand Up @@ -86,7 +85,7 @@ ngeo.interaction.Rotate = function(options) {
this.modified_ = false;

/**
* @type {?goog.events.Key}
* @type {?ol.EventsKey}
* @private
*/
this.keyPressListenerKey_ = null;
Expand Down Expand Up @@ -173,18 +172,17 @@ ol.inherits(ngeo.interaction.Rotate, ol.interaction.Pointer);
ngeo.interaction.Rotate.prototype.setActive = function(active) {

if (this.keyPressListenerKey_) {
goog.events.unlistenByKey(this.keyPressListenerKey_);
ol.events.unlistenByKey(this.keyPressListenerKey_);
this.keyPressListenerKey_ = null;
}

ol.interaction.Pointer.prototype.setActive.call(this, active);

if (active) {
this.keyPressListenerKey_ = goog.events.listen(
this.keyPressListenerKey_ = ol.events.listen(
document,
'keyup',
this.handleKeyUp_,
false,
this
);
this.features_.forEach(this.addFeature_, this);
Expand Down Expand Up @@ -396,7 +394,7 @@ ngeo.interaction.Rotate.prototype.handleUp_ = function(evt) {

/**
* Deactivate this interaction if the ESC key is pressed.
* @param {goog.events.Event} evt Event.
* @param {KeyboardEvent} evt Event.
* @private
*/
ngeo.interaction.Rotate.prototype.handleKeyUp_ = function(evt) {
Expand Down
10 changes: 5 additions & 5 deletions src/ol-ext/interaction/translate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
goog.provide('ngeo.interaction.Translate');

goog.require('ol.Feature');
goog.require('ol.events');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
Expand Down Expand Up @@ -38,7 +39,7 @@ ngeo.interaction.Translate = function(options) {
this.featureListenerKeys_ = {};

/**
* @type {?goog.events.Key}
* @type {?ol.EventsKey}
* @private
*/
this.keyPressListenerKey_ = null;
Expand Down Expand Up @@ -89,18 +90,17 @@ ol.inherits(ngeo.interaction.Translate, ol.interaction.Translate);
ngeo.interaction.Translate.prototype.setActive = function(active) {

if (this.keyPressListenerKey_) {
goog.events.unlistenByKey(this.keyPressListenerKey_);
ol.events.unlistenByKey(this.keyPressListenerKey_);
this.keyPressListenerKey_ = null;
}

ol.interaction.Translate.prototype.setActive.call(this, active);

if (active) {
this.keyPressListenerKey_ = goog.events.listen(
this.keyPressListenerKey_ = ol.events.listen(
document,
'keyup',
this.handleKeyUp_,
false,
this
);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ ngeo.interaction.Translate.prototype.getGeometryCenterPoint_ = function(

/**
* Deactivate this interaction if the ESC key is pressed.
* @param {goog.events.Event} evt Event.
* @param {KeyboardEvent} evt Event.
* @private
*/
ngeo.interaction.Translate.prototype.handleKeyUp_ = function(evt) {
Expand Down

0 comments on commit 1adcf37

Please sign in to comment.