diff options
author | Samuel Mannehed <samuel@cendio.se> | 2019-01-09 13:20:29 +0100 |
---|---|---|
committer | Samuel Mannehed <samuel@cendio.se> | 2019-01-09 14:59:22 +0100 |
commit | ef64917a9091a9a12e8245099d6b0b0fbac2f6e5 (patch) | |
tree | ec017eaeab6b69aaaf5f6ed2efc433f8c9214b22 | |
parent | 47b3eac82bb01518a39a7c69d0e409b3d2812aa1 (diff) | |
download | novnc-scrollbarsfortouch.tar.gz |
Only disable scrollbars on Android and iOSscrollbarsfortouch
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
-rw-r--r-- | app/ui.js | 7 | ||||
-rw-r--r-- | core/util/browser.js | 4 |
2 files changed, 8 insertions, 3 deletions
@@ -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 { diff --git a/core/util/browser.js b/core/util/browser.js index 088997b..026a31a 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -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); |