diff options
author | samhed <samuel@cendio.se> | 2016-05-12 16:43:19 +0200 |
---|---|---|
committer | samhed <samuel@cendio.se> | 2016-05-12 16:43:19 +0200 |
commit | f52105bc88ebd18d5cb3fba817173e99600cdc3f (patch) | |
tree | 245d316f42e429ac6a9c700a7f26bf1baa9f741d | |
parent | 057cfc7cb4dae8c0efaf31c23e6500d903842c22 (diff) | |
download | novnc-f52105bc88ebd18d5cb3fba817173e99600cdc3f.tar.gz |
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.
-rw-r--r-- | include/input.js | 5 | ||||
-rw-r--r-- | include/rfb.js | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/include/input.js b/include/input.js index 5d9e209..fa6ba44 100644 --- a/include/input.js +++ b/include/input.js @@ -212,7 +212,7 @@ var Keyboard, Mouse; // Touch device // 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 (this._doubleClickTimer === null) { this._lastTouchPos = pos; @@ -229,7 +229,8 @@ var Keyboard, Mouse; // The goal is to trigger on a certain physical width, the // 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; } } diff --git a/include/rfb.js b/include/rfb.js index 3e9344b..48fa5a8 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -617,7 +617,7 @@ var RFB; // The goal is to trigger on a certain physical width, the // 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 || Math.abs(deltaY) > dragThreshold)) { |