mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 13:32:28 -05:00
fix lint errors
This commit is contained in:
parent
ad5df04f1e
commit
2c64c45101
5 changed files with 15 additions and 16 deletions
|
@ -64,7 +64,7 @@ class Blobbiness {
|
||||||
|
|
||||||
this.tool.onMouseDown = function (event) {
|
this.tool.onMouseDown = function (event) {
|
||||||
blob.resizeCursorIfNeeded(event.point);
|
blob.resizeCursorIfNeeded(event.point);
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
if (blob.options.brushSize < Blobbiness.THRESHOLD) {
|
if (blob.options.brushSize < Blobbiness.THRESHOLD) {
|
||||||
blob.brush = Blobbiness.BROAD;
|
blob.brush = Blobbiness.BROAD;
|
||||||
|
@ -80,7 +80,7 @@ class Blobbiness {
|
||||||
|
|
||||||
this.tool.onMouseDrag = function (event) {
|
this.tool.onMouseDrag = function (event) {
|
||||||
blob.resizeCursorIfNeeded(event.point);
|
blob.resizeCursorIfNeeded(event.point);
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
if (blob.brush === Blobbiness.BROAD) {
|
if (blob.brush === Blobbiness.BROAD) {
|
||||||
blob.broadBrushHelper.onBroadMouseDrag(event, blob.tool, blob.options);
|
blob.broadBrushHelper.onBroadMouseDrag(event, blob.tool, blob.options);
|
||||||
} else if (blob.brush === Blobbiness.SEGMENT) {
|
} else if (blob.brush === Blobbiness.SEGMENT) {
|
||||||
|
@ -96,7 +96,7 @@ class Blobbiness {
|
||||||
|
|
||||||
this.tool.onMouseUp = function (event) {
|
this.tool.onMouseUp = function (event) {
|
||||||
blob.resizeCursorIfNeeded(event.point);
|
blob.resizeCursorIfNeeded(event.point);
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
let lastPath;
|
let lastPath;
|
||||||
if (blob.brush === Blobbiness.BROAD) {
|
if (blob.brush === Blobbiness.BROAD) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ class BroadBrushHelper {
|
||||||
onBroadMouseDown (event, tool, options) {
|
onBroadMouseDown (event, tool, options) {
|
||||||
tool.minDistance = options.brushSize / 2;
|
tool.minDistance = options.brushSize / 2;
|
||||||
tool.maxDistance = options.brushSize;
|
tool.maxDistance = options.brushSize;
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
this.finalPath = new paper.Path();
|
this.finalPath = new paper.Path();
|
||||||
stylePath(this.finalPath, options.isEraser);
|
stylePath(this.finalPath, options.isEraser);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SegmentBrushHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSegmentMouseDown (event, tool, options) {
|
onSegmentMouseDown (event, tool, options) {
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
tool.minDistance = 1;
|
tool.minDistance = 1;
|
||||||
tool.maxDistance = options.brushSize;
|
tool.maxDistance = options.brushSize;
|
||||||
|
@ -37,7 +37,7 @@ class SegmentBrushHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSegmentMouseDrag (event, tool, options) {
|
onSegmentMouseDrag (event, tool, options) {
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
const step = (event.delta).normalize(options.brushSize / 2);
|
const step = (event.delta).normalize(options.brushSize / 2);
|
||||||
const handleVec = step.clone();
|
const handleVec = step.clone();
|
||||||
|
@ -75,7 +75,7 @@ class SegmentBrushHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSegmentMouseUp (event) {
|
onSegmentMouseUp (event) {
|
||||||
if (event.event.button > 0) return; // only first mouse button
|
if (event.event.button > 0) return; // only first mouse button
|
||||||
|
|
||||||
// TODO: This smoothing tends to cut off large portions of the path! Would like to eventually
|
// TODO: This smoothing tends to cut off large portions of the path! Would like to eventually
|
||||||
// add back smoothing, maybe a custom implementation that only applies to a subset of the line?
|
// add back smoothing, maybe a custom implementation that only applies to a subset of the line?
|
||||||
|
|
|
@ -19,6 +19,6 @@ test('changeMode', () => {
|
||||||
|
|
||||||
test('invalidChangeMode', () => {
|
test('invalidChangeMode', () => {
|
||||||
expect(reducer(Modes.BRUSH /* state */, changeMode('non-existant mode') /* action */))
|
expect(reducer(Modes.BRUSH /* state */, changeMode('non-existant mode') /* action */))
|
||||||
.toBe(Modes.BRUSH);
|
.toBe(Modes.BRUSH);
|
||||||
expect(reducer(Modes.BRUSH /* state */, changeMode() /* action */)).toBe(Modes.BRUSH);
|
expect(reducer(Modes.BRUSH /* state */, changeMode() /* action */)).toBe(Modes.BRUSH);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
const defaultsDeep = require('lodash.defaultsdeep');
|
const defaultsDeep = require('lodash.defaultsdeep');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
|
@ -53,12 +52,12 @@ const base = {
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
plugins: []
|
plugins: []
|
||||||
.concat(process.env.NODE_ENV === 'production' ? [
|
.concat(process.env.NODE_ENV === 'production' ? [
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
include: /\.min\.js$/,
|
include: /\.min\.js$/,
|
||||||
minimize: true
|
minimize: true
|
||||||
})
|
})
|
||||||
] : [])
|
] : [])
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
|
@ -96,7 +95,7 @@ module.exports = [
|
||||||
output: {
|
output: {
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, 'dist'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
libraryTarget: 'commonjs2',
|
libraryTarget: 'commonjs2'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue