aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/InteractionUtils.ts
diff options
context:
space:
mode:
authorkimdahey <claire_kim1@brown.edu>2020-01-29 16:56:33 -0500
committerkimdahey <claire_kim1@brown.edu>2020-01-29 16:56:33 -0500
commit9bf6bd83bdb136e4478c59ce69ee44fc5d0d8352 (patch)
tree2d80c38abe9aa505f484b4c2959e60543b0d1704 /src/client/util/InteractionUtils.ts
parentd1c1e9f10b8523270a872c6f67df25ebb1d9aa25 (diff)
fixes
Diffstat (limited to 'src/client/util/InteractionUtils.ts')
-rw-r--r--src/client/util/InteractionUtils.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/client/util/InteractionUtils.ts b/src/client/util/InteractionUtils.ts
index da42bdc93..8e1beecb7 100644
--- a/src/client/util/InteractionUtils.ts
+++ b/src/client/util/InteractionUtils.ts
@@ -23,7 +23,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;
@@ -46,6 +46,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) {