From 85c3a9ec3590ebfbe85209a64c7e41cae9663923 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 28 Sep 2021 13:59:28 -0400
Subject: converted ink addpoints to not use sampling.  needs addPoints() to be
 filled in.

---
 src/client/util/InteractionUtils.tsx | 65 ++----------------------------------
 1 file changed, 3 insertions(+), 62 deletions(-)

(limited to 'src/client/util/InteractionUtils.tsx')

diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx
index 66afc849e..f748188d7 100644
--- a/src/client/util/InteractionUtils.tsx
+++ b/src/client/util/InteractionUtils.tsx
@@ -1,10 +1,8 @@
 import React = require("react");
 import * as beziercurve from 'bezier-curve';
 import * as fitCurve from 'fit-curve';
-import "./InteractionUtils.scss";
 import { Utils } from "../../Utils";
-import { CurrentUserUtils } from "./CurrentUserUtils";
-import { InkTool } from "../../fields/InkField";
+import "./InteractionUtils.scss";
 
 export namespace InteractionUtils {
     export const MOUSETYPE = "mouse";
@@ -93,70 +91,13 @@ export namespace InteractionUtils {
         return myTouches;
     }
 
-    export function CreatePoints(points: { X: number, Y: number }[], left: number, top: number,
-        color: string, width: number, strokeWidth: number, bezier: string, fill: string, arrowStart: string, arrowEnd: string,
-        dash: string, scalex: number, scaley: number, shape: string, pevents: string, drawHalo: boolean, nodefs: boolean) {
-        let pts: { X: number; Y: number; }[] = [];
-        if (shape) { //if any of the shape are true
-            pts = makePolygon(shape, points);
-        }
-        else if ((points.length >= 5 && points[3].X === points[4].X) || (points.length === 4)) {
-            for (var i = 0; i < points.length - 3; i += 4) {
-                const array = [[points[i].X, points[i].Y], [points[i + 1].X, points[i + 1].Y], [points[i + 2].X, points[i + 2].Y], [points[i + 3].X, points[i + 3].Y]];
-                for (var t = 0; t < 1; t += 0.01) {
-                    const point = beziercurve(t, array);
-                    pts.push({ X: point[0], Y: point[1] });
-                }
-            }
-        }
-        else if (points.length > 1 && points[points.length - 1].X === points[0].X && points[points.length - 1].Y === points[0].Y) {
-            //pointer is up (first and last points are the same)
-            const newPoints = points.reduce((p, pts) => { p.push([pts.X, pts.Y]); return p; }, [] as number[][]);
-            newPoints.pop();
-
-            const bezierCurves = fitCurve(newPoints, parseInt(bezier));
-            for (const curve of bezierCurves) {
-                for (var t = 0; t < 1; t += 0.01) {
-                    const point = beziercurve(t, curve);
-                    pts.push({ X: point[0], Y: point[1] });
-                }
-            }
-        } else {
-            pts = points.slice();
-            // bcz: Ugh... this is ugly, but shapes apprently have an extra point added that is = (p[0].x,p[0].y+1) as some sort of flag.  need to remove it here.
-            if (pts.length > 2 && pts[pts.length - 2].X === pts[0].X && pts[pts.length - 2].Y === pts[0].Y) {
-                pts.pop();
-            }
-        }
-        if (isNaN(scalex)) {
-            scalex = 1;
-        }
-        if (isNaN(scaley)) {
-            scaley = 1;
-        }
-        return pts;
-    }
-
-
-
     export function CreatePolyline(points: { X: number, Y: number }[], left: number, top: number,
         color: string, width: number, strokeWidth: number, bezier: string, fill: string, arrowStart: string, arrowEnd: string,
         dash: string | undefined, scalex: number, scaley: number, shape: string, pevents: string, opacity: number, nodefs: boolean) {
         let pts: { X: number; Y: number; }[] = [];
         if (shape) { //if any of the shape are true
-            pts = makePolygon(shape, points);
-        }
-        else if (((points.length >= 5 && points[3].X === points[4].X) || (points.length === 4)) && !bezier) {
-            for (var i = 0; i < points.length - 3; i += 4) {
-                const array = [[points[i].X, points[i].Y], [points[i + 1].X, points[i + 1].Y], [points[i + 2].X, points[i + 2].Y], [points[i + 3].X, points[i + 3].Y]];
-                for (var t = 0; t < 1; t += 0.01) {
-                    const point = beziercurve(t, array);
-                    pts.push({ X: point[0], Y: point[1] });
-                }
-            }
-        } else {
-            pts = points.slice();
-        }
+        const pts = shape ? makePolygon(shape, points) : points;
+
         if (isNaN(scalex)) scalex = 1;
         if (isNaN(scaley)) scaley = 1;
 
-- 
cgit v1.2.3-70-g09d2

