diff --git a/app/ui.js b/app/ui.js index 4fe2a3fb..83c2161f 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1,7 +1,7 @@ /* * noVNC: HTML5 VNC client * Copyright (C) 2012 Joel Martin - * Copyright (C) 2016 Samuel Mannehed for Cendio AB + * Copyright (C) 2018 Samuel Mannehed for Cendio AB * Copyright (C) 2016 Pierre Ossman for Cendio AB * Licensed under MPL 2.0 (see LICENSE.txt) * @@ -10,7 +10,7 @@ import * as Log from '../core/util/logging.js'; import _, { l10n } from './localization.js'; -import { isTouchDevice } from '../core/util/browser.js'; +import { isTouchDevice, 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"; @@ -594,9 +594,6 @@ const UI = { } if (!UI.controlbarDrag) { - // The goal is to trigger on a certain physical width, the - // devicePixelRatio brings us a bit closer but is not optimal. - const dragThreshold = 10 * (window.devicePixelRatio || 1); const dragDistance = Math.abs(ptr.clientY - UI.controlbarMouseDownClientY); if (dragDistance < dragThreshold) return; diff --git a/core/rfb.js b/core/rfb.js index 34330302..0276f167 100644 --- a/core/rfb.js +++ b/core/rfb.js @@ -12,6 +12,7 @@ import * as Log from './util/logging.js'; import { decodeUTF8 } from './util/strings.js'; +import { dragThreshold } from './util/browser.js'; import EventTargetMixin from './util/eventtarget.js'; import Display from "./display.js"; import Keyboard from "./input/keyboard.js"; @@ -785,10 +786,6 @@ export default class RFB extends EventTargetMixin { const deltaX = this._viewportDragPos.x - x; const deltaY = this._viewportDragPos.y - y; - // The goal is to trigger on a certain physical width, the - // devicePixelRatio brings us a bit closer but is not optimal. - const dragThreshold = 10 * (window.devicePixelRatio || 1); - if (this._viewportHasMoved || (Math.abs(deltaX) > dragThreshold || Math.abs(deltaY) > dragThreshold)) { this._viewportHasMoved = true; diff --git a/core/util/browser.js b/core/util/browser.js index 80551d40..3eca5bc0 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -1,6 +1,7 @@ /* * noVNC: HTML5 VNC client * Copyright (C) 2012 Joel Martin + * Copyright (C) 2018 Samuel Mannehed for Cendio AB * Licensed under MPL 2.0 (see LICENSE.txt) * * See README.md for usage and integration instructions. @@ -20,6 +21,11 @@ window.addEventListener('touchstart', function onFirstTouch() { window.removeEventListener('touchstart', onFirstTouch, false); }, false); + +// The goal is to find a certain physical width, the devicePixelRatio +// brings us a bit closer but is not optimal. +export let dragThreshold = 10 * (window.devicePixelRatio || 1); + let _cursor_uris_supported = null; export function supportsCursorURIs () {