Only disable scrollbars on Android and iOS

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
This commit is contained in:
Samuel Mannehed 2019-01-09 13:20:29 +01:00
parent 47b3eac82b
commit ef64917a90
2 changed files with 8 additions and 3 deletions

View File

@ -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 {

View 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);