From b40ccd46a99a5aa56c8a5a27d0ce9c564d7b527f Mon Sep 17 00:00:00 2001 From: DD Liu Date: Tue, 22 Aug 2017 15:57:12 -0400 Subject: [PATCH] make helper mouse functions have consistent interface --- src/containers/blob/blob.js | 6 +++--- src/containers/blob/broad-brush-helper.js | 2 +- src/containers/blob/segment-brush-helper.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/containers/blob/blob.js b/src/containers/blob/blob.js index c3c9c2ca..b06199b8 100644 --- a/src/containers/blob/blob.js +++ b/src/containers/blob/blob.js @@ -82,9 +82,9 @@ class Blobbiness { blob.resizeCursorIfNeeded(event.point); if (event.event.button > 0) return; // only first mouse button if (blob.brush === Blobbiness.BROAD) { - blob.broadBrushHelper.onBroadMouseDrag(event, blob.options); + blob.broadBrushHelper.onBroadMouseDrag(event, blob.tool, blob.options); } else if (blob.brush === Blobbiness.SEGMENT) { - blob.segmentBrushHelper.onSegmentMouseDrag(event, blob.options); + blob.segmentBrushHelper.onSegmentMouseDrag(event, blob.tool, blob.options); } else { log.warn(`Brush type does not exist: ${blob.brush}`); } @@ -102,7 +102,7 @@ class Blobbiness { if (blob.brush === Blobbiness.BROAD) { lastPath = blob.broadBrushHelper.onBroadMouseUp(event, blob.tool, blob.options); } else if (blob.brush === Blobbiness.SEGMENT) { - lastPath = blob.segmentBrushHelper.onSegmentMouseUp(event); + lastPath = blob.segmentBrushHelper.onSegmentMouseUp(event, blob.tool, blob.options); } else { log.warn(`Brush type does not exist: ${blob.brush}`); } diff --git a/src/containers/blob/broad-brush-helper.js b/src/containers/blob/broad-brush-helper.js index f4cf735c..b3bc1ca3 100644 --- a/src/containers/blob/broad-brush-helper.js +++ b/src/containers/blob/broad-brush-helper.js @@ -30,7 +30,7 @@ class BroadBrushHelper { this.lastPoint = this.secondLastPoint = event.point; } - onBroadMouseDrag (event, options) { + onBroadMouseDrag (event, tool, options) { const step = (event.delta).normalize(options.brushSize / 2); // Move the first point out away from the drag so that the end of the path is rounded diff --git a/src/containers/blob/segment-brush-helper.js b/src/containers/blob/segment-brush-helper.js index 8b716d50..88f7debd 100644 --- a/src/containers/blob/segment-brush-helper.js +++ b/src/containers/blob/segment-brush-helper.js @@ -36,7 +36,7 @@ class SegmentBrushHelper { this.lastPoint = event.point; } - onSegmentMouseDrag (event, options) { + onSegmentMouseDrag (event, tool, options) { if (event.event.button > 0) return; // only first mouse button const step = (event.delta).normalize(options.brushSize / 2);