From 244da0b27d96b33321001233d82dd0d214fda098 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Wed, 17 Mar 2021 00:32:15 -0700 Subject: [PATCH 1/2] simulate move to update hover on fill tool mouse up --- src/helper/tools/fill-tool.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helper/tools/fill-tool.js b/src/helper/tools/fill-tool.js index a34638b7..a8ccc643 100644 --- a/src/helper/tools/fill-tool.js +++ b/src/helper/tools/fill-tool.js @@ -154,6 +154,7 @@ class FillTool extends paper.Tool { } handleMouseUp (event) { if (event.event.button > 0) return; // only first mouse button + this.handleMouseMove(event); // if it's a touch event we need to simulate hover first; if not this is harmless if (this.fillItem) { // If the hole we're filling in is the same color as the parent, and parent has no outline, remove the hole if (this.addedFillItem && From 3004a2a5cd4e47024be7c99acf79e683f639539e Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 19 Mar 2021 14:18:26 -0700 Subject: [PATCH 2/2] update fill preview on mouse-down --- src/helper/tools/fill-tool.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/helper/tools/fill-tool.js b/src/helper/tools/fill-tool.js index a8ccc643..65eae0fd 100644 --- a/src/helper/tools/fill-tool.js +++ b/src/helper/tools/fill-tool.js @@ -21,6 +21,7 @@ class FillTool extends paper.Tool { // We have to set these functions instead of just declaring them because // paper.js tools hook up the listeners in the setter functions. + this.onMouseDown = this.handleMouseDown; this.onMouseMove = this.handleMouseMove; this.onMouseUp = this.handleMouseUp; @@ -91,7 +92,7 @@ class FillTool extends paper.Tool { setPrevHoveredItemId (prevHoveredItemId) { this.prevHoveredItemId = prevHoveredItemId; } - handleMouseMove (event) { + updateFillPreview (event) { const hoveredItem = getHoveredItem(event, this.getHitOptions(), true /* subselect */); if ((!hoveredItem && this.prevHoveredItemId) || // There is no longer a hovered item (hoveredItem && !this.prevHoveredItemId) || // There is now a hovered item @@ -152,9 +153,17 @@ class FillTool extends paper.Tool { this._setFillItemColor(this.fillColor, this.fillColor2, this.gradientType, event.point); } } + handleMouseDown (event) { + // on touch, the user might touch-and-hold to preview what the fill tool would do + // if they don't move their finger at all after the "mouse down" event + // then this might be our only chance to give them a good preview + this.updateFillPreview(event); + } + handleMouseMove (event) { + this.updateFillPreview(event); + } handleMouseUp (event) { if (event.event.button > 0) return; // only first mouse button - this.handleMouseMove(event); // if it's a touch event we need to simulate hover first; if not this is harmless if (this.fillItem) { // If the hole we're filling in is the same color as the parent, and parent has no outline, remove the hole if (this.addedFillItem &&