mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2025-01-08 13:42:00 -05:00
Remove wheel listeners from brush and eraser
This commit is contained in:
parent
d4b28a8817
commit
62526889c9
4 changed files with 2 additions and 12 deletions
|
@ -225,20 +225,16 @@ class PaintEditorComponent extends React.Component {
|
|||
onUpdateSvg={this.props.onUpdateSvg}
|
||||
/>
|
||||
<BrushMode
|
||||
canvas={this.state.canvas}
|
||||
onUpdateSvg={this.props.onUpdateSvg}
|
||||
/>
|
||||
<EraserMode
|
||||
canvas={this.state.canvas}
|
||||
onUpdateSvg={this.props.onUpdateSvg}
|
||||
/>
|
||||
<PenMode
|
||||
canvas={this.state.canvas}
|
||||
onUpdateSvg={this.props.onUpdateSvg}
|
||||
/>
|
||||
{/* Text mode will go here */}
|
||||
<LineMode
|
||||
canvas={this.state.canvas}
|
||||
onUpdateSvg={this.props.onUpdateSvg}
|
||||
/>
|
||||
<OvalMode
|
||||
|
|
|
@ -70,8 +70,6 @@ BrushMode.propTypes = {
|
|||
brushModeState: PropTypes.shape({
|
||||
brushSize: PropTypes.number.isRequired
|
||||
}),
|
||||
canvas: PropTypes.instanceOf(Element).isRequired,
|
||||
changeBrushSize: PropTypes.func.isRequired,
|
||||
clearSelectedItems: PropTypes.func.isRequired,
|
||||
colorState: PropTypes.shape({
|
||||
fillColor: PropTypes.string,
|
||||
|
|
|
@ -56,8 +56,6 @@ class EraserMode extends React.Component {
|
|||
}
|
||||
|
||||
EraserMode.propTypes = {
|
||||
canvas: PropTypes.instanceOf(Element).isRequired,
|
||||
changeBrushSize: PropTypes.func.isRequired,
|
||||
clearSelectedItems: PropTypes.func.isRequired,
|
||||
eraserModeState: PropTypes.shape({
|
||||
brushSize: PropTypes.number.isRequired
|
||||
|
|
|
@ -47,7 +47,7 @@ class LineMode extends React.Component {
|
|||
activateTool () {
|
||||
clearSelection(this.props.clearSelectedItems);
|
||||
this.tool = new paper.Tool();
|
||||
|
||||
|
||||
this.path = null;
|
||||
this.hitResult = null;
|
||||
|
||||
|
@ -182,14 +182,13 @@ class LineMode extends React.Component {
|
|||
removeHitPoint();
|
||||
this.hitResult = null;
|
||||
}
|
||||
|
||||
|
||||
if (this.path) {
|
||||
this.props.onUpdateSvg();
|
||||
this.path = null;
|
||||
}
|
||||
}
|
||||
deactivateTool () {
|
||||
this.props.canvas.removeEventListener('mousewheel', this.onScroll);
|
||||
this.tool.remove();
|
||||
this.tool = null;
|
||||
if (this.hitResult) {
|
||||
|
@ -211,7 +210,6 @@ class LineMode extends React.Component {
|
|||
}
|
||||
|
||||
LineMode.propTypes = {
|
||||
canvas: PropTypes.instanceOf(Element).isRequired,
|
||||
clearSelectedItems: PropTypes.func.isRequired,
|
||||
colorState: PropTypes.shape({
|
||||
fillColor: PropTypes.string,
|
||||
|
|
Loading…
Reference in a new issue