diff options
author | Stanley Yip <stanley_yip@brown.edu> | 2020-02-12 21:54:58 -0500 |
---|---|---|
committer | Stanley Yip <stanley_yip@brown.edu> | 2020-02-12 21:54:58 -0500 |
commit | a8b19e82d8c9a8350609e64e60848dbfbbbb6dcd (patch) | |
tree | 35d1e015a4b6f4913f162faec50c79c36e402350 /src/client/util/InteractionUtils.tsx | |
parent | 33d5a12af14e1ed50e5c3164b363fbbc253506a0 (diff) | |
parent | 864cba561db8e26240b093da7ab524e76c8823d1 (diff) |
merge
Diffstat (limited to 'src/client/util/InteractionUtils.tsx')
-rw-r--r-- | src/client/util/InteractionUtils.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx index 184e37ba5..cf51b8e89 100644 --- a/src/client/util/InteractionUtils.tsx +++ b/src/client/util/InteractionUtils.tsx @@ -1,3 +1,5 @@ +import React = require("react"); + export namespace InteractionUtils { export const MOUSETYPE = "mouse"; export const TOUCHTYPE = "touch"; @@ -90,6 +92,21 @@ export namespace InteractionUtils { return myTouches; } + // TODO: find a way to reference this function from InkingStroke instead of copy pastign here. copied bc of weird error when on mobile view + export function CreatePolyline(points: { X: number, Y: number }[], left: number, top: number, color: string, width: number) { + const pts = points.reduce((acc: string, pt: { X: number, Y: number }) => acc + `${pt.X - left},${pt.Y - top} `, ""); + return ( + <polyline + points={pts} + style={{ + fill: "none", + stroke: color, + strokeWidth: width + }} + /> + ); + } + export function IsType(e: PointerEvent | React.PointerEvent, type: string): boolean { console.log(e.button); switch (type) { |