#104 jquery extend convert to pure javascript
This commit is contained in:
@@ -16,6 +16,9 @@ import {
|
|||||||
isIdentity, matrixMultiply, transformPoint, transformListToTransform,
|
isIdentity, matrixMultiply, transformPoint, transformListToTransform,
|
||||||
hasMatrixTransform
|
hasMatrixTransform
|
||||||
} from './math.js';
|
} from './math.js';
|
||||||
|
import {
|
||||||
|
mergeDeep
|
||||||
|
} from '../editor/components/jgraduate/Util.js';
|
||||||
|
|
||||||
let context_;
|
let context_;
|
||||||
|
|
||||||
@@ -239,8 +242,7 @@ export const recalculateDimensions = function (selected) {
|
|||||||
// if we haven't created an initial array in polygon/polyline/path, then
|
// if we haven't created an initial array in polygon/polyline/path, then
|
||||||
// make a copy of initial values and include the transform
|
// make a copy of initial values and include the transform
|
||||||
if (isNullish(initial)) {
|
if (isNullish(initial)) {
|
||||||
const canvas = context_.getCanvas();
|
initial = mergeDeep({}, changes);
|
||||||
initial = canvas.mergeDeep({}, changes);
|
|
||||||
for (const [ attr, val ] of Object.entries(initial)) {
|
for (const [ attr, val ] of Object.entries(initial)) {
|
||||||
initial[attr] = convertToNum(attr, val);
|
initial[attr] = convertToNum(attr, val);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* globals $ */
|
|
||||||
/**
|
/**
|
||||||
* Tools for svg.
|
* Tools for svg.
|
||||||
* @module svg
|
* @module svg
|
||||||
@@ -670,7 +669,12 @@ export const save = function (opts) {
|
|||||||
// remove the selected outline before serializing
|
// remove the selected outline before serializing
|
||||||
svgContext_.getCanvas().clearSelection();
|
svgContext_.getCanvas().clearSelection();
|
||||||
// Update save options if provided
|
// 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);
|
svgContext_.setSvgOption('apply', true);
|
||||||
|
|
||||||
// no need for doctype, see https://jwatt.org/svg/authoring/#doctype-declaration
|
// no need for doctype, see https://jwatt.org/svg/authoring/#doctype-declaration
|
||||||
|
|||||||
Reference in New Issue
Block a user