- Linting (ESLint): Update polyfills to new compat rules of
eslint-config-ash-nazg and adhere to new rules (prefer `for-of` (or array methods) to `for`, catch preferred `includes` to `indexOf`); avoid `no-zero-fractions` rule for now - npm: Update devDeps (removing one unneeded)master
parent
28c0c60bb8
commit
1ae6e91bb0
43
.eslintrc.js
43
.eslintrc.js
|
@ -12,7 +12,39 @@ module.exports = {
|
|||
browser: true
|
||||
},
|
||||
settings: {
|
||||
polyfills: ["url", "promises", "fetch", "queryselector", "object-values"],
|
||||
polyfills: [
|
||||
"Array.isArray",
|
||||
"Blob",
|
||||
"console",
|
||||
"Date.now",
|
||||
"document.body",
|
||||
"document.evaluate",
|
||||
"document.head",
|
||||
"document.importNode",
|
||||
"document.querySelector", "document.querySelectorAll",
|
||||
"DOMParser",
|
||||
"Error",
|
||||
"fetch",
|
||||
"FileReader",
|
||||
"history.pushState",
|
||||
"history.replaceState",
|
||||
"JSON",
|
||||
"location.href",
|
||||
"location.origin",
|
||||
"MutationObserver",
|
||||
"Object.assign", "Object.defineProperty", "Object.defineProperties",
|
||||
"Object.getOwnPropertyDescriptor",
|
||||
"Object.entries", "Object.keys", "Object.values",
|
||||
"Promise",
|
||||
"Set",
|
||||
"Uint8Array",
|
||||
"URL",
|
||||
"window.getComputedStyle",
|
||||
"window.postMessage",
|
||||
"window.scrollX", "window.scrollY",
|
||||
"XMLHttpRequest",
|
||||
"XMLSerializer"
|
||||
],
|
||||
jsdoc: {
|
||||
additionalTagNames: {
|
||||
// In case we need to extend
|
||||
|
@ -140,13 +172,14 @@ module.exports = {
|
|||
rules: {
|
||||
// Override these `ash-nazg/sauron` rules which are difficult for us
|
||||
// to apply at this time
|
||||
"default-case": ["off"],
|
||||
"require-unicode-regexp": ["off"],
|
||||
"default-case": "off",
|
||||
"require-unicode-regexp": "off",
|
||||
"max-len": ["off", {
|
||||
ignoreUrls: true,
|
||||
ignoreRegExpLiterals: true
|
||||
}],
|
||||
"unicorn/prefer-query-selector": ["off"],
|
||||
"unicorn/prefer-node-append": ["off"]
|
||||
"unicorn/prefer-query-selector": "off",
|
||||
"unicorn/prefer-node-append": "off",
|
||||
"unicorn/no-zero-fractions": "off"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,10 +13,15 @@
|
|||
- Enhancement: Add CAD Placemark extension (@NeiroNx)
|
||||
- Refactoring: Make dialog OK button retrievable locale-independently
|
||||
via a `data-ok` attribute (using for testing)
|
||||
- Linting (ESLint): Update polyfills to new compat rules of
|
||||
eslint-config-ash-nazg and adhere to new rules (prefer `for-of`
|
||||
(or array methods) to `for`, catch preferred `includes` to `indexOf`);
|
||||
avoid `no-zero-fractions` rule for now
|
||||
- Testing (UI Refactoring): Abstract out to helper file functions
|
||||
- Testing (UI Refactoring): Avoid testing being locale-dependent;
|
||||
approve storage (and set locale to English) before each test
|
||||
- npm: Update devDeps; update nested deps for security audit
|
||||
- npm: Update devDeps; update nested deps for security audit; remove
|
||||
one unneeded)
|
||||
|
||||
## 4.2.0
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
this.parentNode.removeChild(this);
|
||||
this.parentNode.removeChild(this); // eslint-disable-line unicorn/prefer-node-remove
|
||||
}
|
||||
};
|
||||
mixin(DocumentType, ChildNode);
|
||||
|
|
|
@ -73,16 +73,10 @@ var svgEditorExtension_grid = (function () {
|
|||
|
||||
var rawM = 100 / uMulti;
|
||||
var multi = 1;
|
||||
|
||||
for (var i = 0; i < intervals.length; i++) {
|
||||
var num = intervals[i];
|
||||
intervals.some(function (num) {
|
||||
multi = num;
|
||||
|
||||
if (rawM <= num) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rawM <= num;
|
||||
});
|
||||
var bigInt = multi * uMulti; // Set the canvas size to the width of the container
|
||||
|
||||
hcanvas.width = bigInt;
|
||||
|
@ -93,8 +87,8 @@ var svgEditorExtension_grid = (function () {
|
|||
ctx.globalAlpha = 0.2;
|
||||
ctx.strokeStyle = svgEditor.curConfig.gridColor;
|
||||
|
||||
for (var _i = 1; _i < 10; _i++) {
|
||||
var subD = Math.round(part * _i) + 0.5; // const lineNum = (i % 2)?12:10;
|
||||
for (var i = 1; i < 10; i++) {
|
||||
var subD = Math.round(part * i) + 0.5; // const lineNum = (i % 2)?12:10;
|
||||
|
||||
var lineNum = 0;
|
||||
ctx.moveTo(subD, bigInt);
|
||||
|
|
|
@ -6286,21 +6286,21 @@ function () {
|
|||
}, {
|
||||
key: "addPtsToSelection",
|
||||
value: function addPtsToSelection(indexes) {
|
||||
var _this = this;
|
||||
|
||||
if (!Array.isArray(indexes)) {
|
||||
indexes = [indexes];
|
||||
}
|
||||
|
||||
for (var _i4 = 0; _i4 < indexes.length; _i4++) {
|
||||
var index = indexes[_i4];
|
||||
var seg = this.segs[index];
|
||||
indexes.forEach(function (index) {
|
||||
var seg = _this.segs[index];
|
||||
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
if (!_this.selected_pts.includes(index) && index >= 0) {
|
||||
_this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
var i = this.selected_pts.length;
|
||||
var grips = [];
|
||||
|
@ -6308,11 +6308,9 @@ function () {
|
|||
|
||||
while (i--) {
|
||||
var pt = this.selected_pts[i];
|
||||
var _seg2 = this.segs[pt];
|
||||
|
||||
_seg2.select(true);
|
||||
|
||||
grips[i] = _seg2.ptgrip;
|
||||
var seg = this.segs[pt];
|
||||
seg.select(true);
|
||||
grips[i] = seg.ptgrip;
|
||||
}
|
||||
|
||||
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
|
||||
|
@ -10843,6 +10841,8 @@ function () {
|
|||
}, {
|
||||
key: "cloneLayer",
|
||||
value: function cloneLayer(name, hrService) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.current_layer) {
|
||||
return null;
|
||||
}
|
||||
|
@ -10858,17 +10858,15 @@ function () {
|
|||
var layer = new Layer(name, currentGroup, this.svgElem_);
|
||||
var group = layer.getGroup(); // Clone children
|
||||
|
||||
var children = currentGroup.childNodes;
|
||||
var children = _toConsumableArray(currentGroup.childNodes);
|
||||
|
||||
for (var _index = 0; _index < children.length; _index++) {
|
||||
var ch = children[_index];
|
||||
|
||||
if (ch.localName === 'title') {
|
||||
continue;
|
||||
children.forEach(function (child) {
|
||||
if (child.localName === 'title') {
|
||||
return;
|
||||
}
|
||||
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
group.append(_this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
@ -16457,9 +16455,9 @@ function SvgCanvas(container, config) {
|
|||
var commaIndex = coords.indexOf(',');
|
||||
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
|
@ -18737,10 +18735,29 @@ function SvgCanvas(container, config) {
|
|||
}
|
||||
|
||||
var attrs = svg.attributes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
try {
|
||||
for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var attr = _step.value;
|
||||
// Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.id = getNextId(); // Store data
|
||||
|
@ -31398,8 +31415,7 @@ editor.init = function () {
|
|||
setSelectMode();
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < elems.length; ++_i) {
|
||||
var elem = elems[_i];
|
||||
elems.forEach(function (elem) {
|
||||
var isSvgElem = elem && elem.tagName === 'svg';
|
||||
|
||||
if (isSvgElem || isLayer(elem)) {
|
||||
|
@ -31414,8 +31430,7 @@ editor.init = function () {
|
|||
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
|
||||
selectedElement = elem;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
editor.showSaveWarning = true; // we update the contextual panel with potentially new
|
||||
// positional/sizing information (we DON'T want to update the
|
||||
// toolbar here as that creates an infinite loop)
|
||||
|
@ -34235,10 +34250,10 @@ editor.init = function () {
|
|||
|
||||
if (isMac() && !window.opera) {
|
||||
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
|
||||
var _i2 = shortcutButtons.length;
|
||||
var _i = shortcutButtons.length;
|
||||
|
||||
while (_i2--) {
|
||||
var button = document.getElementById(shortcutButtons[_i2]);
|
||||
while (_i--) {
|
||||
var button = document.getElementById(shortcutButtons[_i]);
|
||||
|
||||
if (button) {
|
||||
var title = button.title;
|
||||
|
@ -34363,11 +34378,11 @@ editor.init = function () {
|
|||
var childs = selectedElement.getElementsByTagName('*');
|
||||
var gPaint = null;
|
||||
|
||||
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) {
|
||||
var elem = childs[_i3];
|
||||
for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
|
||||
var elem = childs[_i2];
|
||||
var p = elem.getAttribute(type);
|
||||
|
||||
if (_i3 === 0) {
|
||||
if (_i2 === 0) {
|
||||
gPaint = p;
|
||||
} else if (gPaint !== p) {
|
||||
gPaint = null;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6292,21 +6292,21 @@
|
|||
}, {
|
||||
key: "addPtsToSelection",
|
||||
value: function addPtsToSelection(indexes) {
|
||||
var _this = this;
|
||||
|
||||
if (!Array.isArray(indexes)) {
|
||||
indexes = [indexes];
|
||||
}
|
||||
|
||||
for (var _i4 = 0; _i4 < indexes.length; _i4++) {
|
||||
var index = indexes[_i4];
|
||||
var seg = this.segs[index];
|
||||
indexes.forEach(function (index) {
|
||||
var seg = _this.segs[index];
|
||||
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
if (!_this.selected_pts.includes(index) && index >= 0) {
|
||||
_this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
var i = this.selected_pts.length;
|
||||
var grips = [];
|
||||
|
@ -6314,11 +6314,9 @@
|
|||
|
||||
while (i--) {
|
||||
var pt = this.selected_pts[i];
|
||||
var _seg2 = this.segs[pt];
|
||||
|
||||
_seg2.select(true);
|
||||
|
||||
grips[i] = _seg2.ptgrip;
|
||||
var seg = this.segs[pt];
|
||||
seg.select(true);
|
||||
grips[i] = seg.ptgrip;
|
||||
}
|
||||
|
||||
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
|
||||
|
@ -10849,6 +10847,8 @@
|
|||
}, {
|
||||
key: "cloneLayer",
|
||||
value: function cloneLayer(name, hrService) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.current_layer) {
|
||||
return null;
|
||||
}
|
||||
|
@ -10864,17 +10864,15 @@
|
|||
var layer = new Layer(name, currentGroup, this.svgElem_);
|
||||
var group = layer.getGroup(); // Clone children
|
||||
|
||||
var children = currentGroup.childNodes;
|
||||
var children = _toConsumableArray(currentGroup.childNodes);
|
||||
|
||||
for (var _index = 0; _index < children.length; _index++) {
|
||||
var ch = children[_index];
|
||||
|
||||
if (ch.localName === 'title') {
|
||||
continue;
|
||||
children.forEach(function (child) {
|
||||
if (child.localName === 'title') {
|
||||
return;
|
||||
}
|
||||
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
group.append(_this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
@ -16463,9 +16461,9 @@
|
|||
var commaIndex = coords.indexOf(',');
|
||||
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
|
@ -18743,10 +18741,29 @@
|
|||
}
|
||||
|
||||
var attrs = svg.attributes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
try {
|
||||
for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var attr = _step.value;
|
||||
// Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.id = getNextId(); // Store data
|
||||
|
@ -31404,8 +31421,7 @@
|
|||
setSelectMode();
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < elems.length; ++_i) {
|
||||
var elem = elems[_i];
|
||||
elems.forEach(function (elem) {
|
||||
var isSvgElem = elem && elem.tagName === 'svg';
|
||||
|
||||
if (isSvgElem || isLayer(elem)) {
|
||||
|
@ -31420,8 +31436,7 @@
|
|||
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
|
||||
selectedElement = elem;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
editor.showSaveWarning = true; // we update the contextual panel with potentially new
|
||||
// positional/sizing information (we DON'T want to update the
|
||||
// toolbar here as that creates an infinite loop)
|
||||
|
@ -34241,10 +34256,10 @@
|
|||
|
||||
if (isMac() && !window.opera) {
|
||||
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
|
||||
var _i2 = shortcutButtons.length;
|
||||
var _i = shortcutButtons.length;
|
||||
|
||||
while (_i2--) {
|
||||
var button = document.getElementById(shortcutButtons[_i2]);
|
||||
while (_i--) {
|
||||
var button = document.getElementById(shortcutButtons[_i]);
|
||||
|
||||
if (button) {
|
||||
var title = button.title;
|
||||
|
@ -34369,11 +34384,11 @@
|
|||
var childs = selectedElement.getElementsByTagName('*');
|
||||
var gPaint = null;
|
||||
|
||||
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) {
|
||||
var elem = childs[_i3];
|
||||
for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
|
||||
var elem = childs[_i2];
|
||||
var p = elem.getAttribute(type);
|
||||
|
||||
if (_i3 === 0) {
|
||||
if (_i2 === 0) {
|
||||
gPaint = p;
|
||||
} else if (gPaint !== p) {
|
||||
gPaint = null;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6348,21 +6348,21 @@ var SvgCanvas = (function () {
|
|||
}, {
|
||||
key: "addPtsToSelection",
|
||||
value: function addPtsToSelection(indexes) {
|
||||
var _this = this;
|
||||
|
||||
if (!Array.isArray(indexes)) {
|
||||
indexes = [indexes];
|
||||
}
|
||||
|
||||
for (var _i4 = 0; _i4 < indexes.length; _i4++) {
|
||||
var index = indexes[_i4];
|
||||
var seg = this.segs[index];
|
||||
indexes.forEach(function (index) {
|
||||
var seg = _this.segs[index];
|
||||
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
if (!_this.selected_pts.includes(index) && index >= 0) {
|
||||
_this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
var i = this.selected_pts.length;
|
||||
var grips = [];
|
||||
|
@ -6370,11 +6370,9 @@ var SvgCanvas = (function () {
|
|||
|
||||
while (i--) {
|
||||
var pt = this.selected_pts[i];
|
||||
var _seg2 = this.segs[pt];
|
||||
|
||||
_seg2.select(true);
|
||||
|
||||
grips[i] = _seg2.ptgrip;
|
||||
var seg = this.segs[pt];
|
||||
seg.select(true);
|
||||
grips[i] = seg.ptgrip;
|
||||
}
|
||||
|
||||
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
|
||||
|
@ -10410,6 +10408,8 @@ var SvgCanvas = (function () {
|
|||
}, {
|
||||
key: "cloneLayer",
|
||||
value: function cloneLayer(name, hrService) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.current_layer) {
|
||||
return null;
|
||||
}
|
||||
|
@ -10425,17 +10425,15 @@ var SvgCanvas = (function () {
|
|||
var layer = new Layer(name, currentGroup, this.svgElem_);
|
||||
var group = layer.getGroup(); // Clone children
|
||||
|
||||
var children = currentGroup.childNodes;
|
||||
var children = _toConsumableArray(currentGroup.childNodes);
|
||||
|
||||
for (var _index = 0; _index < children.length; _index++) {
|
||||
var ch = children[_index];
|
||||
|
||||
if (ch.localName === 'title') {
|
||||
continue;
|
||||
children.forEach(function (child) {
|
||||
if (child.localName === 'title') {
|
||||
return;
|
||||
}
|
||||
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
group.append(_this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
@ -16235,9 +16233,9 @@ var SvgCanvas = (function () {
|
|||
var commaIndex = coords.indexOf(',');
|
||||
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
|
@ -18515,10 +18513,29 @@ var SvgCanvas = (function () {
|
|||
}
|
||||
|
||||
var attrs = svg.attributes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
try {
|
||||
for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var attr = _step.value;
|
||||
// Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.id = getNextId(); // Store data
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -574,12 +574,11 @@ export class Drawing {
|
|||
const group = layer.getGroup();
|
||||
|
||||
// Clone children
|
||||
const children = currentGroup.childNodes;
|
||||
for (let index = 0; index < children.length; index++) {
|
||||
const ch = children[index];
|
||||
if (ch.localName === 'title') { continue; }
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
const children = [...currentGroup.childNodes];
|
||||
children.forEach((child) => {
|
||||
if (child.localName === 'title') { return; }
|
||||
group.append(this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
|
|
@ -83,13 +83,10 @@ export default {
|
|||
// Calculate the main number interval
|
||||
const rawM = 100 / uMulti;
|
||||
let multi = 1;
|
||||
for (let i = 0; i < intervals.length; i++) {
|
||||
const num = intervals[i];
|
||||
intervals.some((num) => {
|
||||
multi = num;
|
||||
if (rawM <= num) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rawM <= num;
|
||||
});
|
||||
const bigInt = multi * uMulti;
|
||||
|
||||
// Set the canvas size to the width of the container
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -108,7 +108,7 @@ const ChildNode = {
|
|||
},
|
||||
remove () {
|
||||
if (!this.parentNode) { return; }
|
||||
this.parentNode.removeChild(this);
|
||||
this.parentNode.removeChild(this); // eslint-disable-line unicorn/prefer-node-remove
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1282,15 +1282,14 @@ export class Path {
|
|||
*/
|
||||
addPtsToSelection (indexes) {
|
||||
if (!Array.isArray(indexes)) { indexes = [indexes]; }
|
||||
for (let i = 0; i < indexes.length; i++) {
|
||||
const index = indexes[i];
|
||||
indexes.forEach((index) => {
|
||||
const seg = this.segs[index];
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
let i = this.selected_pts.length;
|
||||
const grips = [];
|
||||
|
|
|
@ -2622,9 +2622,7 @@ editor.init = function () {
|
|||
setSelectMode();
|
||||
}
|
||||
|
||||
for (let i = 0; i < elems.length; ++i) {
|
||||
const elem = elems[i];
|
||||
|
||||
elems.forEach((elem) => {
|
||||
const isSvgElem = (elem && elem.tagName === 'svg');
|
||||
if (isSvgElem || isLayer(elem)) {
|
||||
populateLayers();
|
||||
|
@ -2638,7 +2636,7 @@ editor.init = function () {
|
|||
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
|
||||
selectedElement = elem;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
editor.showSaveWarning = true;
|
||||
|
||||
|
|
|
@ -2681,9 +2681,9 @@ const mouseUp = function (evt) {
|
|||
const coords = element.getAttribute('points');
|
||||
const commaIndex = coords.indexOf(',');
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
if (keep) {
|
||||
element = pathActions.smoothPolylineIntoPath(element);
|
||||
|
@ -4736,8 +4736,7 @@ this.importSvgString = function (xmlString) {
|
|||
symbol.append(first);
|
||||
}
|
||||
const attrs = svg.attributes;
|
||||
for (let i = 0; i < attrs.length; i++) {
|
||||
const attr = attrs[i];
|
||||
for (const attr of attrs) { // Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
symbol.id = getNextId();
|
||||
|
|
|
@ -6289,21 +6289,21 @@
|
|||
}, {
|
||||
key: "addPtsToSelection",
|
||||
value: function addPtsToSelection(indexes) {
|
||||
var _this = this;
|
||||
|
||||
if (!Array.isArray(indexes)) {
|
||||
indexes = [indexes];
|
||||
}
|
||||
|
||||
for (var _i4 = 0; _i4 < indexes.length; _i4++) {
|
||||
var index = indexes[_i4];
|
||||
var seg = this.segs[index];
|
||||
indexes.forEach(function (index) {
|
||||
var seg = _this.segs[index];
|
||||
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
if (!_this.selected_pts.includes(index) && index >= 0) {
|
||||
_this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
var i = this.selected_pts.length;
|
||||
var grips = [];
|
||||
|
@ -6311,11 +6311,9 @@
|
|||
|
||||
while (i--) {
|
||||
var pt = this.selected_pts[i];
|
||||
var _seg2 = this.segs[pt];
|
||||
|
||||
_seg2.select(true);
|
||||
|
||||
grips[i] = _seg2.ptgrip;
|
||||
var seg = this.segs[pt];
|
||||
seg.select(true);
|
||||
grips[i] = seg.ptgrip;
|
||||
}
|
||||
|
||||
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
|
||||
|
@ -10846,6 +10844,8 @@
|
|||
}, {
|
||||
key: "cloneLayer",
|
||||
value: function cloneLayer(name, hrService) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.current_layer) {
|
||||
return null;
|
||||
}
|
||||
|
@ -10861,17 +10861,15 @@
|
|||
var layer = new Layer(name, currentGroup, this.svgElem_);
|
||||
var group = layer.getGroup(); // Clone children
|
||||
|
||||
var children = currentGroup.childNodes;
|
||||
var children = _toConsumableArray(currentGroup.childNodes);
|
||||
|
||||
for (var _index = 0; _index < children.length; _index++) {
|
||||
var ch = children[_index];
|
||||
|
||||
if (ch.localName === 'title') {
|
||||
continue;
|
||||
children.forEach(function (child) {
|
||||
if (child.localName === 'title') {
|
||||
return;
|
||||
}
|
||||
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
group.append(_this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
@ -16460,9 +16458,9 @@
|
|||
var commaIndex = coords.indexOf(',');
|
||||
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
|
@ -18740,10 +18738,29 @@
|
|||
}
|
||||
|
||||
var attrs = svg.attributes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
try {
|
||||
for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var attr = _step.value;
|
||||
// Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.id = getNextId(); // Store data
|
||||
|
@ -31401,8 +31418,7 @@
|
|||
setSelectMode();
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < elems.length; ++_i) {
|
||||
var elem = elems[_i];
|
||||
elems.forEach(function (elem) {
|
||||
var isSvgElem = elem && elem.tagName === 'svg';
|
||||
|
||||
if (isSvgElem || isLayer(elem)) {
|
||||
|
@ -31417,8 +31433,7 @@
|
|||
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
|
||||
selectedElement = elem;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
editor.showSaveWarning = true; // we update the contextual panel with potentially new
|
||||
// positional/sizing information (we DON'T want to update the
|
||||
// toolbar here as that creates an infinite loop)
|
||||
|
@ -34238,10 +34253,10 @@
|
|||
|
||||
if (isMac() && !window.opera) {
|
||||
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
|
||||
var _i2 = shortcutButtons.length;
|
||||
var _i = shortcutButtons.length;
|
||||
|
||||
while (_i2--) {
|
||||
var button = document.getElementById(shortcutButtons[_i2]);
|
||||
while (_i--) {
|
||||
var button = document.getElementById(shortcutButtons[_i]);
|
||||
|
||||
if (button) {
|
||||
var title = button.title;
|
||||
|
@ -34366,11 +34381,11 @@
|
|||
var childs = selectedElement.getElementsByTagName('*');
|
||||
var gPaint = null;
|
||||
|
||||
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) {
|
||||
var elem = childs[_i3];
|
||||
for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
|
||||
var elem = childs[_i2];
|
||||
var p = elem.getAttribute(type);
|
||||
|
||||
if (_i3 === 0) {
|
||||
if (_i2 === 0) {
|
||||
gPaint = p;
|
||||
} else if (gPaint !== p) {
|
||||
gPaint = null;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
|
@ -76,21 +76,21 @@
|
|||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.3.4",
|
||||
"@babel/core": "^7.4.0",
|
||||
"@babel/node": "^7.2.2",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
|
||||
"@babel/polyfill": "^7.2.5",
|
||||
"@babel/preset-env": "^7.3.4",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.4.0",
|
||||
"@babel/polyfill": "^7.4.0",
|
||||
"@babel/preset-env": "^7.4.2",
|
||||
"@mysticatea/eslint-plugin": "^9.0.1",
|
||||
"axe-testcafe": "^1.1.0",
|
||||
"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3",
|
||||
"eslint": "5.15.2",
|
||||
"eslint-config-ash-nazg": "0.5.0",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-config-ash-nazg": "1.0.2",
|
||||
"eslint-config-standard": "12.0.0",
|
||||
"eslint-plugin-compat": "^2.7.0",
|
||||
"eslint-plugin-compat": "^3.1.0",
|
||||
"eslint-plugin-eslint-comments": "^3.1.1",
|
||||
"eslint-plugin-import": "2.16.0",
|
||||
"eslint-plugin-jsdoc": "^4.4.2",
|
||||
"eslint-plugin-jsdoc": "^4.6.0",
|
||||
"eslint-plugin-markdown": "^1.0.0",
|
||||
"eslint-plugin-no-use-extend-native": "^0.4.0",
|
||||
"eslint-plugin-node": "8.0.1",
|
||||
|
@ -98,7 +98,7 @@
|
|||
"eslint-plugin-qunit": "^4.0.0",
|
||||
"eslint-plugin-standard": "4.0.0",
|
||||
"eslint-plugin-testcafe": "^0.2.1",
|
||||
"eslint-plugin-unicorn": "^7.1.0",
|
||||
"eslint-plugin-unicorn": "^8.0.1",
|
||||
"find-in-files": "^0.5.0",
|
||||
"imageoptim-cli": "^2.3.5",
|
||||
"jamilih": "^0.44.0",
|
||||
|
@ -112,15 +112,14 @@
|
|||
"qunit": "^2.9.2",
|
||||
"remark-cli": "^6.0.1",
|
||||
"remark-lint-ordered-list-marker-value": "^1.0.2",
|
||||
"rollup": "1.6.0",
|
||||
"rollup": "1.7.4",
|
||||
"rollup-plugin-babel": "^4.3.2",
|
||||
"rollup-plugin-commonjs": "^9.2.1",
|
||||
"rollup-plugin-json": "^3.1.0",
|
||||
"rollup-plugin-commonjs": "^9.2.2",
|
||||
"rollup-plugin-node-builtins": "^2.1.2",
|
||||
"rollup-plugin-node-resolve": "^4.0.1",
|
||||
"rollup-plugin-re": "^1.0.7",
|
||||
"rollup-plugin-terser": "^4.0.4",
|
||||
"sinon": "^7.2.7",
|
||||
"sinon": "^7.3.1",
|
||||
"sinon-test": "^2.4.0",
|
||||
"stackblur-canvas": "^2.2.0",
|
||||
"testcafe": "^1.1.0"
|
||||
|
|
|
@ -180,7 +180,7 @@ const SlideShow = function (slides) {
|
|||
SlideShow.prototype = {
|
||||
_slides: [],
|
||||
_update (dontPush) {
|
||||
document.querySelector('#presentation-counter').innerText = this.current;
|
||||
document.querySelector('#presentation-counter').textContent = this.current;
|
||||
if (history.pushState) {
|
||||
if (!dontPush) {
|
||||
history.pushState(this.current, 'Slide ' + this.current, '#slide' + this.current);
|
||||
|
|
|
@ -6289,21 +6289,21 @@
|
|||
}, {
|
||||
key: "addPtsToSelection",
|
||||
value: function addPtsToSelection(indexes) {
|
||||
var _this = this;
|
||||
|
||||
if (!Array.isArray(indexes)) {
|
||||
indexes = [indexes];
|
||||
}
|
||||
|
||||
for (var _i4 = 0; _i4 < indexes.length; _i4++) {
|
||||
var index = indexes[_i4];
|
||||
var seg = this.segs[index];
|
||||
indexes.forEach(function (index) {
|
||||
var seg = _this.segs[index];
|
||||
|
||||
if (seg.ptgrip) {
|
||||
if (!this.selected_pts.includes(index) && index >= 0) {
|
||||
this.selected_pts.push(index);
|
||||
if (!_this.selected_pts.includes(index) && index >= 0) {
|
||||
_this.selected_pts.push(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
this.selected_pts.sort();
|
||||
var i = this.selected_pts.length;
|
||||
var grips = [];
|
||||
|
@ -6311,11 +6311,9 @@
|
|||
|
||||
while (i--) {
|
||||
var pt = this.selected_pts[i];
|
||||
var _seg2 = this.segs[pt];
|
||||
|
||||
_seg2.select(true);
|
||||
|
||||
grips[i] = _seg2.ptgrip;
|
||||
var seg = this.segs[pt];
|
||||
seg.select(true);
|
||||
grips[i] = seg.ptgrip;
|
||||
}
|
||||
|
||||
var closedSubpath = Path.subpathIsClosed(this.selected_pts[0]);
|
||||
|
@ -10846,6 +10844,8 @@
|
|||
}, {
|
||||
key: "cloneLayer",
|
||||
value: function cloneLayer(name, hrService) {
|
||||
var _this = this;
|
||||
|
||||
if (!this.current_layer) {
|
||||
return null;
|
||||
}
|
||||
|
@ -10861,17 +10861,15 @@
|
|||
var layer = new Layer(name, currentGroup, this.svgElem_);
|
||||
var group = layer.getGroup(); // Clone children
|
||||
|
||||
var children = currentGroup.childNodes;
|
||||
var children = _toConsumableArray(currentGroup.childNodes);
|
||||
|
||||
for (var _index = 0; _index < children.length; _index++) {
|
||||
var ch = children[_index];
|
||||
|
||||
if (ch.localName === 'title') {
|
||||
continue;
|
||||
children.forEach(function (child) {
|
||||
if (child.localName === 'title') {
|
||||
return;
|
||||
}
|
||||
|
||||
group.append(this.copyElem(ch));
|
||||
}
|
||||
group.append(_this.copyElem(child));
|
||||
});
|
||||
|
||||
if (hrService) {
|
||||
hrService.startBatchCommand('Duplicate Layer');
|
||||
|
@ -16460,9 +16458,9 @@
|
|||
var commaIndex = coords.indexOf(',');
|
||||
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.indexOf(',', commaIndex + 1) >= 0;
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.indexOf(' ', coords.indexOf(' ') + 1) >= 0;
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
|
||||
if (keep) {
|
||||
|
@ -18740,10 +18738,29 @@
|
|||
}
|
||||
|
||||
var attrs = svg.attributes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
var attr = attrs[i];
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
try {
|
||||
for (var _iterator = attrs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var attr = _step.value;
|
||||
// Ok for `NamedNodeMap`
|
||||
symbol.setAttribute(attr.nodeName, attr.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol.id = getNextId(); // Store data
|
||||
|
@ -31401,8 +31418,7 @@
|
|||
setSelectMode();
|
||||
}
|
||||
|
||||
for (var _i = 0; _i < elems.length; ++_i) {
|
||||
var elem = elems[_i];
|
||||
elems.forEach(function (elem) {
|
||||
var isSvgElem = elem && elem.tagName === 'svg';
|
||||
|
||||
if (isSvgElem || isLayer(elem)) {
|
||||
|
@ -31417,8 +31433,7 @@
|
|||
// || elem && elem.tagName == "path" && !multiselected) { // This was added in r1430, but not sure why
|
||||
selectedElement = elem;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
editor.showSaveWarning = true; // we update the contextual panel with potentially new
|
||||
// positional/sizing information (we DON'T want to update the
|
||||
// toolbar here as that creates an infinite loop)
|
||||
|
@ -34238,10 +34253,10 @@
|
|||
|
||||
if (isMac() && !window.opera) {
|
||||
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
|
||||
var _i2 = shortcutButtons.length;
|
||||
var _i = shortcutButtons.length;
|
||||
|
||||
while (_i2--) {
|
||||
var button = document.getElementById(shortcutButtons[_i2]);
|
||||
while (_i--) {
|
||||
var button = document.getElementById(shortcutButtons[_i]);
|
||||
|
||||
if (button) {
|
||||
var title = button.title;
|
||||
|
@ -34366,11 +34381,11 @@
|
|||
var childs = selectedElement.getElementsByTagName('*');
|
||||
var gPaint = null;
|
||||
|
||||
for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) {
|
||||
var elem = childs[_i3];
|
||||
for (var _i2 = 0, len = childs.length; _i2 < len; _i2++) {
|
||||
var elem = childs[_i2];
|
||||
var p = elem.getAttribute(type);
|
||||
|
||||
if (_i3 === 0) {
|
||||
if (_i2 === 0) {
|
||||
gPaint = p;
|
||||
} else if (gPaint !== p) {
|
||||
gPaint = null;
|
||||
|
|
Loading…
Reference in New Issue