make helper mouse functions have consistent interface

This commit is contained in:
DD Liu 2017-08-22 15:57:12 -04:00
parent 6ede893585
commit b55b23e446
3 changed files with 5 additions and 5 deletions

View file

@ -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}`);
}

View file

@ -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

View file

@ -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);