Add fallback value for devicePixelRatio
In IE 10 for example, devicePixelRatio doesn't exist which caused the code to fail by setting the thresholds to zero.
This commit is contained in:
parent
057cfc7cb4
commit
f52105bc88
|
@ -212,7 +212,7 @@ var Keyboard, Mouse;
|
||||||
// Touch device
|
// Touch device
|
||||||
|
|
||||||
// When two touches occur within 500 ms of each other and are
|
// When two touches occur within 500 ms of each other and are
|
||||||
// closer than 20 pixels together a double click is triggered.
|
// close enough together a double click is triggered.
|
||||||
if (down == 1) {
|
if (down == 1) {
|
||||||
if (this._doubleClickTimer === null) {
|
if (this._doubleClickTimer === null) {
|
||||||
this._lastTouchPos = pos;
|
this._lastTouchPos = pos;
|
||||||
|
@ -229,7 +229,8 @@ var Keyboard, Mouse;
|
||||||
|
|
||||||
// The goal is to trigger on a certain physical width, the
|
// The goal is to trigger on a certain physical width, the
|
||||||
// devicePixelRatio brings us a bit closer but is not optimal.
|
// devicePixelRatio brings us a bit closer but is not optimal.
|
||||||
if (d < 20 * window.devicePixelRatio) {
|
var threshold = 20 * (window.devicePixelRatio || 1);
|
||||||
|
if (d < threshold) {
|
||||||
pos = this._lastTouchPos;
|
pos = this._lastTouchPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -617,7 +617,7 @@ var RFB;
|
||||||
|
|
||||||
// The goal is to trigger on a certain physical width, the
|
// The goal is to trigger on a certain physical width, the
|
||||||
// devicePixelRatio brings us a bit closer but is not optimal.
|
// devicePixelRatio brings us a bit closer but is not optimal.
|
||||||
var dragThreshold = 10 * window.devicePixelRatio;
|
var dragThreshold = 10 * (window.devicePixelRatio || 1);
|
||||||
|
|
||||||
if (this._viewportHasMoved || (Math.abs(deltaX) > dragThreshold ||
|
if (this._viewportHasMoved || (Math.abs(deltaX) > dragThreshold ||
|
||||||
Math.abs(deltaY) > dragThreshold)) {
|
Math.abs(deltaY) > dragThreshold)) {
|
||||||
|
|
Loading…
Reference in New Issue