diff options
author | bobzel <zzzman@gmail.com> | 2021-01-28 18:06:05 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-01-28 18:06:05 -0500 |
commit | 32361454f6582155bc84c154dc9315aa794b359e (patch) | |
tree | 41fa0d329d9fcfff927f157d1e38579f8987245f /src/Utils.ts | |
parent | ecacd10cd3f70013d7112f5742eb4168e898949e (diff) |
cleaned up video/audio/stackedTimeline css. restored SpaceKey trigger to start/stop creating an anchor.
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 3cf695a30..dcfb579ca 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -600,11 +600,16 @@ export function hasDescendantTarget(x: number, y: number, target: HTMLDivElement return entered; } +export function StopEvent(e: React.PointerEvent | React.MouseEvent) { + e.stopPropagation(); + e.preventDefault(); +} + export function setupMoveUpEvents( target: object, e: React.PointerEvent, moveEvent: (e: PointerEvent, down: number[], delta: number[]) => boolean, - upEvent: (e: PointerEvent, movement: number[]) => any, + upEvent: (e: PointerEvent, movement: number[], isClick: boolean) => any, clickEvent: (e: PointerEvent, doubleTap?: boolean) => any, stopPropagation: boolean = true, stopMovePropagation: boolean = true @@ -632,8 +637,9 @@ export function setupMoveUpEvents( const _upEvent = (e: PointerEvent): void => { (target as any)._doubleTap = (Date.now() - (target as any)._lastTap < 300); (target as any)._lastTap = Date.now(); - upEvent(e, [e.clientX - (target as any)._downX, e.clientY - (target as any)._downY]); - if (Math.abs(e.clientX - (target as any)._downX) < 4 && Math.abs(e.clientY - (target as any)._downY) < 4) { + const isClick = Math.abs(e.clientX - (target as any)._downX) < 4 && Math.abs(e.clientY - (target as any)._downY) < 4; + upEvent(e, [e.clientX - (target as any)._downX, e.clientY - (target as any)._downY], isClick); + if (isClick) { if ((target as any)._doubleTime && (target as any)._doubleTap) { clearTimeout((target as any)._doubleTime); (target as any)._doubleTime = undefined; |