Make shouldStopEvent default to the identity func

This commit is contained in:
Éric Lemoine
2014-12-15 17:28:36 +01:00
parent 1907de667a
commit 6b46d5c76a
9 changed files with 39 additions and 28 deletions

View File

@@ -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;

View File

@@ -160,3 +160,9 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
return false;
}
};
/**
* @inheritDoc
*/
ol.interaction.DragPan.prototype.shouldStopEvent = goog.functions.FALSE;

View File

@@ -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;

View File

@@ -120,3 +120,9 @@ ol.interaction.DragRotate.handleDownEvent_ = function(mapBrowserEvent) {
return false;
}
};
/**
* @inheritDoc
*/
ol.interaction.DragRotate.prototype.shouldStopEvent = goog.functions.FALSE;

View File

@@ -554,6 +554,12 @@ ol.interaction.Draw.prototype.abortDrawing_ = function() {
};
/**
* @inheritDoc
*/
ol.interaction.Draw.prototype.shouldStopEvent = goog.functions.FALSE;
/**
* Redraw the skecth features.
* @private

View File

@@ -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.

View File

@@ -161,3 +161,9 @@ ol.interaction.PinchRotate.handleDownEvent_ = function(mapBrowserEvent) {
return false;
}
};
/**
* @inheritDoc
*/
ol.interaction.PinchRotate.prototype.shouldStopEvent = goog.functions.FALSE;

View File

@@ -150,3 +150,9 @@ ol.interaction.PinchZoom.handleDownEvent_ =
return false;
}
};
/**
* @inheritDoc
*/
ol.interaction.PinchZoom.prototype.shouldStopEvent = goog.functions.FALSE;

View File

@@ -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;