From 6b46d5c76ae7fc00c6a6801cf8cf19cb25bbbdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Mon, 15 Dec 2014 17:28:36 +0100 Subject: [PATCH] Make shouldStopEvent default to the identity func --- src/ol/interaction/dragboxinteraction.js | 7 ------- src/ol/interaction/dragpaninteraction.js | 6 ++++++ src/ol/interaction/dragrotateandzoominteraction.js | 10 ---------- src/ol/interaction/dragrotateinteraction.js | 6 ++++++ src/ol/interaction/drawinteraction.js | 6 ++++++ src/ol/interaction/modifyinteraction.js | 6 ------ src/ol/interaction/pinchrotateinteraction.js | 6 ++++++ src/ol/interaction/pinchzoominteraction.js | 6 ++++++ src/ol/interaction/pointerinteraction.js | 14 +++++++++----- 9 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/ol/interaction/dragboxinteraction.js b/src/ol/interaction/dragboxinteraction.js index 18acb901c2..9438dca7dc 100644 --- a/src/ol/interaction/dragboxinteraction.js +++ b/src/ol/interaction/dragboxinteraction.js @@ -3,7 +3,6 @@ goog.provide('ol.DragBoxEvent'); goog.provide('ol.interaction.DragBox'); goog.require('goog.events.Event'); -goog.require('goog.functions'); goog.require('ol'); goog.require('ol.events.ConditionType'); goog.require('ol.events.condition'); @@ -205,9 +204,3 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) { return false; } }; - - -/** - * @inheritDoc - */ -ol.interaction.DragBox.prototype.shouldStopEvent = goog.functions.identity; diff --git a/src/ol/interaction/dragpaninteraction.js b/src/ol/interaction/dragpaninteraction.js index 674f5188a7..22b207eef1 100644 --- a/src/ol/interaction/dragpaninteraction.js +++ b/src/ol/interaction/dragpaninteraction.js @@ -160,3 +160,9 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) { return false; } }; + + +/** + * @inheritDoc + */ +ol.interaction.DragPan.prototype.shouldStopEvent = goog.functions.FALSE; diff --git a/src/ol/interaction/dragrotateandzoominteraction.js b/src/ol/interaction/dragrotateandzoominteraction.js index b34ba83fde..a39d5e0094 100644 --- a/src/ol/interaction/dragrotateandzoominteraction.js +++ b/src/ol/interaction/dragrotateandzoominteraction.js @@ -1,7 +1,6 @@ goog.provide('ol.interaction.DragRotateAndZoom'); goog.require('goog.asserts'); -goog.require('goog.functions'); goog.require('goog.math.Vec2'); goog.require('ol'); goog.require('ol.ViewHint'); @@ -150,12 +149,3 @@ ol.interaction.DragRotateAndZoom.handleDownEvent_ = function(mapBrowserEvent) { return false; } }; - - -/** - * @inheritDoc - * Stop the event if it was handled, so that interaction `DragZoom` - * does not interfere. - */ -ol.interaction.DragRotateAndZoom.prototype.shouldStopEvent = - goog.functions.identity; diff --git a/src/ol/interaction/dragrotateinteraction.js b/src/ol/interaction/dragrotateinteraction.js index 5929587a41..d7e3a73884 100644 --- a/src/ol/interaction/dragrotateinteraction.js +++ b/src/ol/interaction/dragrotateinteraction.js @@ -120,3 +120,9 @@ ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) { return false; } }; + + +/** + * @inheritDoc + */ +ol.interaction.DragRotate.prototype.shouldStopEvent = goog.functions.FALSE; diff --git a/src/ol/interaction/drawinteraction.js b/src/ol/interaction/drawinteraction.js index cd14567210..352985e781 100644 --- a/src/ol/interaction/drawinteraction.js +++ b/src/ol/interaction/drawinteraction.js @@ -554,6 +554,12 @@ ol.interaction.Draw.prototype.abortDrawing_ = function() { }; +/** + * @inheritDoc + */ +ol.interaction.Draw.prototype.shouldStopEvent = goog.functions.FALSE; + + /** * Redraw the skecth features. * @private diff --git a/src/ol/interaction/modifyinteraction.js b/src/ol/interaction/modifyinteraction.js index c085b0e5a6..8446a7b6ca 100644 --- a/src/ol/interaction/modifyinteraction.js +++ b/src/ol/interaction/modifyinteraction.js @@ -760,12 +760,6 @@ ol.interaction.Modify.prototype.removeVertex_ = function() { }; -/** - * @inheritDoc - */ -ol.interaction.Modify.prototype.shouldStopEvent = goog.functions.identity; - - /** * @param {ol.geom.SimpleGeometry} geometry Geometry. * @param {number} index Index. diff --git a/src/ol/interaction/pinchrotateinteraction.js b/src/ol/interaction/pinchrotateinteraction.js index 78eaedb234..e1aa2fc806 100644 --- a/src/ol/interaction/pinchrotateinteraction.js +++ b/src/ol/interaction/pinchrotateinteraction.js @@ -161,3 +161,9 @@ ol.interaction.PinchRotate.handleDownEvent_ = function(mapBrowserEvent) { return false; } }; + + +/** + * @inheritDoc + */ +ol.interaction.PinchRotate.prototype.shouldStopEvent = goog.functions.FALSE; diff --git a/src/ol/interaction/pinchzoominteraction.js b/src/ol/interaction/pinchzoominteraction.js index 1f529b717a..dbe9fff841 100644 --- a/src/ol/interaction/pinchzoominteraction.js +++ b/src/ol/interaction/pinchzoominteraction.js @@ -150,3 +150,9 @@ ol.interaction.PinchZoom.handleDownEvent_ = return false; } }; + + +/** + * @inheritDoc + */ +ol.interaction.PinchZoom.prototype.shouldStopEvent = goog.functions.FALSE; diff --git a/src/ol/interaction/pointerinteraction.js b/src/ol/interaction/pointerinteraction.js index 5e47a81e13..ba730b2807 100644 --- a/src/ol/interaction/pointerinteraction.js +++ b/src/ol/interaction/pointerinteraction.js @@ -206,12 +206,16 @@ ol.interaction.Pointer.handleEvent = function(mapBrowserEvent) { /** - * This method allows inheriting classes to stop the event from being - * passed to further interactions. For example, this is required for - * interaction `DragRotateAndZoom`. + * This method is used to determine if "down" events should be propagated to + * other interactions or should be stopped. + * + * The method receives the return code of the "handleDownEvent" function. + * + * By default this function is the "identity" function. It's overidden in + * child classes. * - * @protected * @param {boolean} handled Was the event handled by the interaction? * @return {boolean} Should the event be stopped? + * @protected */ -ol.interaction.Pointer.prototype.shouldStopEvent = goog.functions.FALSE; +ol.interaction.Pointer.prototype.shouldStopEvent = goog.functions.identity;