diff --git a/src/svgcanvas/recalculate.js b/src/svgcanvas/recalculate.js index 796c3927..bd9da8a0 100644 --- a/src/svgcanvas/recalculate.js +++ b/src/svgcanvas/recalculate.js @@ -16,6 +16,9 @@ import { isIdentity, matrixMultiply, transformPoint, transformListToTransform, hasMatrixTransform } from './math.js'; +import { + mergeDeep +} from '../editor/components/jgraduate/Util.js'; let context_; @@ -239,8 +242,7 @@ export const recalculateDimensions = function (selected) { // if we haven't created an initial array in polygon/polyline/path, then // make a copy of initial values and include the transform if (isNullish(initial)) { - const canvas = context_.getCanvas(); - initial = canvas.mergeDeep({}, changes); + initial = mergeDeep({}, changes); for (const [ attr, val ] of Object.entries(initial)) { initial[attr] = convertToNum(attr, val); } diff --git a/src/svgcanvas/svg-exec.js b/src/svgcanvas/svg-exec.js index e493c5ef..2cc949fd 100644 --- a/src/svgcanvas/svg-exec.js +++ b/src/svgcanvas/svg-exec.js @@ -1,4 +1,3 @@ -/* globals $ */ /** * Tools for svg. * @module svg @@ -670,7 +669,12 @@ export const save = function (opts) { // remove the selected outline before serializing svgContext_.getCanvas().clearSelection(); // Update save options if provided - if (opts) { $.extend(svgContext_.getSvgOption(), opts); } + if (opts) { + const saveOptions = svgContext_.getCanvas().mergeDeep(svgContext_.getSvgOption(), opts); + for (const [ key, value ] of Object.entries(saveOptions)) { + svgContext_.setSvgOption(key, value); + } + } svgContext_.setSvgOption('apply', true); // no need for doctype, see https://jwatt.org/svg/authoring/#doctype-declaration