diff options
author | yunahi <60233430+yunahi@users.noreply.github.com> | 2020-07-19 04:44:51 +0900 |
---|---|---|
committer | yunahi <60233430+yunahi@users.noreply.github.com> | 2020-07-19 04:44:51 +0900 |
commit | 53713fc7ab10257d1117193941cda2f3e0cabcf5 (patch) | |
tree | 01269e78f3ec8679f2f2f665dc158731697407e2 /src/client/util/InteractionUtils.tsx | |
parent | fcc7d375deb197854367ec40691fe0e72fba74f5 (diff) |
added control points
Diffstat (limited to 'src/client/util/InteractionUtils.tsx')
-rw-r--r-- | src/client/util/InteractionUtils.tsx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client/util/InteractionUtils.tsx b/src/client/util/InteractionUtils.tsx index 07adbb8b1..1d7655748 100644 --- a/src/client/util/InteractionUtils.tsx +++ b/src/client/util/InteractionUtils.tsx @@ -99,6 +99,15 @@ export namespace InteractionUtils { if (shape) { //if any of the shape are true pts = makePolygon(shape, points); } + else if (points.length > 9 && points[3].X === points[4].X && points[7].X === points[8].X) { + for (var i = 0; i < points.length; 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[][]); |