introduce type POINTERDRAG to make a distinction between pointer move and drag
This commit is contained in:
@@ -55,7 +55,7 @@ goog.inherits(ol.interaction.Pan, ol.interaction.PointerInteraction);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.Pan.prototype.handlePointerMove = function(mapBrowserEvent) {
|
||||
ol.interaction.Pan.prototype.handlePointerDrag = function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetTouches.length >= 1);
|
||||
var centroid = ol.interaction.PointerInteraction.centroid(this.targetTouches);
|
||||
if (!goog.isNull(this.lastCentroid)) {
|
||||
|
||||
@@ -60,15 +60,15 @@ ol.interaction.PointerInteraction.centroid = function(touches) {
|
||||
|
||||
/**
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||
* @return {boolean} Whether the event is a touchstart, touchmove
|
||||
* or touchend event.
|
||||
* @return {boolean} Whether the event is a pointerdown, pointerdrag
|
||||
* or pointerup event.
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.PointerInteraction.isTouchEvent_ = function(mapBrowserEvent) {
|
||||
var type = mapBrowserEvent.type;
|
||||
return (
|
||||
type === ol.MapBrowserEvent.EventType.POINTERDOWN ||
|
||||
type === ol.MapBrowserEvent.EventType.POINTERMOVE ||
|
||||
type === ol.MapBrowserEvent.EventType.POINTERDRAG ||
|
||||
type === ol.MapBrowserEvent.EventType.POINTERUP);
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ ol.interaction.PointerInteraction.prototype.updateTrackedTouches_ =
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Event.
|
||||
* @protected
|
||||
*/
|
||||
ol.interaction.PointerInteraction.prototype.handlePointerMove =
|
||||
ol.interaction.PointerInteraction.prototype.handlePointerDrag =
|
||||
goog.nullFunction;
|
||||
|
||||
|
||||
@@ -130,8 +130,8 @@ ol.interaction.PointerInteraction.prototype.handleMapBrowserEvent =
|
||||
var view = mapBrowserEvent.map.getView();
|
||||
this.updateTrackedTouches_(mapBrowserEvent);
|
||||
if (this.handled_) {
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE) {
|
||||
this.handlePointerMove(mapBrowserEvent);
|
||||
if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
||||
this.handlePointerDrag(mapBrowserEvent);
|
||||
} else if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERUP) {
|
||||
this.handled_ = this.handlePointerUp(mapBrowserEvent);
|
||||
if (!this.handled_) {
|
||||
|
||||
@@ -67,7 +67,7 @@ goog.inherits(ol.interaction.Rotate, ol.interaction.PointerInteraction);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.Rotate.prototype.handlePointerMove =
|
||||
ol.interaction.Rotate.prototype.handlePointerDrag =
|
||||
function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetTouches.length >= 2);
|
||||
var rotationDelta = 0.0;
|
||||
|
||||
@@ -55,7 +55,7 @@ goog.inherits(ol.interaction.Zoom, ol.interaction.PointerInteraction);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.interaction.Zoom.prototype.handlePointerMove =
|
||||
ol.interaction.Zoom.prototype.handlePointerDrag =
|
||||
function(mapBrowserEvent) {
|
||||
goog.asserts.assert(this.targetTouches.length >= 2);
|
||||
var scaleDelta = 1.0;
|
||||
|
||||
Reference in New Issue
Block a user