Remove wheel listeners from brush and eraser

This commit is contained in:
Paul Kaplan 2017-10-27 10:22:52 -04:00
parent d4b28a8817
commit 62526889c9
4 changed files with 2 additions and 12 deletions

View file

@ -225,20 +225,16 @@ class PaintEditorComponent extends React.Component {
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
<BrushMode <BrushMode
canvas={this.state.canvas}
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
<EraserMode <EraserMode
canvas={this.state.canvas}
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
<PenMode <PenMode
canvas={this.state.canvas}
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
{/* Text mode will go here */} {/* Text mode will go here */}
<LineMode <LineMode
canvas={this.state.canvas}
onUpdateSvg={this.props.onUpdateSvg} onUpdateSvg={this.props.onUpdateSvg}
/> />
<OvalMode <OvalMode

View file

@ -70,8 +70,6 @@ BrushMode.propTypes = {
brushModeState: PropTypes.shape({ brushModeState: PropTypes.shape({
brushSize: PropTypes.number.isRequired brushSize: PropTypes.number.isRequired
}), }),
canvas: PropTypes.instanceOf(Element).isRequired,
changeBrushSize: PropTypes.func.isRequired,
clearSelectedItems: PropTypes.func.isRequired, clearSelectedItems: PropTypes.func.isRequired,
colorState: PropTypes.shape({ colorState: PropTypes.shape({
fillColor: PropTypes.string, fillColor: PropTypes.string,

View file

@ -56,8 +56,6 @@ class EraserMode extends React.Component {
} }
EraserMode.propTypes = { EraserMode.propTypes = {
canvas: PropTypes.instanceOf(Element).isRequired,
changeBrushSize: PropTypes.func.isRequired,
clearSelectedItems: PropTypes.func.isRequired, clearSelectedItems: PropTypes.func.isRequired,
eraserModeState: PropTypes.shape({ eraserModeState: PropTypes.shape({
brushSize: PropTypes.number.isRequired brushSize: PropTypes.number.isRequired

View file

@ -47,7 +47,7 @@ class LineMode extends React.Component {
activateTool () { activateTool () {
clearSelection(this.props.clearSelectedItems); clearSelection(this.props.clearSelectedItems);
this.tool = new paper.Tool(); this.tool = new paper.Tool();
this.path = null; this.path = null;
this.hitResult = null; this.hitResult = null;
@ -182,14 +182,13 @@ class LineMode extends React.Component {
removeHitPoint(); removeHitPoint();
this.hitResult = null; this.hitResult = null;
} }
if (this.path) { if (this.path) {
this.props.onUpdateSvg(); this.props.onUpdateSvg();
this.path = null; this.path = null;
} }
} }
deactivateTool () { deactivateTool () {
this.props.canvas.removeEventListener('mousewheel', this.onScroll);
this.tool.remove(); this.tool.remove();
this.tool = null; this.tool = null;
if (this.hitResult) { if (this.hitResult) {
@ -211,7 +210,6 @@ class LineMode extends React.Component {
} }
LineMode.propTypes = { LineMode.propTypes = {
canvas: PropTypes.instanceOf(Element).isRequired,
clearSelectedItems: PropTypes.func.isRequired, clearSelectedItems: PropTypes.func.isRequired,
colorState: PropTypes.shape({ colorState: PropTypes.shape({
fillColor: PropTypes.string, fillColor: PropTypes.string,