#543 if you move the group and try to undo the move, the text does not undo correctly issue fixed

master
agriyadev5 2021-07-06 17:56:28 +05:30
parent 1897e2e0ff
commit 8e01c1890c
1 changed files with 18 additions and 0 deletions

View File

@ -98,6 +98,24 @@ export const getUndoManager = function () {
// // Ok to replace above with this? `sib.before(elem);` // // Ok to replace above with this? `sib.before(elem);`
// } // }
// } // }
if (cmd.elem.tagName === 'text'){
const [ dx, dy ] = [ cmd.newValues.x - cmd.oldValues.x,
cmd.newValues.y - cmd.oldValues.y ];
const tspans = cmd.elem.children;
for (let i = 0; i < tspans.length; i++){
let x = +tspans[i].getAttribute('x');
let y = +tspans[i].getAttribute('y');
const unapply = (eventType === EventTypes.AFTER_UNAPPLY);
x = unapply? x - dx: x + dx;
y = unapply? y - dy: y + dy;
tspans[i].setAttribute('x', x);
tspans[i].setAttribute('y', y);
}
}
} }
} }
} }