From d2e1ee9f1f5059599a7af9ea645f1ae6894fab4e Mon Sep 17 00:00:00 2001 From: agriyadev5 Date: Wed, 7 Jul 2021 13:57:32 +0530 Subject: [PATCH] #374 poly slide and points update redo/undo issue fixed --- src/editor/extensions/ext-polystar/ext-polystar.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/editor/extensions/ext-polystar/ext-polystar.js b/src/editor/extensions/ext-polystar/ext-polystar.js index 4c756dac..27884a4b 100644 --- a/src/editor/extensions/ext-polystar/ext-polystar.js +++ b/src/editor/extensions/ext-polystar/ext-polystar.js @@ -29,6 +29,8 @@ export default { name, async init(_S) { const svgEditor = this; + const { ChangeElementCommand } = _S; // , svgcontent, + const addToHistory = function (cmd) { svgCanvas.undoMgr.addCommandToHistory(cmd); }; const { svgCanvas } = svgEditor; const { $id } = svgCanvas; let selElems; @@ -142,6 +144,8 @@ export default { while (i--) { const elem = selElems[i]; if (elem.hasAttribute('r')) { + const oldPoint = elem.getAttribute('point'); + const oldPoints = elem.getAttribute('points'); const radialshift = elem.getAttribute('radialshift'); let xpos = 0; let ypos = 0; @@ -188,6 +192,7 @@ export default { } } elem.setAttribute("points", polyPoints); + addToHistory(new ChangeElementCommand(elem, { 'point': oldPoint, 'points': oldPoints })); } } } @@ -205,6 +210,8 @@ export default { while (i--) { const elem = selElems[i]; if (elem.hasAttribute('edge')) { + const oldSides = elem.getAttribute('sides'); + const oldPoints = elem.getAttribute('points'); let xpos = 0; let ypos = 0; if (elem.points) { @@ -228,6 +235,7 @@ export default { points += x + "," + y + " "; } elem.setAttribute("points", points); + addToHistory(new ChangeElementCommand(elem, { 'sides': oldSides, 'points': oldPoints })); } } }