update tests

This commit is contained in:
JFH
2021-08-29 16:05:21 +02:00
parent 0d2c344fee
commit 6c708ed974
6 changed files with 198 additions and 224 deletions

View File

@@ -81,20 +81,6 @@ export const getUndoManager = function () {
if (values.stdDeviation) {
undoContext_.getCanvas().setBlurOffsets(cmd.elem.parentNode, values.stdDeviation);
}
// This is resolved in later versions of webkit, perhaps we should
// have a featured detection for correct 'use' behavior?
// ——————————
// Remove & Re-add hack for Webkit (issue 775)
// if (cmd.elem.tagName === 'use' && isWebkit()) {
// const {elem} = cmd;
// if (!elem.getAttribute('x') && !elem.getAttribute('y')) {
// const parent = elem.parentNode;
// const sib = elem.nextSibling;
// elem.remove();
// parent.insertBefore(elem, sib);
// // 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 ];
@@ -248,7 +234,7 @@ export const changeSelectedAttributeNoUndoMethod = function (attr, newValue, ele
// we need to update the rotational transform attribute
const angle = getRotationAngle(elem);
if (angle !== 0 && attr !== 'transform') {
const tlist = elem.transform.baseVal;
const tlist = elem.transform?.baseVal;
let n = tlist.numberOfItems;
while (n--) {
const xform = tlist.getItem(n);

View File

@@ -1147,10 +1147,9 @@ export const getStrokedBBoxDefaultVisible = function (elems) {
* @param {boolean} toRad - When true returns the value in radians rather than degrees
* @returns {Float} The angle in degrees or radians
*/
export const getRotationAngleFromTransformList = function (tlist, toRad) {
if (!tlist) { return 0; } // <svg> elements have no tlist
const N = tlist.numberOfItems;
for (let i = 0; i < N; ++i) {
export const getRotationAngleFromTransformList = (tlist, toRad) => {
if (!tlist) { return 0; } // <svg> element have no tlist
for (let i = 0; i < tlist.numberOfItems; ++i) {
const xform = tlist.getItem(i);
if (xform.type === 4) {
return toRad ? xform.angle * Math.PI / 180.0 : xform.angle;
@@ -1169,7 +1168,7 @@ export const getRotationAngleFromTransformList = function (tlist, toRad) {
export let getRotationAngle = function (elem, toRad) {
const selected = elem || editorContext_.getSelectedElements()[0];
// find the rotation transform (if any) and set it
const tlist = selected.transform.baseVal;
const tlist = selected.transform?.baseVal;
return getRotationAngleFromTransformList(tlist, toRad);
};