diff --git a/badges/coverage-badge.svg b/badges/coverage-badge.svg index 1a70a667..be9c44c0 100644 --- a/badges/coverage-badge.svg +++ b/badges/coverage-badge.svg @@ -1 +1 @@ -Statements 47.23%Statements 47.23%Branches 34.77%Branches 34.77%Lines 48.3%Lines 48.3%Functions 53%Functions 53% +Statements 47.22%Statements 47.22%Branches 34.88%Branches 34.88%Lines 48.21%Lines 48.21%Functions 54.19%Functions 54.19% diff --git a/badges/tests-badge.svg b/badges/tests-badge.svg index 8d05fb3d..4663ec02 100644 --- a/badges/tests-badge.svg +++ b/badges/tests-badge.svg @@ -1 +1 @@ -TestsTests140/143140/143 \ No newline at end of file +TestsTests141/143141/143 \ No newline at end of file diff --git a/src/editor/panels/BottomPanelHandlers.js b/src/editor/panels/BottomPanelHandlers.js index 0051aa77..4ace5141 100644 --- a/src/editor/panels/BottomPanelHandlers.js +++ b/src/editor/panels/BottomPanelHandlers.js @@ -17,13 +17,25 @@ class BottomPanelHandlers { this.editor = editor; this.svgCanvas = editor.canvas; } + /** + * @type {module} + */ + get selectedElement () { + return this.editor.selectedElement; + } + /** + * @type {module} + */ + get multiselected () { + return this.editor.multiselected; + } /** * @type {module} */ changeStrokeWidth (e) { let val = e.target.value; - if (val === 0 && this.editor.selectedElement && ['line', 'polyline'].includes(this.editor.selectedElement.nodeName)) { + if (val === 0 && this.selectedElement && ['line', 'polyline'].includes(this.selectedElement.nodeName)) { val = 1; } this.svgCanvas.setStrokeWidth(val); diff --git a/src/editor/panels/TopPanelHandlers.js b/src/editor/panels/TopPanelHandlers.js index 896294f6..5134418f 100644 --- a/src/editor/panels/TopPanelHandlers.js +++ b/src/editor/panels/TopPanelHandlers.js @@ -316,7 +316,7 @@ class TopPanelHandlers { * @returns {void} */ clickUndo () { - const {undoMgr} = this.editor; + const {undoMgr} = this.editor.canvas; if (undoMgr.getUndoStackSize() > 0) { undoMgr.undo(); this.editor.layersPanel.populateLayers(); diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index a6faf737..c8709ded 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -849,7 +849,8 @@ editor.init = () => { $('#group_opacity').val(opacPerc); $('#opac_slider').slider('option', 'value', opacPerc); $id('elem_id').value = editor.selectedElement.id; - $id('elem_class').value = (editor.selectedElement.getAttribute('class') !== null) ? editor.selectedElement.getAttribute('class') : ''; + $id('elem_class').value = + (editor.selectedElement.getAttribute('class') !== null) ? editor.selectedElement.getAttribute('class') : ''; } editor.bottomPanelHandlers.updateToolButtonState(); @@ -1540,11 +1541,11 @@ editor.init = () => { * @returns {void} */ editor.zoomImage = function (multiplier) { - const resolution = this.svgCanvasgetResolution(); + const resolution = svgCanvas.getResolution(); multiplier = multiplier ? resolution.zoom * multiplier : 1; // setResolution(res.w * multiplier, res.h * multiplier, true); $id('zoom').value = (multiplier * 100).toFixed(1); - this.svgCanvassetZoom(multiplier); + svgCanvas.setZoom(multiplier); zoomDone(); updateCanvas(true); }; @@ -1847,7 +1848,7 @@ editor.init = () => { */ const saveSourceEditor = (e) => { const $editorDialog = document.getElementById('se-svg-editor-dialog'); - if ($editorDialog.getAttribute('dialog') === 'open') return; + if ($editorDialog.getAttribute('dialog') !== 'open') return; const saveChanges = () => { svgCanvas.clearSelection(); hideSourceEditor();