parent
6acca0cf6a
commit
cf80e31de7
File diff suppressed because it is too large
Load Diff
|
@ -6582,7 +6582,7 @@ var convertPath = function convertPath(pth, toRel) {
|
|||
x2 = seg.x2 || 0,
|
||||
y2 = seg.y2 || 0;
|
||||
var type = seg.pathSegType;
|
||||
var letter = pathMap[type]['to' + (toRel ? 'Lower' : 'Upper') + 'Case']();
|
||||
var letter = pathMap[type][toRel ? 'toLowerCase' : 'toUpperCase']();
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -6604,16 +6604,18 @@ var convertPath = function convertPath(pth, toRel) {
|
|||
case 13:
|
||||
// relative horizontal line (h)
|
||||
if (toRel) {
|
||||
y = 0;
|
||||
curx += x;
|
||||
letter = 'l';
|
||||
} else {
|
||||
y = cury;
|
||||
x += curx;
|
||||
curx = x;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[x, cury]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
@ -6624,16 +6626,18 @@ var convertPath = function convertPath(pth, toRel) {
|
|||
case 15:
|
||||
// relative vertical line (v)
|
||||
if (toRel) {
|
||||
x = 0;
|
||||
cury += y;
|
||||
letter = 'l';
|
||||
} else {
|
||||
x = curx;
|
||||
y += cury;
|
||||
cury = y;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[curx, y]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 2: // absolute move (M)
|
||||
|
@ -9163,6 +9167,16 @@ var assignAttributes = function assignAttributes(elem, attrs, suspendLength, uni
|
|||
|
||||
var ns = key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null;
|
||||
|
||||
if (isNullish(value)) {
|
||||
if (ns) {
|
||||
elem.removeAttributeNS(ns, key);
|
||||
} else {
|
||||
elem.removeAttribute(key);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ns) {
|
||||
elem.setAttributeNS(ns, key, value);
|
||||
} else if (!unitCheck) {
|
||||
|
@ -14317,6 +14331,10 @@ function SvgCanvas(container, config) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!selectedElements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
call('selected', selectedElements);
|
||||
|
||||
if (showGrips || selectedElements.length === 1) {
|
||||
|
@ -17741,6 +17759,16 @@ function SvgCanvas(container, config) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_attrVal === 'null') {
|
||||
var styleName = _attr.localName.replace(/-[a-z]/g, function (s) {
|
||||
return s[1].toUpperCase();
|
||||
});
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (_attrVal !== '') {
|
||||
if (_attrVal.startsWith('pointer-events')) {
|
||||
continue;
|
||||
|
@ -17795,7 +17823,7 @@ function SvgCanvas(container, config) {
|
|||
case 1:
|
||||
// element node
|
||||
out.push('\n');
|
||||
out.push(this.svgToString(childs.item(_i4), indent));
|
||||
out.push(this.svgToString(child, indent));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -18201,7 +18229,8 @@ function SvgCanvas(container, config) {
|
|||
_context3.next = 4;
|
||||
return importScript([// We do not currently have these paths configurable as they are
|
||||
// currently global-only, so not Rolled-up
|
||||
'jspdf/underscore-min.js', 'jspdf/jspdf.min.js']);
|
||||
'jspdf/underscore-min.js', // 'jspdf/jspdf.min.js',
|
||||
'../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js']);
|
||||
|
||||
case 4:
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false; // Todo: Switch to `import()` when widely supported and available (also allow customization of path)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6588,7 +6588,7 @@
|
|||
x2 = seg.x2 || 0,
|
||||
y2 = seg.y2 || 0;
|
||||
var type = seg.pathSegType;
|
||||
var letter = pathMap[type]['to' + (toRel ? 'Lower' : 'Upper') + 'Case']();
|
||||
var letter = pathMap[type][toRel ? 'toLowerCase' : 'toUpperCase']();
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -6610,16 +6610,18 @@
|
|||
case 13:
|
||||
// relative horizontal line (h)
|
||||
if (toRel) {
|
||||
y = 0;
|
||||
curx += x;
|
||||
letter = 'l';
|
||||
} else {
|
||||
y = cury;
|
||||
x += curx;
|
||||
curx = x;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[x, cury]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
@ -6630,16 +6632,18 @@
|
|||
case 15:
|
||||
// relative vertical line (v)
|
||||
if (toRel) {
|
||||
x = 0;
|
||||
cury += y;
|
||||
letter = 'l';
|
||||
} else {
|
||||
x = curx;
|
||||
y += cury;
|
||||
cury = y;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[curx, y]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 2: // absolute move (M)
|
||||
|
@ -9169,6 +9173,16 @@
|
|||
|
||||
var ns = key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null;
|
||||
|
||||
if (isNullish(value)) {
|
||||
if (ns) {
|
||||
elem.removeAttributeNS(ns, key);
|
||||
} else {
|
||||
elem.removeAttribute(key);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ns) {
|
||||
elem.setAttributeNS(ns, key, value);
|
||||
} else if (!unitCheck) {
|
||||
|
@ -14323,6 +14337,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!selectedElements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
call('selected', selectedElements);
|
||||
|
||||
if (showGrips || selectedElements.length === 1) {
|
||||
|
@ -17747,6 +17765,16 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_attrVal === 'null') {
|
||||
var styleName = _attr.localName.replace(/-[a-z]/g, function (s) {
|
||||
return s[1].toUpperCase();
|
||||
});
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (_attrVal !== '') {
|
||||
if (_attrVal.startsWith('pointer-events')) {
|
||||
continue;
|
||||
|
@ -17801,7 +17829,7 @@
|
|||
case 1:
|
||||
// element node
|
||||
out.push('\n');
|
||||
out.push(this.svgToString(childs.item(_i4), indent));
|
||||
out.push(this.svgToString(child, indent));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -18207,7 +18235,8 @@
|
|||
_context3.next = 4;
|
||||
return importScript([// We do not currently have these paths configurable as they are
|
||||
// currently global-only, so not Rolled-up
|
||||
'jspdf/underscore-min.js', 'jspdf/jspdf.min.js']);
|
||||
'jspdf/underscore-min.js', // 'jspdf/jspdf.min.js',
|
||||
'../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js']);
|
||||
|
||||
case 4:
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false; // Todo: Switch to `import()` when widely supported and available (also allow customization of path)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -416,12 +416,13 @@
|
|||
circle: ['cx', 'cy', 'r', 'stroke', 'fill', 'stroke-width'],
|
||||
polygon: ['points', 'stroke', 'fill', 'stroke-width'],
|
||||
// polyline attributes are the same as those of polygon
|
||||
path: ['d', 'stroke', 'fill', 'stroke-width'],
|
||||
text: ['x', 'y', 'font-size', 'font-family', 'text-anchor', 'font-weight', 'font-style', 'fill']
|
||||
};
|
||||
|
||||
var attributeIsNotEmpty = function attributeIsNotEmpty(node, attr) {
|
||||
var attVal = attr ? node.getAttribute(attr) : node;
|
||||
return attVal !== '' && attVal !== null;
|
||||
return attVal !== '' && attVal !== null && attVal !== 'null';
|
||||
};
|
||||
|
||||
var nodeIs = function nodeIs(node, possible) {
|
||||
|
@ -479,6 +480,226 @@
|
|||
};
|
||||
};
|
||||
|
||||
var getLinesOptionsOfPath = function getLinesOptionsOfPath(node) {
|
||||
var segList = node.pathSegList,
|
||||
n = segList.numberOfItems,
|
||||
opsList = [];
|
||||
var ops = {
|
||||
lines: []
|
||||
};
|
||||
var curr = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
var reflectControl = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
var toRelative = function toRelative(nums, relativeTo) {
|
||||
var re = [];
|
||||
|
||||
for (var i = 0; i < nums.length - 1; i += 2) {
|
||||
re[i] = nums[i] - relativeTo.x;
|
||||
re[i + 1] = nums[i + 1] - relativeTo.y;
|
||||
}
|
||||
|
||||
return re;
|
||||
};
|
||||
|
||||
var curveQToC = function curveQToC(nums) {
|
||||
var a = 2 / 3;
|
||||
var re = [nums[0] * a, nums[1] * a, nums[2] + (nums[0] - nums[2]) * a, nums[3] + (nums[1] - nums[3]) * a, nums[2], nums[3]];
|
||||
return re;
|
||||
};
|
||||
|
||||
for (var i = 0, letterPrev; i < n; i++) {
|
||||
var seg = segList.getItem(i);
|
||||
var x1 = seg.x1,
|
||||
y1 = seg.y1,
|
||||
x2 = seg.x2,
|
||||
y2 = seg.y2,
|
||||
x = seg.x,
|
||||
y = seg.y,
|
||||
letter = seg.pathSegTypeAsLetter;
|
||||
var isRelative = letter >= 'a'; // lowercase letter
|
||||
|
||||
switch (letter) {
|
||||
case 'M':
|
||||
case 'm':
|
||||
{
|
||||
if (ops.lines.length && Object.prototype.hasOwnProperty.call(ops, 'x')) {
|
||||
opsList.push(ops);
|
||||
}
|
||||
|
||||
ops = {
|
||||
lines: [],
|
||||
x: isRelative ? x + curr.x : x,
|
||||
y: isRelative ? y + curr.y : y,
|
||||
closed: false
|
||||
};
|
||||
ops.closed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'L':
|
||||
{
|
||||
ops.lines.push(toRelative([x, y], curr));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'l':
|
||||
{
|
||||
ops.lines.push([x, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'H':
|
||||
{
|
||||
ops.lines.push([x - curr.x, 0]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'h':
|
||||
{
|
||||
ops.lines.push([x, 0]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'V':
|
||||
{
|
||||
ops.lines.push([0, y - curr.y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v':
|
||||
{
|
||||
ops.lines.push([0, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'Q':
|
||||
{
|
||||
ops.lines.push(curveQToC(toRelative([x1, y1, x, y], curr)));
|
||||
reflectControl.x = x - x1;
|
||||
reflectControl.y = y - y1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'q':
|
||||
{
|
||||
ops.lines.push(curveQToC([x1, y1, x, y]));
|
||||
reflectControl.x = x - x1;
|
||||
reflectControl.y = y - y1;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'T':
|
||||
{
|
||||
var p1 = letterPrev && 'QqTt'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
ops.lines.push(curveQToC([p1.x, p1.y, x - curr.x, y - curr.y]));
|
||||
reflectControl.x = x - curr.x - p1.x;
|
||||
reflectControl.y = y - curr.y - p1.y;
|
||||
break;
|
||||
}
|
||||
|
||||
case 't':
|
||||
{
|
||||
var _p = letterPrev && 'QqTt'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
ops.lines.push([_p.x, _p.y, x, y]);
|
||||
reflectControl.x = x - _p.x;
|
||||
reflectControl.y = y - _p.y;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'C':
|
||||
{
|
||||
ops.lines.push(toRelative([x1, y1, x2, y2, x, y], curr));
|
||||
break;
|
||||
}
|
||||
|
||||
case 'c':
|
||||
{
|
||||
ops.lines.push([x1, y1, x2, y2, x, y]);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'S':
|
||||
case 's':
|
||||
{
|
||||
var _p2 = letterPrev && 'CcSs'.includes(letterPrev) ? reflectControl : {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
if (isRelative) {
|
||||
ops.lines.push([_p2.x, _p2.y, x2, y2, x, y]);
|
||||
} else {
|
||||
ops.lines.push([_p2.x, _p2.y].concat(toRelative([x2, y2, x, y], curr)));
|
||||
}
|
||||
|
||||
reflectControl.x = x - x2;
|
||||
reflectControl.y = y - y2;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'A':
|
||||
case 'a':
|
||||
{
|
||||
// Not support command 'A' and 'a' yet. Treat it as straight line instead.
|
||||
if (isRelative) {
|
||||
ops.lines.push([x, y]);
|
||||
} else {
|
||||
ops.lines.push(toRelative([x, y], curr));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 'z':
|
||||
case 'Z':
|
||||
{
|
||||
ops.closed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// throw new Error('Unknown path command ' + letter);
|
||||
return opsList;
|
||||
}
|
||||
}
|
||||
|
||||
if (letter === 'Z' || letter === 'z') {
|
||||
curr.x = ops.x;
|
||||
curr.y = ops.y;
|
||||
} else {
|
||||
if (letter !== 'V' && letter !== 'v') {
|
||||
curr.x = isRelative ? x + curr.x : x;
|
||||
}
|
||||
|
||||
if (letter !== 'H' && letter !== 'h') {
|
||||
curr.y = isRelative ? y + curr.y : y;
|
||||
}
|
||||
}
|
||||
|
||||
letterPrev = letter;
|
||||
}
|
||||
|
||||
if (ops.lines.length && Object.prototype.hasOwnProperty.call(ops, 'x')) {
|
||||
opsList.push(ops);
|
||||
}
|
||||
|
||||
return opsList;
|
||||
};
|
||||
|
||||
var svgElementToPdf = function svgElementToPdf(element, pdf, options) {
|
||||
// pdf is a jsPDF object
|
||||
// console.log('options =', options);
|
||||
|
@ -490,11 +711,12 @@
|
|||
// let hasStrokeColor = false;
|
||||
var hasFillColor = false;
|
||||
var fillRGB;
|
||||
colorMode = null;
|
||||
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'text'])) {
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'path', 'text'])) {
|
||||
var fillColor = node.getAttribute('fill');
|
||||
|
||||
if (attributeIsNotEmpty(fillColor)) {
|
||||
if (attributeIsNotEmpty(fillColor) && node.getAttribute('fill-opacity') !== '0') {
|
||||
fillRGB = new RGBColor(fillColor);
|
||||
|
||||
if (fillRGB.ok) {
|
||||
|
@ -506,7 +728,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline'])) {
|
||||
if (nodeIs(node, ['g', 'line', 'rect', 'ellipse', 'circle', 'polygon', 'polyline', 'path'])) {
|
||||
if (hasFillColor) {
|
||||
pdf.setFillColor(fillRGB.r, fillRGB.g, fillRGB.b);
|
||||
}
|
||||
|
@ -517,14 +739,14 @@
|
|||
|
||||
var strokeColor = node.getAttribute('stroke');
|
||||
|
||||
if (attributeIsNotEmpty(strokeColor)) {
|
||||
if (attributeIsNotEmpty(strokeColor) && node.getAttribute('stroke-width') !== '0' && node.getAttribute('stroke-opacity') !== '0') {
|
||||
var strokeRGB = new RGBColor(strokeColor);
|
||||
|
||||
if (strokeRGB.ok) {
|
||||
// hasStrokeColor = true;
|
||||
pdf.setDrawColor(strokeRGB.r, strokeRGB.g, strokeRGB.b);
|
||||
|
||||
if (colorMode === 'F') {
|
||||
if (hasFillColor) {
|
||||
colorMode = 'FD';
|
||||
} else {
|
||||
colorMode = 'S';
|
||||
|
@ -576,7 +798,37 @@
|
|||
}
|
||||
|
||||
removeAttributes(node, pdfSvgAttr.polygon);
|
||||
break; // TODO: path
|
||||
break;
|
||||
}
|
||||
|
||||
case 'path':
|
||||
{
|
||||
if (colorMode) {
|
||||
var linesOptionsList = getLinesOptionsOfPath(node);
|
||||
|
||||
if (linesOptionsList.length > 0) {
|
||||
linesOptionsList.forEach(function (linesOptions) {
|
||||
pdf.lines(linesOptions.lines, k * linesOptions.x, k * linesOptions.y, [k, k], null, linesOptions.closed);
|
||||
}); // svg fill rule default is nonzero
|
||||
|
||||
var fillRule = node.getAttribute('fill-rule');
|
||||
|
||||
if (fillRule === 'evenodd') {
|
||||
// f* : fill using even-odd rule
|
||||
// B* : stroke and fill using even-odd rule
|
||||
if (colorMode === 'F') {
|
||||
colorMode = 'f*';
|
||||
} else if (colorMode === 'FD') {
|
||||
colorMode = 'B*';
|
||||
}
|
||||
}
|
||||
|
||||
pdf.internal.write(pdf.internal.getStyle(colorMode));
|
||||
}
|
||||
}
|
||||
|
||||
removeAttributes(node, pdfSvgAttr.path);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'text':
|
||||
|
|
|
@ -6654,7 +6654,7 @@ var SvgCanvas = (function () {
|
|||
x2 = seg.x2 || 0,
|
||||
y2 = seg.y2 || 0;
|
||||
var type = seg.pathSegType;
|
||||
var letter = pathMap[type]['to' + (toRel ? 'Lower' : 'Upper') + 'Case']();
|
||||
var letter = pathMap[type][toRel ? 'toLowerCase' : 'toUpperCase']();
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -6676,16 +6676,18 @@ var SvgCanvas = (function () {
|
|||
case 13:
|
||||
// relative horizontal line (h)
|
||||
if (toRel) {
|
||||
y = 0;
|
||||
curx += x;
|
||||
letter = 'l';
|
||||
} else {
|
||||
y = cury;
|
||||
x += curx;
|
||||
curx = x;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[x, cury]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
@ -6696,16 +6698,18 @@ var SvgCanvas = (function () {
|
|||
case 15:
|
||||
// relative vertical line (v)
|
||||
if (toRel) {
|
||||
x = 0;
|
||||
cury += y;
|
||||
letter = 'l';
|
||||
} else {
|
||||
x = curx;
|
||||
y += cury;
|
||||
cury = y;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[curx, y]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 2: // absolute move (M)
|
||||
|
@ -9235,6 +9239,16 @@ var SvgCanvas = (function () {
|
|||
|
||||
var ns = key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null;
|
||||
|
||||
if (isNullish(value)) {
|
||||
if (ns) {
|
||||
elem.removeAttributeNS(ns, key);
|
||||
} else {
|
||||
elem.removeAttribute(key);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ns) {
|
||||
elem.setAttributeNS(ns, key, value);
|
||||
} else if (!unitCheck) {
|
||||
|
@ -14007,6 +14021,10 @@ var SvgCanvas = (function () {
|
|||
}
|
||||
}
|
||||
|
||||
if (!selectedElements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
call('selected', selectedElements);
|
||||
|
||||
if (showGrips || selectedElements.length === 1) {
|
||||
|
@ -17431,6 +17449,16 @@ var SvgCanvas = (function () {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_attrVal === 'null') {
|
||||
var styleName = _attr.localName.replace(/-[a-z]/g, function (s) {
|
||||
return s[1].toUpperCase();
|
||||
});
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (_attrVal !== '') {
|
||||
if (_attrVal.startsWith('pointer-events')) {
|
||||
continue;
|
||||
|
@ -17485,7 +17513,7 @@ var SvgCanvas = (function () {
|
|||
case 1:
|
||||
// element node
|
||||
out.push('\n');
|
||||
out.push(this.svgToString(childs.item(_i4), indent));
|
||||
out.push(this.svgToString(child, indent));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -17891,7 +17919,8 @@ var SvgCanvas = (function () {
|
|||
_context3.next = 4;
|
||||
return importScript([// We do not currently have these paths configurable as they are
|
||||
// currently global-only, so not Rolled-up
|
||||
'jspdf/underscore-min.js', 'jspdf/jspdf.min.js']);
|
||||
'jspdf/underscore-min.js', // 'jspdf/jspdf.min.js',
|
||||
'../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js']);
|
||||
|
||||
case 4:
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false; // Todo: Switch to `import()` when widely supported and available (also allow customization of path)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
|
@ -6585,7 +6585,7 @@
|
|||
x2 = seg.x2 || 0,
|
||||
y2 = seg.y2 || 0;
|
||||
var type = seg.pathSegType;
|
||||
var letter = pathMap[type]['to' + (toRel ? 'Lower' : 'Upper') + 'Case']();
|
||||
var letter = pathMap[type][toRel ? 'toLowerCase' : 'toUpperCase']();
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -6607,16 +6607,18 @@
|
|||
case 13:
|
||||
// relative horizontal line (h)
|
||||
if (toRel) {
|
||||
y = 0;
|
||||
curx += x;
|
||||
letter = 'l';
|
||||
} else {
|
||||
y = cury;
|
||||
x += curx;
|
||||
curx = x;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[x, cury]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
@ -6627,16 +6629,18 @@
|
|||
case 15:
|
||||
// relative vertical line (v)
|
||||
if (toRel) {
|
||||
x = 0;
|
||||
cury += y;
|
||||
letter = 'l';
|
||||
} else {
|
||||
x = curx;
|
||||
y += cury;
|
||||
cury = y;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[curx, y]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 2: // absolute move (M)
|
||||
|
@ -9166,6 +9170,16 @@
|
|||
|
||||
var ns = key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null;
|
||||
|
||||
if (isNullish(value)) {
|
||||
if (ns) {
|
||||
elem.removeAttributeNS(ns, key);
|
||||
} else {
|
||||
elem.removeAttribute(key);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ns) {
|
||||
elem.setAttributeNS(ns, key, value);
|
||||
} else if (!unitCheck) {
|
||||
|
@ -14320,6 +14334,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!selectedElements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
call('selected', selectedElements);
|
||||
|
||||
if (showGrips || selectedElements.length === 1) {
|
||||
|
@ -17744,6 +17762,16 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_attrVal === 'null') {
|
||||
var styleName = _attr.localName.replace(/-[a-z]/g, function (s) {
|
||||
return s[1].toUpperCase();
|
||||
});
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (_attrVal !== '') {
|
||||
if (_attrVal.startsWith('pointer-events')) {
|
||||
continue;
|
||||
|
@ -17798,7 +17826,7 @@
|
|||
case 1:
|
||||
// element node
|
||||
out.push('\n');
|
||||
out.push(this.svgToString(childs.item(_i4), indent));
|
||||
out.push(this.svgToString(child, indent));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -18204,7 +18232,8 @@
|
|||
_context3.next = 4;
|
||||
return importScript([// We do not currently have these paths configurable as they are
|
||||
// currently global-only, so not Rolled-up
|
||||
'jspdf/underscore-min.js', 'jspdf/jspdf.min.js']);
|
||||
'jspdf/underscore-min.js', // 'jspdf/jspdf.min.js',
|
||||
'../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js']);
|
||||
|
||||
case 4:
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false; // Todo: Switch to `import()` when widely supported and available (also allow customization of path)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
26
package.json
26
package.json
|
@ -121,21 +121,21 @@
|
|||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.0",
|
||||
"@babel/node": "^7.8.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.8.0",
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.8.0",
|
||||
"@babel/preset-env": "^7.8.2",
|
||||
"@babel/core": "^7.8.3",
|
||||
"@babel/node": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3",
|
||||
"@babel/preset-env": "^7.8.3",
|
||||
"@cypress/code-coverage": "^1.10.4",
|
||||
"@cypress/fiddle": "^1.4.0",
|
||||
"@mysticatea/eslint-plugin": "^13.0.0",
|
||||
"axe-core": "^3.4.1",
|
||||
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
|
||||
"coffeescript": "^2.5.0",
|
||||
"copyfiles": "^2.1.1",
|
||||
"core-js-bundle": "^3.6.3",
|
||||
"copyfiles": "^2.2.0",
|
||||
"core-js-bundle": "^3.6.4",
|
||||
"coveradge": "^0.2.0",
|
||||
"cypress": "^3.8.2",
|
||||
"cypress": "^3.8.3",
|
||||
"cypress-axe": "^0.5.3",
|
||||
"cypress-multi-reporters": "^1.2.3",
|
||||
"deparam": "git+https://github.com/brettz9/deparam.git#updates",
|
||||
|
@ -143,12 +143,12 @@
|
|||
"eslint-config-ash-nazg": "^16.5.0",
|
||||
"eslint-config-standard": "^14.1.0",
|
||||
"eslint-plugin-array-func": "^3.1.3",
|
||||
"eslint-plugin-compat": "^3.3.0",
|
||||
"eslint-plugin-compat": "^3.5.1",
|
||||
"eslint-plugin-cypress": "^2.8.1",
|
||||
"eslint-plugin-eslint-comments": "^3.1.2",
|
||||
"eslint-plugin-html": "^6.0.0",
|
||||
"eslint-plugin-import": "^2.20.0",
|
||||
"eslint-plugin-jsdoc": "^20.3.0",
|
||||
"eslint-plugin-jsdoc": "^20.4.0",
|
||||
"eslint-plugin-markdown": "^1.0.1",
|
||||
"eslint-plugin-no-unsanitized": "^3.0.2",
|
||||
"eslint-plugin-no-use-extend-native": "^0.4.1",
|
||||
|
@ -160,7 +160,7 @@
|
|||
"frs-replace": "^2.0.1",
|
||||
"gh-badges": "^2.2.1",
|
||||
"imageoptim-cli": "^3.0.2",
|
||||
"jamilih": "^0.47.0",
|
||||
"jamilih": "^0.48.1",
|
||||
"jsdoc": "^3.6.3",
|
||||
"license-badger": "^0.9.3",
|
||||
"load-stylesheets": "^0.9.0",
|
||||
|
@ -180,12 +180,12 @@
|
|||
"remark-cli": "^7.0.1",
|
||||
"remark-lint-ordered-list-marker-value": "^1.0.4",
|
||||
"rimraf": "^3.0.0",
|
||||
"rollup": "1.29.0",
|
||||
"rollup": "1.29.1",
|
||||
"rollup-plugin-babel": "^4.3.3",
|
||||
"rollup-plugin-re": "^1.0.7",
|
||||
"rollup-plugin-terser": "^5.2.0",
|
||||
"stackblur-canvas": "^2.2.0",
|
||||
"typescript": "^3.7.4",
|
||||
"typescript": "^3.7.5",
|
||||
"underscore": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6585,7 +6585,7 @@
|
|||
x2 = seg.x2 || 0,
|
||||
y2 = seg.y2 || 0;
|
||||
var type = seg.pathSegType;
|
||||
var letter = pathMap[type]['to' + (toRel ? 'Lower' : 'Upper') + 'Case']();
|
||||
var letter = pathMap[type][toRel ? 'toLowerCase' : 'toUpperCase']();
|
||||
|
||||
switch (type) {
|
||||
case 1:
|
||||
|
@ -6607,16 +6607,18 @@
|
|||
case 13:
|
||||
// relative horizontal line (h)
|
||||
if (toRel) {
|
||||
y = 0;
|
||||
curx += x;
|
||||
letter = 'l';
|
||||
} else {
|
||||
y = cury;
|
||||
x += curx;
|
||||
curx = x;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[x, cury]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
|
@ -6627,16 +6629,18 @@
|
|||
case 15:
|
||||
// relative vertical line (v)
|
||||
if (toRel) {
|
||||
x = 0;
|
||||
cury += y;
|
||||
letter = 'l';
|
||||
} else {
|
||||
x = curx;
|
||||
y += cury;
|
||||
cury = y;
|
||||
letter = 'L';
|
||||
} // Convert to "line" for easier editing
|
||||
|
||||
|
||||
d += pathDSegment(letter, [[curx, y]]);
|
||||
d += pathDSegment(letter, [[x, y]]);
|
||||
break;
|
||||
|
||||
case 2: // absolute move (M)
|
||||
|
@ -9166,6 +9170,16 @@
|
|||
|
||||
var ns = key.substr(0, 4) === 'xml:' ? NS.XML : key.substr(0, 6) === 'xlink:' ? NS.XLINK : null;
|
||||
|
||||
if (isNullish(value)) {
|
||||
if (ns) {
|
||||
elem.removeAttributeNS(ns, key);
|
||||
} else {
|
||||
elem.removeAttribute(key);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ns) {
|
||||
elem.setAttributeNS(ns, key, value);
|
||||
} else if (!unitCheck) {
|
||||
|
@ -14320,6 +14334,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (!selectedElements.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
call('selected', selectedElements);
|
||||
|
||||
if (showGrips || selectedElements.length === 1) {
|
||||
|
@ -17744,6 +17762,16 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
if (_attrVal === 'null') {
|
||||
var styleName = _attr.localName.replace(/-[a-z]/g, function (s) {
|
||||
return s[1].toUpperCase();
|
||||
});
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(elem.style, styleName)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (_attrVal !== '') {
|
||||
if (_attrVal.startsWith('pointer-events')) {
|
||||
continue;
|
||||
|
@ -17798,7 +17826,7 @@
|
|||
case 1:
|
||||
// element node
|
||||
out.push('\n');
|
||||
out.push(this.svgToString(childs.item(_i4), indent));
|
||||
out.push(this.svgToString(child, indent));
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
@ -18204,7 +18232,8 @@
|
|||
_context3.next = 4;
|
||||
return importScript([// We do not currently have these paths configurable as they are
|
||||
// currently global-only, so not Rolled-up
|
||||
'jspdf/underscore-min.js', 'jspdf/jspdf.min.js']);
|
||||
'jspdf/underscore-min.js', // 'jspdf/jspdf.min.js',
|
||||
'../../svgedit-myfix/editor/jspdf/jspdf-1.0.150.debug.js']);
|
||||
|
||||
case 4:
|
||||
modularVersion = !('svgEditor' in window) || !window.svgEditor || window.svgEditor.modules !== false; // Todo: Switch to `import()` when widely supported and available (also allow customization of path)
|
||||
|
|
Loading…
Reference in New Issue