From 395fdf9bbf6f32b8b5cdd8e858f3ca1e27f52183 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 17 Mar 2014 12:25:39 +0100 Subject: [PATCH 1/5] Move function declaration out of the constructor --- src/ol/pointer/touchsource.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ol/pointer/touchsource.js b/src/ol/pointer/touchsource.js index 5960069a51..30f12db8ef 100644 --- a/src/ol/pointer/touchsource.js +++ b/src/ol/pointer/touchsource.js @@ -82,15 +82,6 @@ ol.pointer.TouchSource = function(dispatcher, mouseSource) { * @type {number|undefined} */ this.resetId_ = undefined; - - /** - * @private - * @type {function()} - */ - this.resetClickCountHandler_ = goog.bind(function() { - this.clickCount_ = 0; - this.resetId_ = undefined; - }, this); }; goog.inherits(ol.pointer.TouchSource, ol.pointer.EventSource); @@ -165,6 +156,15 @@ ol.pointer.TouchSource.prototype.resetClickCount_ = function() { }; +/** + * @private + */ +ol.pointer.TouchSource.prototype.resetClickCountHandler_ = function() { + this.clickCount_ = 0; + this.resetId_ = undefined; +}; + + /** * @private */ From a2375d58b619397a5d962e95d576e510347dbd83 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 17 Mar 2014 12:26:38 +0100 Subject: [PATCH 2/5] Store touch coordinates as ol.Pixel instead of goog.math.Coordinate --- src/ol/pointer/mousesource.js | 4 ++-- src/ol/pointer/touchsource.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ol/pointer/mousesource.js b/src/ol/pointer/mousesource.js index 1e2b41ea5a..9aa1ffa21a 100644 --- a/src/ol/pointer/mousesource.js +++ b/src/ol/pointer/mousesource.js @@ -58,7 +58,7 @@ ol.pointer.MouseSource = function(dispatcher) { /** * @const - * @type {Array.} + * @type {Array.} */ this.lastTouches = []; }; @@ -118,7 +118,7 @@ ol.pointer.MouseSource.prototype.isEventSimulatedFromTouch_ = var x = inEvent.clientX, y = inEvent.clientY; for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) { // 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 && dy <= ol.pointer.MouseSource.DEDUP_DIST) { return true; diff --git a/src/ol/pointer/touchsource.js b/src/ol/pointer/touchsource.js index 30f12db8ef..8f15677a03 100644 --- a/src/ol/pointer/touchsource.js +++ b/src/ol/pointer/touchsource.js @@ -31,7 +31,6 @@ goog.provide('ol.pointer.TouchSource'); goog.require('goog.array'); -goog.require('goog.math.Coordinate'); goog.require('goog.object'); goog.require('ol.pointer.EventSource'); goog.require('ol.pointer.MouseSource'); @@ -434,7 +433,7 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) { // only the primary finger will synth mouse events if (this.isPrimaryTouch_(t)) { // 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); goog.global.setTimeout(function() { From 6d4552c7839185d1499ce81693f6233264a342d4 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 18 Mar 2014 08:50:45 +0100 Subject: [PATCH 3/5] Cache the result of goog.object.getCount --- src/ol/pointer/touchsource.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ol/pointer/touchsource.js b/src/ol/pointer/touchsource.js index 8f15677a03..f621ef7207 100644 --- a/src/ol/pointer/touchsource.js +++ b/src/ol/pointer/touchsource.js @@ -124,10 +124,9 @@ ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) { * @private */ ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) { - if (goog.object.getCount(this.pointerMap) === 0 || - (goog.object.getCount(this.pointerMap) === 1 && - goog.object.containsKey(this.pointerMap, - ol.pointer.MouseSource.POINTER_ID.toString()))) { + var count = goog.object.getCount(this.pointerMap); + if (count === 0 || (count === 1 && goog.object.containsKey(this.pointerMap, + ol.pointer.MouseSource.POINTER_ID.toString()))) { this.firstTouchId_ = inTouch.identifier; this.cancelResetClickCount_(); } From 6af2d5ae47e5cee147fdc6a7c7a20295fb36683a Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 18 Mar 2014 13:58:22 +0100 Subject: [PATCH 4/5] Remove trailing newlines --- src/ol/interaction/pointerinteraction.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ol/interaction/pointerinteraction.js b/src/ol/interaction/pointerinteraction.js index 9ab7b705c6..4f0744b078 100644 --- a/src/ol/interaction/pointerinteraction.js +++ b/src/ol/interaction/pointerinteraction.js @@ -101,8 +101,7 @@ ol.interaction.Pointer.prototype.updateTrackedPointers_ = * @param {ol.MapBrowserPointerEvent} mapBrowserEvent Event. * @protected */ -ol.interaction.Pointer.prototype.handlePointerDrag = - goog.nullFunction; +ol.interaction.Pointer.prototype.handlePointerDrag = goog.nullFunction; /** @@ -110,8 +109,7 @@ ol.interaction.Pointer.prototype.handlePointerDrag = * @protected * @return {boolean} Capture dragging. */ -ol.interaction.Pointer.prototype.handlePointerUp = - goog.functions.FALSE; +ol.interaction.Pointer.prototype.handlePointerUp = goog.functions.FALSE; /** @@ -119,8 +117,7 @@ ol.interaction.Pointer.prototype.handlePointerUp = * @protected * @return {boolean} Capture dragging. */ -ol.interaction.Pointer.prototype.handlePointerDown = - goog.functions.FALSE; +ol.interaction.Pointer.prototype.handlePointerDown = goog.functions.FALSE; /** @@ -162,5 +159,4 @@ ol.interaction.Pointer.prototype.handleMapBrowserEvent = * @param {boolean} handled Was the event handled by the interaction? * @return {boolean} Should the event be stopped? */ -ol.interaction.Pointer.prototype.shouldStopEvent = - goog.functions.FALSE; +ol.interaction.Pointer.prototype.shouldStopEvent = goog.functions.FALSE; From 764d7aaaa4482a4864f7e7f7c6ef3bf093a1f00f Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 19 Mar 2014 09:44:25 +0100 Subject: [PATCH 5/5] Remove unused ol.pointer.PointerEvent#originalEvent --- src/ol/pointer/pointerevent.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/ol/pointer/pointerevent.js b/src/ol/pointer/pointerevent.js index 4beda58fdb..fa23619e13 100644 --- a/src/ol/pointer/pointerevent.js +++ b/src/ol/pointer/pointerevent.js @@ -59,12 +59,6 @@ ol.pointer.PointerEvent = function(type, browserEvent, opt_eventDict) { */ this.browserEvent = browserEvent; - /** - * @const - * @type {Event} - */ - this.originalEvent = browserEvent.getBrowserEvent(); - var eventDict = goog.isDef(opt_eventDict) ? opt_eventDict : {}; /**