aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/InkControls.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/InkControls.tsx')
-rw-r--r--src/client/views/InkControls.tsx24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/client/views/InkControls.tsx b/src/client/views/InkControls.tsx
index 6213a4075..55a70ccd2 100644
--- a/src/client/views/InkControls.tsx
+++ b/src/client/views/InkControls.tsx
@@ -87,16 +87,38 @@ export class InkControls extends React.Component<InkControlProps> {
if (!formatInstance) return (null);
// Accessing the current ink's data and extracting all control points.
+ // Separate case for circle shape (?)
const data = this.props.data;
+ const [left, right, top, bottom, scaleX, scaleY, strokeWidth] = this.props.format;
+ const centerX = (Math.max(left, right) + Math.min(left, right)) / 2;
+ const centerY = (Math.max(top, bottom) + Math.min(top, bottom)) / 2;
+ const radius = Math.max(centerX - Math.min(left, right), centerY - Math.min(top, bottom));
const controlPoints: ControlPoint[] = [];
if (data.length >= 4) {
+ // const distance = Math.sqrt((Math.pow(data[0].X - centerX, 2)) + (Math.pow(data[0].Y - centerY, 2)));
+ // if (Math.abs(distance - radius) <= 2.5) {
+ // controlPoints.push({ X: data[0].X, Y: data[0].Y, I: 0 });
+ // const topPoint = formatInstance.rotatePoint(data[0], { X: centerX, Y: centerY }, Math.PI / 2);
+ // const rightPoint = formatInstance.rotatePoint(data[0], { X: centerX, Y: centerY }, Math.PI);
+ // const bottomPoint = formatInstance.rotatePoint(data[0], { X: centerX, Y: centerY }, Math.PI * 1.5);
+ // for (let i = 0; i <= data.length - 4; i += 4) {
+ // const currPoint = data[i];
+ // const isTopPoint = Math.sqrt((Math.pow(currPoint.X - topPoint.X, 2)) + (Math.pow(currPoint.Y - topPoint.Y, 2))) <= 2.5;
+ // const isRightPoint = Math.sqrt((Math.pow(currPoint.X - rightPoint.X, 2)) + (Math.pow(currPoint.Y - rightPoint.Y, 2))) <= 2.5;
+ // const isBottomPoint = Math.sqrt((Math.pow(currPoint.X - bottomPoint.X, 2)) + (Math.pow(currPoint.Y - bottomPoint.Y, 2))) <= 2.5;
+ // if (isTopPoint || isRightPoint || isBottomPoint) {
+ // controlPoints.push({ X: data[i].X, Y: data[i].Y, I: i });
+ // }
+ // }
+ // controlPoints.push({ X: data[0].X, Y: data[0].Y, I: 0 });
+ // } else {
for (let i = 0; i <= data.length - 4; i += 4) {
controlPoints.push({ X: data[i].X, Y: data[i].Y, I: i });
controlPoints.push({ X: data[i + 3].X, Y: data[i + 3].Y, I: i + 3 });
}
+ // }
}
const addedPoints = this.props.addedPoints;
- const [left, top, scaleX, scaleY, strokeWidth] = this.props.format;
return (
<>