]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Only disable scrollbars on Android and iOS
authorSamuel Mannehed <samuel@cendio.se>
Wed, 9 Jan 2019 12:20:29 +0000 (13:20 +0100)
committerSamuel Mannehed <samuel@cendio.se>
Wed, 9 Jan 2019 13:59:22 +0000 (14:59 +0100)
Previously scrollbars were disabled on all touch devices. This meant
that they were disabled on Windows when touch was detected. Windows does
in fact have useful scrollbars even in touch mode. Fixes Issue #1172

app/ui.js
core/util/browser.js

index 4e4aec79ab6a511e1d733b9fa78b0a17d0533e14..a045bca6399172d6e7fd7959c0c44c3f5389a2cd 100644 (file)
--- a/app/ui.js
+++ b/app/ui.js
@@ -8,7 +8,8 @@
 
 import * as Log from '../core/util/logging.js';
 import _, { l10n } from './localization.js';
-import { isTouchDevice, isSafari, dragThreshold } from '../core/util/browser.js';
+import { isTouchDevice, isSafari, isIOS, isAndroid, dragThreshold }
+    from '../core/util/browser.js';
 import { setCapture, getPointerEvent } from '../core/util/events.js';
 import KeyTable from "../core/input/keysym.js";
 import keysyms from "../core/input/keysymdef.js";
@@ -1243,8 +1244,8 @@ const UI = {
             // Can't be clipping if viewport is scaled to fit
             UI.forceSetting('view_clip', false);
             UI.rfb.clipViewport  = false;
-        } else if (isTouchDevice) {
-            // Touch devices usually have shit scrollbars
+        } else if (isIOS() || isAndroid()) {
+            // iOS and Android usually have shit scrollbars
             UI.forceSetting('view_clip', true);
             UI.rfb.clipViewport = true;
         } else {
index 088997b12a839617b182cb9052a530326ce2bd0b..026a31ab8d28f60427b70f3ee09e56b37152867c 100644 (file)
@@ -64,6 +64,10 @@ export function isIOS() {
             !!(/ipod/i).exec(navigator.platform));
 }
 
+export function isAndroid() {
+    return navigator && !!(/android/i).exec(navigator.userAgent);
+}
+
 export function isSafari() {
     return navigator && (navigator.userAgent.indexOf('Safari') !== -1 &&
                          navigator.userAgent.indexOf('Chrome') === -1);