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:
parent
b3ac94a978
commit
3b7c47417e
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* 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
|
* Copyright (C) 2016 Pierre Ossman for Cendio AB
|
||||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||||
*
|
*
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
import * as Log from '../core/util/logging.js';
|
import * as Log from '../core/util/logging.js';
|
||||||
import _, { l10n } from './localization.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 { setCapture, getPointerEvent } from '../core/util/events.js';
|
||||||
import KeyTable from "../core/input/keysym.js";
|
import KeyTable from "../core/input/keysym.js";
|
||||||
import keysyms from "../core/input/keysymdef.js";
|
import keysyms from "../core/input/keysymdef.js";
|
||||||
|
@ -594,9 +594,6 @@ const UI = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UI.controlbarDrag) {
|
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);
|
const dragDistance = Math.abs(ptr.clientY - UI.controlbarMouseDownClientY);
|
||||||
|
|
||||||
if (dragDistance < dragThreshold) return;
|
if (dragDistance < dragThreshold) return;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
import * as Log from './util/logging.js';
|
import * as Log from './util/logging.js';
|
||||||
import { decodeUTF8 } from './util/strings.js';
|
import { decodeUTF8 } from './util/strings.js';
|
||||||
|
import { dragThreshold } from './util/browser.js';
|
||||||
import EventTargetMixin from './util/eventtarget.js';
|
import EventTargetMixin from './util/eventtarget.js';
|
||||||
import Display from "./display.js";
|
import Display from "./display.js";
|
||||||
import Keyboard from "./input/keyboard.js";
|
import Keyboard from "./input/keyboard.js";
|
||||||
|
@ -785,10 +786,6 @@ export default class RFB extends EventTargetMixin {
|
||||||
const deltaX = this._viewportDragPos.x - x;
|
const deltaX = this._viewportDragPos.x - x;
|
||||||
const deltaY = this._viewportDragPos.y - y;
|
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 ||
|
if (this._viewportHasMoved || (Math.abs(deltaX) > dragThreshold ||
|
||||||
Math.abs(deltaY) > dragThreshold)) {
|
Math.abs(deltaY) > dragThreshold)) {
|
||||||
this._viewportHasMoved = true;
|
this._viewportHasMoved = true;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* noVNC: HTML5 VNC client
|
* noVNC: HTML5 VNC client
|
||||||
* Copyright (C) 2012 Joel Martin
|
* Copyright (C) 2012 Joel Martin
|
||||||
|
* Copyright (C) 2018 Samuel Mannehed for Cendio AB
|
||||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||||
*
|
*
|
||||||
* See README.md for usage and integration instructions.
|
* See README.md for usage and integration instructions.
|
||||||
|
@ -20,6 +21,11 @@ window.addEventListener('touchstart', function onFirstTouch() {
|
||||||
window.removeEventListener('touchstart', onFirstTouch, false);
|
window.removeEventListener('touchstart', onFirstTouch, false);
|
||||||
}, 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;
|
let _cursor_uris_supported = null;
|
||||||
|
|
||||||
export function supportsCursorURIs () {
|
export function supportsCursorURIs () {
|
||||||
|
|
Loading…
Reference in New Issue