From 69666f3b8a4d921d4e832b0abb822d16880d9db2 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Tue, 1 Aug 2017 11:21:26 -0400 Subject: [PATCH] smooth the motion of large brushes --- src/tools/broad-brush-helper.js | 4 ++-- src/tools/segment-brush-helper.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/broad-brush-helper.js b/src/tools/broad-brush-helper.js index 718d5a4c..92887833 100644 --- a/src/tools/broad-brush-helper.js +++ b/src/tools/broad-brush-helper.js @@ -17,7 +17,7 @@ const broadBrushHelper = function (tool) { let finalPath; tool.onBroadMouseDown = function (event) { - tool.minDistance = this.options.brushSize / 4; + tool.minDistance = 1; tool.maxDistance = this.options.brushSize; if (event.event.button > 0) return; // only first mouse button @@ -54,7 +54,7 @@ const broadBrushHelper = function (tool) { if (finalPath.segments.length === 5) { // Flatten is necessary to prevent smooth from getting rid of the effect // of the handles on the first point. - finalPath.flatten(this.options.brushSize / 5); + finalPath.flatten(Math.min(5, this.options.brushSize / 5)); } finalPath.smooth(); lastPoint = event.point; diff --git a/src/tools/segment-brush-helper.js b/src/tools/segment-brush-helper.js index d62772e1..659ad00a 100644 --- a/src/tools/segment-brush-helper.js +++ b/src/tools/segment-brush-helper.js @@ -20,7 +20,7 @@ const segmentBrushHelper = function (tool) { tool.onSegmentMouseDown = function (event) { if (event.event.button > 0) return; // only first mouse button - tool.minDistance = this.options.brushSize / 4; + tool.minDistance = 1; tool.maxDistance = this.options.brushSize; finalPath = new paper.Path.Circle({ @@ -60,7 +60,7 @@ const segmentBrushHelper = function (tool) { path.closed = true; // The unite function on curved paths does not always work (sometimes deletes half the path) // so we have to flatten. - path.flatten(this.options.brushSize / 5); + path.flatten(Math.min(5, this.options.brushSize / 5)); lastPoint = event.point; const newPath = finalPath.unite(path);