Move DEDUP_TIMEOUT and CLICK_COUNT_TIMEOUT constants out of the instance
This commit is contained in:
committed by
tsauerwein
parent
fcb52d2361
commit
f5b15f737f
@@ -63,20 +63,6 @@ ol.pointer.TouchSource = function(dispatcher, mouseSource) {
|
|||||||
*/
|
*/
|
||||||
this.mouseSource = 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
|
* @private
|
||||||
* @type {?number}
|
* @type {?number}
|
||||||
@@ -98,6 +84,22 @@ ol.pointer.TouchSource = function(dispatcher, mouseSource) {
|
|||||||
goog.inherits(ol.pointer.TouchSource, ol.pointer.EventSource);
|
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
|
* @const
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -152,7 +154,7 @@ ol.pointer.TouchSource.prototype.resetClickCount_ = function() {
|
|||||||
this.resetId_ = null;
|
this.resetId_ = null;
|
||||||
};
|
};
|
||||||
this.resetId_ = goog.global.setTimeout(goog.bind(fn, this),
|
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) {
|
if (i > -1) {
|
||||||
lts.splice(i, 1);
|
lts.splice(i, 1);
|
||||||
}
|
}
|
||||||
}, this.DEDUP_TIMEOUT);
|
}, ol.pointer.TouchSource.DEDUP_TIMEOUT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,8 +47,7 @@ describe('ol.pointer.MouseSource', function() {
|
|||||||
|
|
||||||
it('dispatches real mouse events after timeout', function() {
|
it('dispatches real mouse events after timeout', function() {
|
||||||
// set the timeout to a lower value, to speed up the tests
|
// set the timeout to a lower value, to speed up the tests
|
||||||
var touchSource = handler.eventSourceList_[1];
|
ol.pointer.TouchSource.DEDUP_TIMEOUT = 100;
|
||||||
touchSource.DEDUP_TIMEOUT = 100;
|
|
||||||
|
|
||||||
goog.events.listen(handler, 'pointerdown', eventSpy);
|
goog.events.listen(handler, 'pointerdown', eventSpy);
|
||||||
|
|
||||||
@@ -99,3 +98,4 @@ goog.require('ol.BrowserFeature');
|
|||||||
goog.require('ol.pointer.MouseSource');
|
goog.require('ol.pointer.MouseSource');
|
||||||
goog.require('ol.pointer.PointerEvent');
|
goog.require('ol.pointer.PointerEvent');
|
||||||
goog.require('ol.pointer.PointerEventHandler');
|
goog.require('ol.pointer.PointerEventHandler');
|
||||||
|
goog.require('ol.pointer.TouchSource');
|
||||||
|
|||||||
Reference in New Issue
Block a user