Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/helper/selection-tools/reshape-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
10 changes: 6 additions & 4 deletions src/helper/tools/triangle-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/triangle-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading