#104 jquery extend convert to pure javascript

master
Agriya Dev5 2021-05-24 14:10:24 +05:30
parent 2a0666aa1c
commit d455eef840
2 changed files with 10 additions and 4 deletions

View File

@ -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);
}

View File

@ -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