Skip to content

Commit

Permalink
SVG-Edit#549 setRotationAngle problem partially fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AgriyaDev5 committed Sep 29, 2021
1 parent 23f8217 commit e6a5c82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/svgcanvas/selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ export const setRotationAngle = function (val, preventUndo) {
const tlist = elem.transform.baseVal;

// only remove the real rotational transform if present (i.e. at index=0)
if (tlist.numberOfItems > 0) {
/* if (tlist.numberOfItems > 0) {
const xform = tlist.getItem(0);
if (xform.type === 4) {
tlist.removeItem(0);
}
}
} */
// find Rnc and insert it
if (val !== 0) {
const center = transformPoint(cx, cy, transformListToTransform(tlist).matrix);
Expand Down
2 changes: 1 addition & 1 deletion src/svgcanvas/undo.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export const changeSelectedAttributeNoUndoMethod = function (attr, newValue, ele
// if this element was rotated, and we changed the position of this element
// we need to update the rotational transform attribute
const angle = getRotationAngle(elem);
if (angle !== 0 && attr !== 'transform') {
if (angle !== 0 && attr === 'transform') {
const tlist = elem.transform?.baseVal;
let n = tlist.numberOfItems;
while (n--) {
Expand Down

0 comments on commit e6a5c82

Please sign in to comment.