Store touch coordinates as ol.Pixel instead of goog.math.Coordinate
This commit is contained in:
@@ -58,7 +58,7 @@ ol.pointer.MouseSource = function(dispatcher) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {Array.<goog.math.Coordinate>}
|
* @type {Array.<ol.Pixel>}
|
||||||
*/
|
*/
|
||||||
this.lastTouches = [];
|
this.lastTouches = [];
|
||||||
};
|
};
|
||||||
@@ -118,7 +118,7 @@ ol.pointer.MouseSource.prototype.isEventSimulatedFromTouch_ =
|
|||||||
var x = inEvent.clientX, y = inEvent.clientY;
|
var x = inEvent.clientX, y = inEvent.clientY;
|
||||||
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
|
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
|
||||||
// simulated mouse events will be swallowed near a primary touchend
|
// simulated mouse events will be swallowed near a primary touchend
|
||||||
var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
|
var dx = Math.abs(x - t[0]), dy = Math.abs(y - t[1]);
|
||||||
if (dx <= ol.pointer.MouseSource.DEDUP_DIST &&
|
if (dx <= ol.pointer.MouseSource.DEDUP_DIST &&
|
||||||
dy <= ol.pointer.MouseSource.DEDUP_DIST) {
|
dy <= ol.pointer.MouseSource.DEDUP_DIST) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
goog.provide('ol.pointer.TouchSource');
|
goog.provide('ol.pointer.TouchSource');
|
||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.math.Coordinate');
|
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
goog.require('ol.pointer.EventSource');
|
goog.require('ol.pointer.EventSource');
|
||||||
goog.require('ol.pointer.MouseSource');
|
goog.require('ol.pointer.MouseSource');
|
||||||
@@ -434,7 +433,7 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
|
|||||||
// only the primary finger will synth mouse events
|
// only the primary finger will synth mouse events
|
||||||
if (this.isPrimaryTouch_(t)) {
|
if (this.isPrimaryTouch_(t)) {
|
||||||
// remember x/y of last touch
|
// remember x/y of last touch
|
||||||
var lt = new goog.math.Coordinate(t.clientX, t.clientY);
|
var lt = /** @type {ol.Pixel} */ ([t.clientX, t.clientY]);
|
||||||
lts.push(lt);
|
lts.push(lt);
|
||||||
|
|
||||||
goog.global.setTimeout(function() {
|
goog.global.setTimeout(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user