fix issue on rotation undo

This commit is contained in:
JFH
2020-12-19 18:47:15 +01:00
parent ccf891f985
commit dca89321d4
2 changed files with 10 additions and 2 deletions

View File

@@ -402,7 +402,11 @@ export const setRotationAngle = function (val, preventUndo) {
// we need to undo it, then redo it so it can be undo-able! :)
// TODO: figure out how to make changes to transform list undo-able cross-browser?
const newTransform = elem.getAttribute('transform');
elem.setAttribute('transform', oldTransform);
if (oldTransform) {
elem.setAttribute('transform', oldTransform);
} else {
elem.removeAttribute('transform');
}
selectionContext_.getCanvas().changeSelectedAttribute('transform', newTransform, selectedElements);
selectionContext_.getCanvas().call('changed', selectedElements);
}

View File

@@ -188,7 +188,11 @@ export const changeSelectedAttributeNoUndoMethod = function (attr, newValue, ele
// }
} else if (attr === '#href') {
setHref(elem, newValue);
} else { elem.setAttribute(attr, newValue); }
} else if (newValue) {
elem.setAttribute(attr, newValue);
} else {
elem.removeAttribute(attr);
}
// Go into "select" mode for text changes
// NOTE: Important that this happens AFTER elem.setAttribute() or else attributes like