Move dragThreshold definition to util/

In order to avoid multiple declarations that has to be updated in the
case of future updates.
This commit is contained in:
Samuel Mannehed
2018-08-10 11:17:58 +02:00
parent b3ac94a978
commit 3b7c47417e
3 changed files with 9 additions and 9 deletions
+1 -4
View File
@@ -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;
+6
View File
@@ -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 () {