From feeb6fd8652eb0d54fc03320ca1c073b1ac779f3 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 31 May 2025 03:49:10 -0400 Subject: [PATCH 1/3] multiply handles when doing inset / outset --- src/helper/selection-tools/reshape-tool.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/helper/selection-tools/reshape-tool.js b/src/helper/selection-tools/reshape-tool.js index e07932a35e..c2ebc35042 100644 --- a/src/helper/selection-tools/reshape-tool.js +++ b/src/helper/selection-tools/reshape-tool.js @@ -331,6 +331,7 @@ class ReshapeTool extends paper.Tool { } else if (event.key == 'i' || event.key == 'o') { const segments = getSelectedSegments(); + let lenOld = segments[0].path.length; for (const seg of segments) { let parent = seg.path; let p = seg.point; @@ -344,6 +345,12 @@ class ReshapeTool extends paper.Tool { seg.point = p.subtract(n); } } + let lenNew = segments[0].path.length; + + for (const seg of segments) { + seg.handleIn = seg.handleIn.multiply(lenNew / lenOld); + seg.handleOut = seg.handleOut.multiply(lenNew / lenOld); + } } if (translation) { From 324ee55cff0783332ff8a4fb3f4f27b8284adb4a Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sat, 31 May 2025 05:35:55 -0400 Subject: [PATCH 2/3] fix the spoke ratio transitoning --- src/helper/tools/triangle-tool.js | 10 ++++++---- src/reducers/triangle-mode.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/helper/tools/triangle-tool.js b/src/helper/tools/triangle-tool.js index 313d21e744..0675a3c172 100644 --- a/src/helper/tools/triangle-tool.js +++ b/src/helper/tools/triangle-tool.js @@ -88,8 +88,10 @@ class TriangleTool extends paper.Tool { let angle = (i / this.sideCount) * Math.PI * 2; let angleIn = angle + (1 / this.sideCount) * Math.PI; - segs.push(new paper.Point(Math.sin(angle) * 50, -Math.cos(angle) * 50)) - if (this.pointCount !== 1) { + if (this.pointCount !== 2) { + segs.push(new paper.Point(Math.sin(angle) * 50, -Math.cos(angle) * 50)) + } + if (this.pointCount !== 0.5) { segs.push(new paper.Point(Math.sin(angleIn) * 50 * this.pointCount, -Math.cos(angleIn) * 50 * this.pointCount)); } } @@ -100,7 +102,7 @@ class TriangleTool extends paper.Tool { // if editing a tri, update the curves const oldTri = paper.project.selectedItems[0]; if (oldTri) { - const path = new paper.Path({segments: this.calculateSegments(), closed: true}); + const path = new paper.Path({ segments: this.calculateSegments(), closed: true }); path.bounds = oldTri.bounds; oldTri.segments = path.segments; oldTri.closed = true; @@ -139,7 +141,7 @@ class TriangleTool extends paper.Tool { bounds.size = squareDimensions.size.abs(); } - this.tri = new paper.Path({segments: this.calculateSegments(), closed: true}); + this.tri = new paper.Path({ segments: this.calculateSegments(), closed: true }); this.tri.bounds = bounds; if (event.modifiers.alt) { this.tri.position = event.downPoint; diff --git a/src/reducers/triangle-mode.js b/src/reducers/triangle-mode.js index 77bcfa47bf..9657da03ba 100644 --- a/src/reducers/triangle-mode.js +++ b/src/reducers/triangle-mode.js @@ -2,7 +2,7 @@ import log from '../log/log'; const CHANGE_TRIANGLE_SIDE_COUNT = 'scratch-paint/triangle-mode/CHANGE_TRIANGLE_SIDE_COUNT'; const CHANGE_TRIANGLE_POINT_COUNT = 'scratch-paint/triangle-mode/CHANGE_TRIANGLE_POINT_COUNT'; -const initialState = { trianglePolyCount: 3, trianglePointCount: 1 }; +const initialState = { trianglePolyCount: 3, trianglePointCount: 0.5 }; const reducer = function (state, action) { if (typeof state === 'undefined') state = initialState; From 85e08c80d332ddcafff448b451710903e5985581 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Sun, 1 Jun 2025 05:48:39 -0400 Subject: [PATCH 3/3] just remove this completely --- src/helper/tools/triangle-tool.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/helper/tools/triangle-tool.js b/src/helper/tools/triangle-tool.js index 0675a3c172..bff8db7dd6 100644 --- a/src/helper/tools/triangle-tool.js +++ b/src/helper/tools/triangle-tool.js @@ -87,13 +87,8 @@ class TriangleTool extends paper.Tool { for (let i = 0; i < this.sideCount; i++) { let angle = (i / this.sideCount) * Math.PI * 2; let angleIn = angle + (1 / this.sideCount) * Math.PI; - - if (this.pointCount !== 2) { - segs.push(new paper.Point(Math.sin(angle) * 50, -Math.cos(angle) * 50)) - } - if (this.pointCount !== 0.5) { - segs.push(new paper.Point(Math.sin(angleIn) * 50 * this.pointCount, -Math.cos(angleIn) * 50 * this.pointCount)); - } + segs.push(new paper.Point(Math.sin(angle) * 50, -Math.cos(angle) * 50)) + segs.push(new paper.Point(Math.sin(angleIn) * 50 * this.pointCount, -Math.cos(angleIn) * 50 * this.pointCount)); } return segs;