Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reshape curves #1142

Merged
merged 6 commits into from
Jul 28, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/helper/selection-tools/reshape-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,21 +133,21 @@ class ReshapeTool extends paper.Tool {
return hitOptions;
}
/**
* Returns the hit options for strokes and curves of selected objects, which take precedence over
* Returns the hit options for curves of selected objects, which take precedence over
* unselected things and fills.
* @return {object} See paper.Item.hitTest for definition of options
*/
getSelectedStrokeHitOptions () {
const hitOptions = {
segments: false,
stroke: true,
stroke: false,
curves: true,
handles: false,
fill: false,
guide: false,
tolerance: ReshapeTool.TOLERANCE / paper.view.zoom,
match: hitResult => {
if (hitResult.type !== 'stroke' || hitResult.type !== 'curve') return false;
if (hitResult.type !== 'curve') return false;
if (!hitResult.item.selected) return false;
if (hitResult.item.data && hitResult.item.data.noHover) return false;
return true;
Expand Down Expand Up @@ -246,17 +246,17 @@ class ReshapeTool extends paper.Tool {
};

// If item is not yet selected, don't behave differently depending on if they clicked a segment
// or stroke (since those were invisible), just select the whole thing as if they clicked the fill.
// (since those were invisible), just select the whole thing as if they clicked the fill.
if (!hitResult.item.selected ||
hitResult.type === 'fill' ||
hitResult.type === 'stroke' ||
(hitResult.type !== 'segment' && doubleClicked)) {
this.mode = ReshapeModes.FILL;
this._modeMap[this.mode].onMouseDown(hitProperties);
} else if (hitResult.type === 'segment') {
this.mode = ReshapeModes.POINT;
this._modeMap[this.mode].onMouseDown(hitProperties);
} else if (
hitResult.type === 'stroke' ||
hitResult.type === 'curve') {
this.mode = ReshapeModes.POINT;
this._modeMap[this.mode].addPoint(hitProperties);
Expand Down