diff --git a/.vscode/settings.json b/.vscode/settings.json index 3d8051842..0b529304d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -69,5 +69,8 @@ "[markdown]": { "editor.wordWrap": "wordWrapColumn", "editor.wordWrapColumn": 80 + }, + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true } } diff --git a/src/stateManagement/toolState.js b/src/stateManagement/toolState.js index dae1b4414..90d4a8942 100755 --- a/src/stateManagement/toolState.js +++ b/src/stateManagement/toolState.js @@ -80,6 +80,11 @@ function getToolState(element, toolType) { function removeToolState(element, toolType, data) { const toolStateManager = getElementToolStateManager(element); const toolData = toolStateManager.get(element, toolType); + + if (!toolData || !toolData.data || !toolData.data.length) { + return; + } + // Find this tool data let indexOfData = -1; diff --git a/src/tools/OverlayTool.js b/src/tools/OverlayTool.js index b83da38f3..6831fb4c6 100644 --- a/src/tools/OverlayTool.js +++ b/src/tools/OverlayTool.js @@ -104,10 +104,12 @@ export default class OverlayTool extends BaseTool { } // Guard against non-number values - const overlayX = (!isNaN(parseFloat(overlay.x)) && isFinite(overlay.x)) ? overlay.x : 0; - const overlayY = (!isNaN(parseFloat(overlay.y)) && isFinite(overlay.y)) ? overlay.y : 0; - + const overlayX = + !isNaN(parseFloat(overlay.x)) && isFinite(overlay.x) ? overlay.x : 0; + const overlayY = + !isNaN(parseFloat(overlay.y)) && isFinite(overlay.y) ? overlay.y : 0; // Draw the overlay layer onto the canvas + canvasContext.drawImage(layerCanvas, overlayX, overlayY); }); }