Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
preserve highlighter state
Browse files Browse the repository at this point in the history
  • Loading branch information
Niharika Khanna committed Mar 5, 2018
1 parent 4783508 commit ca5cec7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/src/pages/shot/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ exports.Editor = class Editor extends React.Component {
}

onClickCrop() {
this.previousTool = this.state.tool;
this.setState({tool: "crop"});
this.cropToolBar = <div className="editor-header default-color-scheme"><div className="annotation-tools">
<Localized id="annotationCropConfirmButton">
Expand Down Expand Up @@ -231,14 +232,14 @@ exports.Editor = class Editor extends React.Component {
this.canvasHeight = cropHeight;
this.removeCropBox();
this.cropToolBar = null;
this.setState({tool: "pen"});
this.setState({tool: this.previousTool});
sendEvent("confirm-crop", "crop-toolbar");
}

onClickCancelCrop() {
this.removeCropBox();
this.cropToolBar = null;
this.setState({tool: "pen"});
this.setState({tool: this.previousTool});
sendEvent("cancel-crop", "crop-toolbar");
}

Expand Down Expand Up @@ -536,6 +537,7 @@ exports.Editor = class Editor extends React.Component {
this.highlightContext.strokeStyle = this.state.color;
document.addEventListener("mousemove", this.draw);
document.addEventListener("mousedown", this.setPosition);
document.addEventListener("mouseup", this.drawMouseup);
} else if (this.state.tool === "pen") {
this.drawContext = this.imageContext;
this.imageContext.globalCompositeOperation = "source-over";
Expand Down

0 comments on commit ca5cec7

Please sign in to comment.