- npm: Update devDeps
- Linting (ESLint): New ash-nazg rules
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable new-cap, class-methods-use-this */
|
||||
/* eslint-disable new-cap, class-methods-use-this, @mysticatea/no-use-ignored-vars */
|
||||
// Todo: Compare with latest canvg (add any improvements of ours) and add full JSDocs (denoting links to standard APIs and which are custom): https://github.com/canvg/canvg
|
||||
/**
|
||||
* canvg.js - Javascript SVG parser and renderer on Canvas
|
||||
@@ -2364,8 +2364,10 @@ function build (opts) {
|
||||
[...node.childNodes].forEach(({nodeValue}) => {
|
||||
css += nodeValue;
|
||||
});
|
||||
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // remove comments
|
||||
css = svg.compressSpaces(css); // replace whitespace
|
||||
// remove comments
|
||||
css = css.replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm, ''); // eslint-disable-line unicorn/no-unsafe-regex
|
||||
// replace whitespace
|
||||
css = svg.compressSpaces(css);
|
||||
const cssDefs = css.split('}');
|
||||
cssDefs.forEach((cssDef) => {
|
||||
if (svg.trim(cssDef) !== '') {
|
||||
|
||||
2801
editor/external/@babel/polyfill/polyfill.js
vendored
2801
editor/external/@babel/polyfill/polyfill.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-bitwise */
|
||||
/**
|
||||
* jPicker (Adapted from version 1.1.6)
|
||||
*
|
||||
@@ -96,7 +97,7 @@ const jPicker = function ($) {
|
||||
*/
|
||||
function mouseDown (e) {
|
||||
const off = bar.offset();
|
||||
offset = {l: off.left | 0, t: off.top | 0}; // eslint-disable-line no-bitwise
|
||||
offset = {l: off.left | 0, t: off.top | 0};
|
||||
clearTimeout(timeout);
|
||||
// using setTimeout for visual updates - once the style is updated the browser will re-render internally allowing the next Javascript to run
|
||||
timeout = setTimeout(function () {
|
||||
@@ -165,7 +166,6 @@ const jPicker = function ($) {
|
||||
let arrowOffsetX = 0,
|
||||
arrowOffsetY = 0;
|
||||
setTimeout(function () {
|
||||
/* eslint-disable no-bitwise */
|
||||
if (rangeX > 0) { // range is greater than zero
|
||||
// constrain to bounds
|
||||
if (x === maxX) arrowOffsetX = barW;
|
||||
@@ -184,7 +184,6 @@ const jPicker = function ($) {
|
||||
else arrowOffsetY -= arrowH >> 1;
|
||||
// set the arrow position based on these offsets
|
||||
arrow.css({left: arrowOffsetX + 'px', top: arrowOffsetY + 'px'});
|
||||
/* eslint no-bitwise: ["error"] */
|
||||
});
|
||||
}
|
||||
|
||||
@@ -287,7 +286,6 @@ const jPicker = function ($) {
|
||||
newMinY,
|
||||
newMaxY;
|
||||
if (isNullish(name)) name = 'all';
|
||||
/* eslint-disable no-bitwise */
|
||||
switch (name.toLowerCase()) {
|
||||
case 'minx':
|
||||
newMinX = (value && ((value.minX && value.minX | 0) || value | 0)) || 0;
|
||||
@@ -318,7 +316,6 @@ const jPicker = function ($) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* eslint no-bitwise: ["error"] */
|
||||
if (!isNullish(newMinX) && minX !== newMinX) {
|
||||
minX = newMinX;
|
||||
rangeX = maxX - minX;
|
||||
|
||||
@@ -57,7 +57,7 @@ const removeAttributes = function (node, attributes) {
|
||||
});
|
||||
};
|
||||
|
||||
const numRgx = /[+-]?(?:\d+\.\d*|\d+|\.\d+)(?:[eE]\d+|[eE][+-]\d+)?/g;
|
||||
const numRgx = /[+-]?(?:\d+\.\d*|\d+|\.\d+)(?:[eE]\d+|[eE][+-]\d+|)/g;
|
||||
const getLinesOptionsOfPoly = function (node) {
|
||||
let nums = node.getAttribute('points');
|
||||
nums = (nums && nums.match(numRgx)) || [];
|
||||
|
||||
@@ -1890,10 +1890,10 @@ const mouseDown = function (evt) {
|
||||
let delayedStroke;
|
||||
if (iswebkit) {
|
||||
delayedStroke = function (ele) {
|
||||
const _stroke = ele.getAttribute('stroke');
|
||||
const stroke_ = ele.getAttribute('stroke');
|
||||
ele.removeAttribute('stroke');
|
||||
// Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
|
||||
if (_stroke !== null) setTimeout(function () { ele.setAttribute('stroke', _stroke); }, 0);
|
||||
if (stroke_ !== null) setTimeout(function () { ele.setAttribute('stroke', stroke_); }, 0);
|
||||
};
|
||||
}
|
||||
mouseTarget.style.vectorEffect = 'non-scaling-stroke';
|
||||
|
||||
@@ -5122,7 +5122,7 @@
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
var init$1 = function init$$1(editorContext) {
|
||||
var init$1 = function init(editorContext) {
|
||||
editorContext_ = editorContext;
|
||||
pathFuncs = [0, 'ClosePath'];
|
||||
var pathFuncsStrs = ['Moveto', 'Lineto', 'CurvetoCubic', 'CurvetoQuadratic', 'Arc', 'LinetoHorizontal', 'LinetoVertical', 'CurvetoCubicSmooth', 'CurvetoQuadraticSmooth'];
|
||||
@@ -5847,7 +5847,7 @@
|
||||
|
||||
_createClass(Path, [{
|
||||
key: "init",
|
||||
value: function init$$1() {
|
||||
value: function init() {
|
||||
// Hide all grips, etc
|
||||
// fixed, needed to work on all found elements, not just first
|
||||
$$1(getGripContainer()).find('*').each(function () {
|
||||
@@ -7937,7 +7937,7 @@
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
var init$2 = function init$$1(editorContext) {
|
||||
var init$2 = function init(editorContext) {
|
||||
editorContext_$1 = editorContext;
|
||||
domdoc_ = editorContext.getDOMDocument();
|
||||
domcontainer_ = editorContext.getDOMContainer();
|
||||
@@ -8326,8 +8326,8 @@
|
||||
* @returns {module:utilities.BBoxObject} A BBox-like object
|
||||
*/
|
||||
|
||||
var getPathBBox = function getPathBBox(path$$1) {
|
||||
var seglist = path$$1.pathSegList;
|
||||
var getPathBBox = function getPathBBox(path) {
|
||||
var seglist = path.pathSegList;
|
||||
var tot = seglist.numberOfItems;
|
||||
var bounds = [[], []];
|
||||
var start = seglist.getItem(0);
|
||||
@@ -8710,43 +8710,43 @@
|
||||
* @returns {DOMRect|false} The resulting path's bounding box object.
|
||||
*/
|
||||
|
||||
var getBBoxOfElementAsPath = function getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions$$1) {
|
||||
var path$$1 = addSVGElementFromJson({
|
||||
var getBBoxOfElementAsPath = function getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions) {
|
||||
var path = addSVGElementFromJson({
|
||||
element: 'path',
|
||||
attr: getExtraAttributesForConvertToPath(elem)
|
||||
});
|
||||
var eltrans = elem.getAttribute('transform');
|
||||
|
||||
if (eltrans) {
|
||||
path$$1.setAttribute('transform', eltrans);
|
||||
path.setAttribute('transform', eltrans);
|
||||
}
|
||||
|
||||
var parentNode = elem.parentNode;
|
||||
|
||||
if (elem.nextSibling) {
|
||||
elem.before(path$$1);
|
||||
elem.before(path);
|
||||
} else {
|
||||
parentNode.append(path$$1);
|
||||
parentNode.append(path);
|
||||
}
|
||||
|
||||
var d = getPathDFromElement(elem);
|
||||
|
||||
if (d) {
|
||||
path$$1.setAttribute('d', d);
|
||||
path.setAttribute('d', d);
|
||||
} else {
|
||||
path$$1.remove();
|
||||
path.remove();
|
||||
} // Get the correct BBox of the new path, then discard it
|
||||
|
||||
|
||||
pathActions$$1.resetOrientation(path$$1);
|
||||
pathActions.resetOrientation(path);
|
||||
var bb = false;
|
||||
|
||||
try {
|
||||
bb = path$$1.getBBox();
|
||||
bb = path.getBBox();
|
||||
} catch (e) {// Firefox fails
|
||||
}
|
||||
|
||||
path$$1.remove();
|
||||
path.remove();
|
||||
return bb;
|
||||
};
|
||||
/**
|
||||
@@ -8763,57 +8763,57 @@
|
||||
* @returns {SVGPathElement|null} The converted path element or null if the DOM element was not recognized.
|
||||
*/
|
||||
|
||||
var convertToPath = function convertToPath(elem, attrs, addSVGElementFromJson, pathActions$$1, clearSelection, addToSelection, hstry, addCommandToHistory) {
|
||||
var convertToPath = function convertToPath(elem, attrs, addSVGElementFromJson, pathActions, clearSelection, addToSelection, hstry, addCommandToHistory) {
|
||||
var batchCmd = new hstry.BatchCommand('Convert element to Path'); // Any attribute on the element not covered by the passed-in attributes
|
||||
|
||||
attrs = $$2.extend({}, attrs, getExtraAttributesForConvertToPath(elem));
|
||||
var path$$1 = addSVGElementFromJson({
|
||||
var path = addSVGElementFromJson({
|
||||
element: 'path',
|
||||
attr: attrs
|
||||
});
|
||||
var eltrans = elem.getAttribute('transform');
|
||||
|
||||
if (eltrans) {
|
||||
path$$1.setAttribute('transform', eltrans);
|
||||
path.setAttribute('transform', eltrans);
|
||||
}
|
||||
|
||||
var id = elem.id;
|
||||
var parentNode = elem.parentNode;
|
||||
|
||||
if (elem.nextSibling) {
|
||||
elem.before(path$$1);
|
||||
elem.before(path);
|
||||
} else {
|
||||
parentNode.append(path$$1);
|
||||
parentNode.append(path);
|
||||
}
|
||||
|
||||
var d = getPathDFromElement(elem);
|
||||
|
||||
if (d) {
|
||||
path$$1.setAttribute('d', d); // Replace the current element with the converted one
|
||||
path.setAttribute('d', d); // Replace the current element with the converted one
|
||||
// Reorient if it has a matrix
|
||||
|
||||
if (eltrans) {
|
||||
var tlist = getTransformList(path$$1);
|
||||
var tlist = getTransformList(path);
|
||||
|
||||
if (hasMatrixTransform(tlist)) {
|
||||
pathActions$$1.resetOrientation(path$$1);
|
||||
pathActions.resetOrientation(path);
|
||||
}
|
||||
}
|
||||
|
||||
var nextSibling = elem.nextSibling;
|
||||
batchCmd.addSubCommand(new hstry.RemoveElementCommand(elem, nextSibling, parent));
|
||||
batchCmd.addSubCommand(new hstry.InsertElementCommand(path$$1));
|
||||
batchCmd.addSubCommand(new hstry.InsertElementCommand(path));
|
||||
clearSelection();
|
||||
elem.remove();
|
||||
path$$1.setAttribute('id', id);
|
||||
path$$1.removeAttribute('visibility');
|
||||
addToSelection([path$$1], true);
|
||||
path.setAttribute('id', id);
|
||||
path.removeAttribute('visibility');
|
||||
addToSelection([path], true);
|
||||
addCommandToHistory(batchCmd);
|
||||
return path$$1;
|
||||
return path;
|
||||
} // the elem.tagName was not recognized, so no "d" attribute. Remove it, so we've haven't changed anything.
|
||||
|
||||
|
||||
path$$1.remove();
|
||||
path.remove();
|
||||
return null;
|
||||
};
|
||||
/**
|
||||
@@ -8853,7 +8853,7 @@
|
||||
*/
|
||||
|
||||
|
||||
var getBBoxWithTransform = function getBBoxWithTransform(elem, addSVGElementFromJson, pathActions$$1) {
|
||||
var getBBoxWithTransform = function getBBoxWithTransform(elem, addSVGElementFromJson, pathActions) {
|
||||
// TODO: Fix issue with rotated groups. Currently they work
|
||||
// fine in FF, but not in other browsers (same problem mentioned
|
||||
// in Issue 339 comment #2).
|
||||
@@ -8876,7 +8876,7 @@
|
||||
var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
|
||||
|
||||
if (elemNames.includes(elem.tagName)) {
|
||||
goodBb = getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions$$1);
|
||||
goodBb = getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions);
|
||||
bb = goodBb;
|
||||
} else if (elem.tagName === 'rect') {
|
||||
// Look for radius
|
||||
@@ -8884,7 +8884,7 @@
|
||||
var ry = elem.getAttribute('ry');
|
||||
|
||||
if (rx || ry) {
|
||||
goodBb = getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions$$1);
|
||||
goodBb = getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions);
|
||||
bb = goodBb;
|
||||
}
|
||||
}
|
||||
@@ -8941,7 +8941,7 @@
|
||||
*/
|
||||
|
||||
|
||||
var getStrokedBBox = function getStrokedBBox(elems, addSVGElementFromJson, pathActions$$1) {
|
||||
var getStrokedBBox = function getStrokedBBox(elems, addSVGElementFromJson, pathActions) {
|
||||
if (!elems || !elems.length) {
|
||||
return false;
|
||||
}
|
||||
@@ -8956,7 +8956,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
fullBb = getBBoxWithTransform(this, addSVGElementFromJson, pathActions$$1);
|
||||
fullBb = getBBoxWithTransform(this, addSVGElementFromJson, pathActions);
|
||||
}); // This shouldn't ever happen...
|
||||
|
||||
if (fullBb === undefined) {
|
||||
@@ -8978,7 +8978,7 @@
|
||||
maxY += offset;
|
||||
} else {
|
||||
$$2.each(elems, function (i, elem) {
|
||||
var curBb = getBBoxWithTransform(elem, addSVGElementFromJson, pathActions$$1);
|
||||
var curBb = getBBoxWithTransform(elem, addSVGElementFromJson, pathActions);
|
||||
|
||||
if (curBb) {
|
||||
var _offset = getStrokeOffsetForBBox(elem);
|
||||
@@ -10982,7 +10982,7 @@
|
||||
|
||||
}, {
|
||||
key: "copyElem",
|
||||
value: function copyElem$$1(el) {
|
||||
value: function copyElem$1(el) {
|
||||
var that = this;
|
||||
|
||||
var getNextIdClosure = function getNextIdClosure() {
|
||||
@@ -11383,7 +11383,13 @@
|
||||
canvas_.call('contextset', canvas_.getCurrentGroup());
|
||||
};
|
||||
|
||||
var REVERSE_NS = getReverseNS(); // this defines which elements and attributes that we support
|
||||
var REVERSE_NS = getReverseNS(); // Todo: Split out into core attributes, presentation attributes, etc. so consistent
|
||||
|
||||
/**
|
||||
* This defines which elements and attributes that we support (or at least
|
||||
* don't remove)
|
||||
* @type {PlainObject}
|
||||
*/
|
||||
|
||||
var svgWhiteList_ = {
|
||||
// SVG Elements
|
||||
@@ -11395,6 +11401,7 @@
|
||||
desc: [],
|
||||
ellipse: ['class', 'clip-path', 'clip-rule', 'cx', 'cy', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'id', 'mask', 'opacity', 'requiredFeatures', 'rx', 'ry', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform'],
|
||||
feGaussianBlur: ['class', 'color-interpolation-filters', 'id', 'requiredFeatures', 'stdDeviation'],
|
||||
feMorphology: ['class', 'in', 'operator', 'radius'],
|
||||
filter: ['class', 'color-interpolation-filters', 'filterRes', 'filterUnits', 'height', 'id', 'primitiveUnits', 'requiredFeatures', 'width', 'x', 'xlink:href', 'y'],
|
||||
foreignObject: ['class', 'font-size', 'height', 'id', 'opacity', 'requiredFeatures', 'style', 'transform', 'width', 'x', 'y'],
|
||||
g: ['class', 'clip-path', 'clip-rule', 'id', 'display', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'mask', 'opacity', 'requiredFeatures', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'style', 'systemLanguage', 'transform', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-anchor'],
|
||||
@@ -12059,7 +12066,7 @@
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
var init$5 = function init$$1(editorContext) {
|
||||
var init$5 = function init(editorContext) {
|
||||
context_ = editorContext;
|
||||
};
|
||||
/**
|
||||
@@ -12374,6 +12381,7 @@
|
||||
|
||||
var angle = getRotationAngle(child);
|
||||
oldStartTransform = context_.getStartTransform();
|
||||
var childxforms = [];
|
||||
context_.setStartTransform(child.getAttribute('transform'));
|
||||
|
||||
if (angle || hasMatrixTransform(childTlist)) {
|
||||
@@ -12381,6 +12389,7 @@
|
||||
e2t.setMatrix(matrixMultiply(tm, sm, tmn, _m));
|
||||
childTlist.clear();
|
||||
childTlist.appendItem(e2t);
|
||||
childxforms.push(e2t); // if not rotated or skewed, push the [T][S][-T] down to the child
|
||||
} else {
|
||||
// update the transform list with translate,scale,translate
|
||||
// slide the [T][S][-T] from the front to the back
|
||||
@@ -12405,6 +12414,9 @@
|
||||
childTlist.appendItem(translateBack);
|
||||
childTlist.appendItem(scale);
|
||||
childTlist.appendItem(translateOrigin);
|
||||
childxforms.push(translateBack);
|
||||
childxforms.push(scale);
|
||||
childxforms.push(translateOrigin); // logMatrix(translateBack.matrix);
|
||||
// logMatrix(scale.matrix);
|
||||
} // not rotated
|
||||
|
||||
@@ -13825,7 +13837,7 @@
|
||||
return selectedElements;
|
||||
};
|
||||
|
||||
var pathActions$$1 = pathActions;
|
||||
var pathActions$1 = pathActions;
|
||||
/**
|
||||
* This should actually be an intersection as all interfaces should be met.
|
||||
* @implements {module:utilities.EditorContext#getSVGRoot|module:recalculate.EditorContext#getSVGRoot|module:coords.EditorContext#getSVGRoot|module:path.EditorContext#getSVGRoot}
|
||||
@@ -13840,7 +13852,7 @@
|
||||
* @implements {module:utilities.EditorContext}
|
||||
*/
|
||||
{
|
||||
pathActions: pathActions$$1,
|
||||
pathActions: pathActions$1,
|
||||
// Ok since not modifying
|
||||
getSVGContent: getSVGContent,
|
||||
addSVGElementFromJson: addSVGElementFromJson,
|
||||
@@ -14256,13 +14268,13 @@
|
||||
*/
|
||||
|
||||
|
||||
canvas.pathActions = pathActions$$1;
|
||||
canvas.pathActions = pathActions$1;
|
||||
/**
|
||||
* @implements {module:path.EditorContext#resetD}
|
||||
*/
|
||||
|
||||
function resetD(p) {
|
||||
p.setAttribute('d', pathActions$$1.convertPath(p));
|
||||
p.setAttribute('d', pathActions$1.convertPath(p));
|
||||
}
|
||||
|
||||
init$1(
|
||||
@@ -14311,8 +14323,8 @@
|
||||
var closedSubpath = _ref.closedSubpath,
|
||||
grips = _ref.grips;
|
||||
// TODO: Correct this:
|
||||
pathActions$$1.canDeleteNodes = true;
|
||||
pathActions$$1.closed_subpath = closedSubpath;
|
||||
pathActions$1.canDeleteNodes = true;
|
||||
pathActions$1.closed_subpath = closedSubpath;
|
||||
call('pointsAdded', {
|
||||
closedSubpath: closedSubpath,
|
||||
grips: grips
|
||||
@@ -15014,9 +15026,9 @@
|
||||
|
||||
var paths = _toConsumableArray(newDoc.getElementsByTagNameNS(NS.SVG, 'path'));
|
||||
|
||||
paths.forEach(function (path$$1) {
|
||||
path$$1.setAttribute('d', pathActions$$1.convertPath(path$$1));
|
||||
pathActions$$1.fixEnd(path$$1);
|
||||
paths.forEach(function (path) {
|
||||
path.setAttribute('d', pathActions$1.convertPath(path));
|
||||
pathActions$1.fixEnd(path);
|
||||
});
|
||||
};
|
||||
/**
|
||||
@@ -15394,7 +15406,7 @@
|
||||
|
||||
addToSelection([mouseTarget]);
|
||||
justSelected = mouseTarget;
|
||||
pathActions$$1.clear();
|
||||
pathActions$1.clear();
|
||||
} // else if it's a path, go into pathedit mode in mouseup
|
||||
|
||||
|
||||
@@ -15492,12 +15504,11 @@
|
||||
|
||||
if (iswebkit) {
|
||||
delayedStroke = function delayedStroke(ele) {
|
||||
var _stroke = ele.getAttribute('stroke');
|
||||
|
||||
var stroke_ = ele.getAttribute('stroke');
|
||||
ele.removeAttribute('stroke'); // Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
|
||||
|
||||
if (_stroke !== null) setTimeout(function () {
|
||||
ele.setAttribute('stroke', _stroke);
|
||||
if (stroke_ !== null) setTimeout(function () {
|
||||
ele.setAttribute('stroke', stroke_);
|
||||
}, 0);
|
||||
};
|
||||
}
|
||||
@@ -15684,7 +15695,7 @@
|
||||
case 'pathedit':
|
||||
startX *= currentZoom;
|
||||
startY *= currentZoom;
|
||||
pathActions$$1.mouseDown(evt, mouseTarget, startX, startY);
|
||||
pathActions$1.mouseDown(evt, mouseTarget, startX, startY);
|
||||
started = true;
|
||||
break;
|
||||
|
||||
@@ -16174,12 +16185,12 @@
|
||||
}
|
||||
|
||||
if (evt.shiftKey) {
|
||||
var path$$1 = path;
|
||||
var path$1 = path;
|
||||
var x1, y1;
|
||||
|
||||
if (path$$1) {
|
||||
x1 = path$$1.dragging ? path$$1.dragging[0] : startX;
|
||||
y1 = path$$1.dragging ? path$$1.dragging[1] : startY;
|
||||
if (path$1) {
|
||||
x1 = path$1.dragging ? path$1.dragging[0] : startX;
|
||||
y1 = path$1.dragging ? path$1.dragging[1] : startY;
|
||||
} else {
|
||||
x1 = startX;
|
||||
y1 = startY;
|
||||
@@ -16202,7 +16213,7 @@
|
||||
}, 100);
|
||||
}
|
||||
|
||||
pathActions$$1.mouseMove(x, y);
|
||||
pathActions$1.mouseMove(x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -16379,7 +16390,7 @@
|
||||
t = evt.target;
|
||||
|
||||
if (selectedElements[0].nodeName === 'path' && isNullish(selectedElements[1])) {
|
||||
pathActions$$1.select(selectedElements[0]); // if it was a path
|
||||
pathActions$1.select(selectedElements[0]); // if it was a path
|
||||
// else, if it was selected and this is a shift-click, remove it from selection
|
||||
} else if (evt.shiftKey) {
|
||||
if (tempJustSelected !== t) {
|
||||
@@ -16454,7 +16465,7 @@
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
element = pathActions$$1.smoothPolylineIntoPath(element);
|
||||
element = pathActions$1.smoothPolylineIntoPath(element);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -16533,7 +16544,7 @@
|
||||
element = null; // continue to be set to true so that mouseMove happens
|
||||
|
||||
started = true;
|
||||
var res = pathActions$$1.mouseUp(evt, element, mouseX, mouseY);
|
||||
var res = pathActions$1.mouseUp(evt, element, mouseX, mouseY);
|
||||
element = res.element;
|
||||
keep = res.keep;
|
||||
break;
|
||||
@@ -16542,7 +16553,7 @@
|
||||
case 'pathedit':
|
||||
keep = true;
|
||||
element = null;
|
||||
pathActions$$1.mouseUp(evt);
|
||||
pathActions$1.mouseUp(evt);
|
||||
break;
|
||||
|
||||
case 'textedit':
|
||||
@@ -16653,7 +16664,7 @@
|
||||
cleanupElement(element);
|
||||
|
||||
if (currentMode === 'path') {
|
||||
pathActions$$1.toEditMode(element);
|
||||
pathActions$1.toEditMode(element);
|
||||
} else if (curConfig.selectNew) {
|
||||
selectOnly([element], true);
|
||||
} // we create the insert command that is stored on the stack
|
||||
@@ -17260,7 +17271,7 @@
|
||||
* @param {Element} inputElem Not in use
|
||||
* @returns {undefined}
|
||||
*/
|
||||
init: function init$$1(inputElem) {
|
||||
init: function init(inputElem) {
|
||||
if (!curtext) {
|
||||
return;
|
||||
}
|
||||
@@ -17403,7 +17414,7 @@
|
||||
while (removeUnusedDefElems() > 0) {} // eslint-disable-line no-empty
|
||||
|
||||
|
||||
pathActions$$1.clear(true); // Keep SVG-Edit comment on top
|
||||
pathActions$1.clear(true); // Keep SVG-Edit comment on top
|
||||
|
||||
$$9.each(svgcontent.childNodes, function (i, node) {
|
||||
if (i && node.nodeType === 8 && node.data.includes('Created with')) {
|
||||
@@ -17570,7 +17581,7 @@
|
||||
out.push(' ');
|
||||
|
||||
if (_attr.localName === 'd') {
|
||||
_attrVal = pathActions$$1.convertPath(elem, true);
|
||||
_attrVal = pathActions$1.convertPath(elem, true);
|
||||
}
|
||||
|
||||
if (!isNaN(_attrVal)) {
|
||||
@@ -18799,7 +18810,7 @@
|
||||
* @implements {module:draw.DrawCanvasInit}
|
||||
*/
|
||||
{
|
||||
pathActions: pathActions$$1,
|
||||
pathActions: pathActions$1,
|
||||
getCurrentGroup: function getCurrentGroup() {
|
||||
return currentGroup;
|
||||
},
|
||||
@@ -18835,7 +18846,7 @@
|
||||
*/
|
||||
|
||||
this.clear = function () {
|
||||
pathActions$$1.clear();
|
||||
pathActions$1.clear();
|
||||
clearSelection(); // clear the svgcontent node
|
||||
|
||||
canvas.clearSvgContentElement(); // create new document
|
||||
@@ -18853,7 +18864,7 @@
|
||||
}; // Alias function
|
||||
|
||||
|
||||
this.linkControlPoints = pathActions$$1.linkControlPoints;
|
||||
this.linkControlPoints = pathActions$1.linkControlPoints;
|
||||
/**
|
||||
* @function module:svgcanvas.SvgCanvas#getContentElem
|
||||
* @returns {Element} The content DOM element
|
||||
@@ -19344,7 +19355,7 @@
|
||||
|
||||
selectorManager.requestSelector(elem).resize();
|
||||
});
|
||||
pathActions$$1.zoomChange();
|
||||
pathActions$1.zoomChange();
|
||||
runExtensions('zoomChanged',
|
||||
/** @type {module:svgcanvas.SvgCanvas#event:ext-zoomChanged} */
|
||||
zoomLevel);
|
||||
@@ -19367,7 +19378,7 @@
|
||||
|
||||
|
||||
this.setMode = function (name) {
|
||||
pathActions$$1.clear(true);
|
||||
pathActions$1.clear(true);
|
||||
textActions.clear();
|
||||
curProperties = selectedElements[0] && selectedElements[0].nodeName === 'text' ? curText : curShape;
|
||||
currentMode = name;
|
||||
@@ -20258,7 +20269,7 @@
|
||||
|
||||
|
||||
this.setSegType = function (newType) {
|
||||
pathActions$$1.setSegType(newType);
|
||||
pathActions$1.setSegType(newType);
|
||||
};
|
||||
/**
|
||||
* Convert selected element to a path, or get the BBox of an element-as-path.
|
||||
@@ -20271,7 +20282,7 @@
|
||||
*/
|
||||
|
||||
|
||||
this.convertToPath = function (elem, getBBox$$1) {
|
||||
this.convertToPath = function (elem, getBBox) {
|
||||
if (isNullish(elem)) {
|
||||
var elems = selectedElements;
|
||||
$$9.each(elems, function (i, el) {
|
||||
@@ -20282,8 +20293,8 @@
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (getBBox$$1) {
|
||||
return getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions$$1);
|
||||
if (getBBox) {
|
||||
return getBBoxOfElementAsPath(elem, addSVGElementFromJson, pathActions$1);
|
||||
} // TODO: Why is this applying attributes from curShape, then inside utilities.convertToPath it's pulling addition attributes from elem?
|
||||
// TODO: If convertToPath is called with one elem, curShape and elem are probably the same; but calling with multiple is a bug or cool feature.
|
||||
|
||||
@@ -20300,7 +20311,7 @@
|
||||
opacity: curShape.opacity,
|
||||
visibility: 'hidden'
|
||||
};
|
||||
return convertToPath(elem, attrs, addSVGElementFromJson, pathActions$$1, clearSelection, addToSelection, hstry, addCommandToHistory);
|
||||
return convertToPath(elem, attrs, addSVGElementFromJson, pathActions$1, clearSelection, addToSelection, hstry, addCommandToHistory);
|
||||
};
|
||||
/**
|
||||
* This function makes the changes to the elements. It does not add the change
|
||||
@@ -20315,7 +20326,7 @@
|
||||
var changeSelectedAttributeNoUndo = function changeSelectedAttributeNoUndo(attr, newValue, elems) {
|
||||
if (currentMode === 'pathedit') {
|
||||
// Editing node
|
||||
pathActions$$1.moveNode(attr, newValue);
|
||||
pathActions$1.moveNode(attr, newValue);
|
||||
}
|
||||
|
||||
elems = elems || selectedElements;
|
||||
@@ -24665,6 +24676,8 @@
|
||||
return $;
|
||||
}
|
||||
|
||||
/* eslint-disable no-bitwise */
|
||||
|
||||
/**
|
||||
* jPicker (Adapted from version 1.1.6)
|
||||
*
|
||||
@@ -24776,8 +24789,7 @@
|
||||
offset = {
|
||||
l: off.left | 0,
|
||||
t: off.top | 0
|
||||
}; // eslint-disable-line no-bitwise
|
||||
|
||||
};
|
||||
clearTimeout(timeout); // using setTimeout for visual updates - once the style is updated the browser will re-render internally allowing the next Javascript to run
|
||||
|
||||
timeout = setTimeout(function () {
|
||||
@@ -24851,7 +24863,6 @@
|
||||
var arrowOffsetX = 0,
|
||||
arrowOffsetY = 0;
|
||||
setTimeout(function () {
|
||||
/* eslint-disable no-bitwise */
|
||||
if (rangeX > 0) {
|
||||
// range is greater than zero
|
||||
// constrain to bounds
|
||||
@@ -24874,7 +24885,6 @@
|
||||
left: arrowOffsetX + 'px',
|
||||
top: arrowOffsetY + 'px'
|
||||
});
|
||||
/* eslint no-bitwise: ["error"] */
|
||||
});
|
||||
}
|
||||
/**
|
||||
@@ -25025,7 +25035,6 @@
|
||||
var // changed = false,
|
||||
newMinX, newMaxX, newMinY, newMaxY;
|
||||
if (isNullish$1(name)) name = 'all';
|
||||
/* eslint-disable no-bitwise */
|
||||
|
||||
switch (name.toLowerCase()) {
|
||||
case 'minx':
|
||||
@@ -25062,8 +25071,6 @@
|
||||
newMaxY = value && value.maxY && value.maxY | 0 || 0;
|
||||
break;
|
||||
}
|
||||
/* eslint no-bitwise: ["error"] */
|
||||
|
||||
|
||||
if (!isNullish$1(newMinX) && minX !== newMinX) {
|
||||
minX = newMinX;
|
||||
@@ -29424,7 +29431,7 @@
|
||||
var _ref6 = _asyncToGenerator(
|
||||
/*#__PURE__*/
|
||||
regeneratorRuntime.mark(function _callee2(extname) {
|
||||
var extName, url, imported, _imported$name, name, init$$1, importLocale;
|
||||
var extName, url, imported, _imported$name, name, init, importLocale;
|
||||
|
||||
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
@@ -29458,12 +29465,12 @@
|
||||
|
||||
case 7:
|
||||
imported = _context2.sent;
|
||||
_imported$name = imported.name, name = _imported$name === void 0 ? extName[1] : _imported$name, init$$1 = imported.init;
|
||||
_imported$name = imported.name, name = _imported$name === void 0 ? extName[1] : _imported$name, init = imported.init;
|
||||
importLocale = getImportLocale({
|
||||
defaultLang: langParam,
|
||||
defaultName: name
|
||||
});
|
||||
return _context2.abrupt("return", editor.addExtension(name, init$$1 && init$$1.bind(editor), {
|
||||
return _context2.abrupt("return", editor.addExtension(name, init && init.bind(editor), {
|
||||
$: $$b,
|
||||
importLocale: importLocale
|
||||
}));
|
||||
@@ -33280,7 +33287,7 @@
|
||||
*/
|
||||
|
||||
|
||||
var convertToPath$$1 = function convertToPath$$1() {
|
||||
var convertToPath = function convertToPath() {
|
||||
if (!isNullish(selectedElement)) {
|
||||
svgCanvas.convertToPath();
|
||||
}
|
||||
@@ -35116,7 +35123,7 @@
|
||||
key: 'ctrl+shift+['
|
||||
}, {
|
||||
sel: '#tool_topath',
|
||||
fn: convertToPath$$1,
|
||||
fn: convertToPath,
|
||||
evt: 'click'
|
||||
}, {
|
||||
sel: '#tool_make_link,#tool_make_link_multi',
|
||||
@@ -36389,7 +36396,7 @@
|
||||
*/
|
||||
|
||||
|
||||
editor.addExtension = function (name, init$$1, initArgs) {
|
||||
editor.addExtension = function (name, init, initArgs) {
|
||||
// Note that we don't want this on editor.ready since some extensions
|
||||
// may want to run before then (like server_opensave).
|
||||
// $(function () {
|
||||
@@ -36397,7 +36404,7 @@
|
||||
throw new Error('Extension added too early');
|
||||
}
|
||||
|
||||
return svgCanvas.addExtension.call(this, name, init$$1, initArgs); // });
|
||||
return svgCanvas.addExtension.call(this, name, init, initArgs); // });
|
||||
}; // Defer injection to wait out initial menu processing. This probably goes
|
||||
// away once all context menu behavior is brought to context menu.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user