Move DEDUP_TIMEOUT and CLICK_COUNT_TIMEOUT constants out of the instance

This commit is contained in:
Frederic Junod
2014-03-12 11:47:42 +01:00
committed by tsauerwein
parent fcb52d2361
commit f5b15f737f
2 changed files with 20 additions and 18 deletions

View File

@@ -63,20 +63,6 @@ ol.pointer.TouchSource = function(dispatcher, mouseSource) {
*/
this.mouseSource = mouseSource;
/**
* Mouse event timeout: This should be long enough to
* ignore compat mouse events made by touch.
* @const
* @type {number}
*/
this.DEDUP_TIMEOUT = 2500;
/**
* @const
* @type {number}
*/
this.CLICK_COUNT_TIMEOUT = 200;
/**
* @private
* @type {?number}
@@ -98,6 +84,22 @@ ol.pointer.TouchSource = function(dispatcher, mouseSource) {
goog.inherits(ol.pointer.TouchSource, ol.pointer.EventSource);
/**
* Mouse event timeout: This should be long enough to
* ignore compat mouse events made by touch.
* @const
* @type {number}
*/
ol.pointer.TouchSource.DEDUP_TIMEOUT = 2500;
/**
* @const
* @type {number}
*/
ol.pointer.TouchSource.CLICK_COUNT_TIMEOUT = 200;
/**
* @const
* @type {string}
@@ -152,7 +154,7 @@ ol.pointer.TouchSource.prototype.resetClickCount_ = function() {
this.resetId_ = null;
};
this.resetId_ = goog.global.setTimeout(goog.bind(fn, this),
this.CLICK_COUNT_TIMEOUT);
ol.pointer.TouchSource.CLICK_COUNT_TIMEOUT);
};
@@ -444,6 +446,6 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
if (i > -1) {
lts.splice(i, 1);
}
}, this.DEDUP_TIMEOUT);
}, ol.pointer.TouchSource.DEDUP_TIMEOUT);
}
};

View File

@@ -47,8 +47,7 @@ describe('ol.pointer.MouseSource', function() {
it('dispatches real mouse events after timeout', function() {
// set the timeout to a lower value, to speed up the tests
var touchSource = handler.eventSourceList_[1];
touchSource.DEDUP_TIMEOUT = 100;
ol.pointer.TouchSource.DEDUP_TIMEOUT = 100;
goog.events.listen(handler, 'pointerdown', eventSpy);
@@ -99,3 +98,4 @@ goog.require('ol.BrowserFeature');
goog.require('ol.pointer.MouseSource');
goog.require('ol.pointer.PointerEvent');
goog.require('ol.pointer.PointerEventHandler');
goog.require('ol.pointer.TouchSource');