diff options
| author | andrewdkim <adkim414@gmail.com> | 2020-02-08 13:15:21 -0500 |
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2020-02-08 13:15:21 -0500 |
| commit | 77a6a04d6f4b84988ebddb6be34e41da5ca84cdd (patch) | |
| tree | 1028c04d41854617d3849a882b3f0245b1844c57 /src/client/util | |
| parent | a943eec770eb32543d4847466b718739911a49a1 (diff) | |
| parent | 962cfebaa2e15ac48aa969afc50c5913573623df (diff) | |
Merge branch 'radial_menu_fixes' into pen
Diffstat (limited to 'src/client/util')
| -rw-r--r-- | src/client/util/InteractionUtils.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx index 7194feb2e..8fc5e8098 100644 --- a/src/client/util/InteractionUtils.tsx +++ b/src/client/util/InteractionUtils.tsx @@ -37,7 +37,7 @@ export namespace InteractionUtils { export function MakeMultiTouchTarget( element: HTMLElement, - startFunc: (e: Event, me: MultiTouchEvent<React.TouchEvent>) => void, + startFunc: (e: Event, me: MultiTouchEvent<React.TouchEvent>) => void ): MultiTouchEventDisposer { const onMultiTouchStartHandler = (e: Event) => startFunc(e, (e as CustomEvent<MultiTouchEvent<React.TouchEvent>>).detail); // const onMultiTouchMoveHandler = moveFunc ? (e: Event) => moveFunc(e, (e as CustomEvent<MultiTouchEvent<TouchEvent>>).detail) : undefined; @@ -60,6 +60,17 @@ export namespace InteractionUtils { }; } + export function MakeHoldTouchTarget( + element: HTMLElement, + func: (e: Event, me: MultiTouchEvent<React.TouchEvent>) => void + ): MultiTouchEventDisposer { + const handler = (e: Event) => func(e, (e as CustomEvent<MultiTouchEvent<React.TouchEvent>>).detail); + element.addEventListener("dashOnTouchHoldStart", handler); + return () => { + element.removeEventListener("dashOnTouchHoldStart", handler); + }; + } + export function GetMyTargetTouches(mte: InteractionUtils.MultiTouchEvent<React.TouchEvent | TouchEvent>, prevPoints: Map<number, React.Touch>, ignorePen: boolean): React.Touch[] { const myTouches = new Array<React.Touch>(); for (const pt of mte.touches) { |
