#374 poly slide and points update redo/undo issue fixed

master
agriyadev5 2021-07-07 13:57:32 +05:30
parent bb76fbf4b6
commit d2e1ee9f1f
1 changed files with 8 additions and 0 deletions

View File

@ -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 }));
}
}
}