Merge pull request #316 from fsih/clearCursorPrev

Make sure to clear the cursor preview when saving undo state
This commit is contained in:
DD Liu 2018-03-08 14:09:41 -05:00 committed by GitHub
commit 78666c6e2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,7 +125,6 @@ class Blobbiness {
};
this.tool.onMouseUp = function (event) {
blob.resizeCursorIfNeeded(event.point);
if (event.event.button > 0 || !this.active) return; // only first mouse button
let lastPath;
@ -143,11 +142,9 @@ class Blobbiness {
blob.mergeBrush(lastPath);
}
blob.cursorPreview.visible = false;
blob.cursorPreview.remove();
blob.cursorPreview = null;
blob.onUpdateSvg();
blob.cursorPreview.visible = true;
blob.cursorPreview.bringToFront();
blob.cursorPreview.position = event.point;
// Reset
blob.brush = null;
@ -432,8 +429,10 @@ class Blobbiness {
}
deactivateTool () {
this.cursorPreview.remove();
this.cursorPreview = null;
if (this.cursorPreview) {
this.cursorPreview.remove();
this.cursorPreview = null;
}
this.tool.remove();
this.tool = null;
}