aboutsummaryrefslogtreecommitdiff
path: root/src/client/util
diff options
context:
space:
mode:
authorStanley Yip <stanley_yip@brown.edu>2020-01-17 16:22:38 -0500
committerStanley Yip <stanley_yip@brown.edu>2020-01-17 16:22:38 -0500
commit3bb4d8324b6101a82122ecb31f025c2e0420df89 (patch)
tree2875e8083a1c48ce2b5b2e8c5656de0ab96cfe9a /src/client/util
parent8667498929fce14295658f89c8787a1a9b1ce468 (diff)
moving around the createPolyline function
Diffstat (limited to 'src/client/util')
-rw-r--r--src/client/util/InteractionUtils.tsx (renamed from src/client/util/InteractionUtils.ts)14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client/util/InteractionUtils.ts b/src/client/util/InteractionUtils.tsx
index 3e6d27242..1fe95474c 100644
--- a/src/client/util/InteractionUtils.ts
+++ b/src/client/util/InteractionUtils.tsx
@@ -8,6 +8,20 @@ export namespace InteractionUtils {
const REACT_POINTER_PEN_BUTTON = 0;
const ERASER_BUTTON = 5;
+ 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 class MultiTouchEvent<T extends React.TouchEvent | TouchEvent> {
constructor(
readonly fingers: number,