diff options
author | bobzel <zzzman@gmail.com> | 2023-03-28 14:23:17 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-03-28 14:23:17 -0400 |
commit | dabac69d26c8e8e69bd55466ce221d9e33e36638 (patch) | |
tree | a24bd5fdc95fee17f5d654d79c0a28a6c0a696a8 /src/Utils.ts | |
parent | 6ea3d7bb225b4f05ff83eba9428e865690e24f8a (diff) |
numerous changes to try to simplify event handling in DocumentView - got rid of isContentActive in DocComponent since it's in DocumentView. Including adding 'enableDragWhenActive' , 'onClickScriptDisable',
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index ae1478943..0c7deaf5d 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -8,8 +8,12 @@ import { Message } from './server/Message'; import Color = require('color'); export namespace Utils { + export let CLICK_TIME = 300; export let DRAG_THRESHOLD = 4; export let SNAP_THRESHOLD = 10; + export function isClick(x: number, y: number, downX: number, downY: number, downTime: number) { + return Date.now() - downTime < Utils.CLICK_TIME && Math.abs(x - downX) < Utils.DRAG_THRESHOLD && Math.abs(y - downY) < Utils.DRAG_THRESHOLD; + } export function readUploadedFileAsText(inputFile: File) { const temporaryFileReader = new FileReader(); @@ -509,11 +513,22 @@ export function returnTrue() { return true; } +export function returnAlways(): 'always' { + return 'always'; +} +export function returnNever(): 'never' { + return 'never'; +} + +export function returnDefault(): 'default' { + return 'default'; +} + export function returnFalse() { return false; } -export function returnAll() { +export function returnAll(): 'all' { return 'all'; } |