npm update with fix to new eslint issues
This commit is contained in:
@@ -28,11 +28,7 @@ function transformToString (xform) {
|
||||
text = 'translate(' + m.e + ',' + m.f + ')';
|
||||
break;
|
||||
case 3: // SCALE
|
||||
if (m.a === m.d) {
|
||||
text = 'scale(' + m.a + ')';
|
||||
} else {
|
||||
text = 'scale(' + m.a + ',' + m.d + ')';
|
||||
}
|
||||
text = (m.a === m.d) ? `scale(${m.a})` : `scale(${m.a},${m.d})`;
|
||||
break;
|
||||
case 4: { // ROTATE
|
||||
let cx = 0;
|
||||
|
||||
@@ -315,11 +315,7 @@ export const convertToXMLReferences = function (input) {
|
||||
let output = '';
|
||||
[...input].forEach((ch) => {
|
||||
const c = ch.charCodeAt();
|
||||
if (c <= 127) {
|
||||
output += ch;
|
||||
} else {
|
||||
output += `&#${c};`;
|
||||
}
|
||||
output += (c <= 127) ? ch : `&#${c};`;
|
||||
});
|
||||
return output;
|
||||
};
|
||||
@@ -778,18 +774,17 @@ export const getPathDFromElement = function (elem) {
|
||||
h = b.height;
|
||||
num = 4 - num; // Why? Because!
|
||||
|
||||
if (!rx && !ry) {
|
||||
d = (!rx && !ry)
|
||||
// Regular rect
|
||||
d = getPathDFromSegments([
|
||||
? getPathDFromSegments([
|
||||
['M', [x, y]],
|
||||
['L', [x + w, y]],
|
||||
['L', [x + w, y + h]],
|
||||
['L', [x, y + h]],
|
||||
['L', [x, y]],
|
||||
['Z', []]
|
||||
]);
|
||||
} else {
|
||||
d = getPathDFromSegments([
|
||||
])
|
||||
: getPathDFromSegments([
|
||||
['M', [x, y + ry]],
|
||||
['C', [x, y + ry / num, x + rx / num, y, x + rx, y]],
|
||||
['L', [x + w - rx, y]],
|
||||
@@ -801,7 +796,6 @@ export const getPathDFromElement = function (elem) {
|
||||
['L', [x, y + ry]],
|
||||
['Z', []]
|
||||
]);
|
||||
}
|
||||
break;
|
||||
} default:
|
||||
break;
|
||||
|
||||
@@ -58,11 +58,7 @@ export default {
|
||||
svgCanvas.bind('setnonce', setArrowNonce);
|
||||
svgCanvas.bind('unsetnonce', unsetArrowNonce);
|
||||
|
||||
if (randomizeIds) {
|
||||
arrowprefix = prefix + nonce + '_';
|
||||
} else {
|
||||
arrowprefix = prefix;
|
||||
}
|
||||
arrowprefix = (randomizeIds) ? `${prefix}${nonce}_` : prefix;
|
||||
|
||||
const pathdata = {
|
||||
fw: {d: 'm0,0l10,5l-10,5l5,-5l-5,-5z', refx: 8, id: arrowprefix + 'fw'},
|
||||
|
||||
@@ -189,10 +189,7 @@ export default {
|
||||
let viewBox = '0 0 100 100';
|
||||
let markerWidth = 5;
|
||||
let markerHeight = 5;
|
||||
let seType;
|
||||
if (val.substr(0, 1) === '\\') {
|
||||
seType = val.substr(1);
|
||||
} else { seType = 'textmarker'; }
|
||||
const seType = (val.substr(0, 1) === '\\') ? val.substr(1) : 'textmarker';
|
||||
|
||||
if (!markerTypes[seType]) { return undefined; } // an unknown type!
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* eslint-disable no-bitwise, max-len */
|
||||
/* eslint-disable no-bitwise, max-len, unicorn/prefer-math-trunc, unicorn/prefer-ternary */
|
||||
/**
|
||||
* @file jPicker (Adapted from version 1.1.6)
|
||||
*
|
||||
|
||||
@@ -2498,11 +2498,7 @@ editor.init = () => {
|
||||
$(context).parentsUntil('#svgcontent > g').andSelf().each(function () {
|
||||
if (this.id) {
|
||||
str += ' > ' + this.id;
|
||||
if (this !== context) {
|
||||
linkStr += ' > <a href="#">' + this.id + '</a>';
|
||||
} else {
|
||||
linkStr += ' > ' + this.id;
|
||||
}
|
||||
linkStr += (this !== context) ? ` > <a href="#">${this.id}</a>` : ` > ${this.id}`;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2605,13 +2601,7 @@ editor.init = () => {
|
||||
if (toolButtonClick(showSel)) {
|
||||
options.fn();
|
||||
}
|
||||
let icon;
|
||||
if (options.icon) {
|
||||
icon = $.getSvgIcon(options.icon, true);
|
||||
} else {
|
||||
icon = $(options.sel).children().eq(0).clone();
|
||||
}
|
||||
|
||||
const icon = (options.icon) ? $.getSvgIcon(options.icon, true) : $(options.sel).children().eq(0).clone();
|
||||
icon[0].setAttribute('width', shower.width());
|
||||
icon[0].setAttribute('height', shower.height());
|
||||
shower.children(':not(.flyout_arrow_horiz)').remove();
|
||||
@@ -3199,11 +3189,7 @@ editor.init = () => {
|
||||
const opts = {alpha: opac};
|
||||
if (color.startsWith('url(#')) {
|
||||
let refElem = svgCanvas.getRefElem(color);
|
||||
if (refElem) {
|
||||
refElem = refElem.cloneNode(true);
|
||||
} else {
|
||||
refElem = $('#' + type + '_color defs *')[0];
|
||||
}
|
||||
refElem = (refElem) ? refElem.cloneNode(true) : $('#' + type + '_color defs *')[0];
|
||||
opts[refElem.tagName] = refElem;
|
||||
} else if (color.startsWith('#')) {
|
||||
opts.solidColor = color.substr(1);
|
||||
@@ -3267,14 +3253,10 @@ editor.init = () => {
|
||||
const colorBlocks = ['#FFF', '#888', '#000', 'chessboard'];
|
||||
str = '';
|
||||
$.each(colorBlocks, function (i, e) {
|
||||
if (e === 'chessboard') {
|
||||
str += '<div class="color_block" data-bgcolor="' + e +
|
||||
'" style="background-image:url(data:image/gif;base64,' +
|
||||
'R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG+' +
|
||||
'gq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"></div>';
|
||||
} else {
|
||||
str += '<div class="color_block" data-bgcolor="' + e + '" style="background-color:' + e + ';"></div>';
|
||||
}
|
||||
str += (e === 'chessboard')
|
||||
// eslint-disable-next-line max-len
|
||||
? `<div class="color_block" data-bgcolor="${e}" style="background-image:url(data:image/gif;base64,R0lGODlhEAAQAIAAAP///9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjGgq4jM3IFLJgpswNly/XkcBpIiVaInlLJr9FZWAQA7);"></div>`
|
||||
: `<div class="color_block" data-bgcolor="${e}" style="background-color:${e};"></div>`;
|
||||
});
|
||||
$('#bg_blocks').append(str);
|
||||
const blocks = $('#bg_blocks div');
|
||||
@@ -4344,7 +4326,7 @@ editor.init = () => {
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} pos indicate the alignment relative to top, bottom, middle etc..
|
||||
* @returns {void}
|
||||
*/
|
||||
const clickAlign = (pos) => {
|
||||
@@ -5520,12 +5502,7 @@ editor.init = () => {
|
||||
const menu = ($(sel).parents('#main_menu').length);
|
||||
|
||||
$(sel).each(function () {
|
||||
let t;
|
||||
if (menu) {
|
||||
t = $(this).text().split(' [')[0];
|
||||
} else {
|
||||
t = this.title.split(' [')[0];
|
||||
}
|
||||
const t = (menu) ? $(this).text().split(' [')[0] : this.title.split(' [')[0];
|
||||
let keyStr = '';
|
||||
// Shift+Up
|
||||
$.each(keyval.split('/'), function (i, key) {
|
||||
|
||||
@@ -93,14 +93,11 @@ const fixIDs = function (svgEl, svgNum, force) {
|
||||
const defs = svgEl.find('defs');
|
||||
if (!defs.length) return svgEl;
|
||||
|
||||
let idElems;
|
||||
if (isOpera) {
|
||||
idElems = defs.find('*').filter(function () {
|
||||
const idElems = (isOpera)
|
||||
? defs.find('*').filter(function () {
|
||||
return Boolean(this.id);
|
||||
});
|
||||
} else {
|
||||
idElems = defs.find('[id]');
|
||||
}
|
||||
})
|
||||
: defs.find('[id]');
|
||||
|
||||
const allElems = svgEl[0].getElementsByTagName('*'),
|
||||
len = allElems.length;
|
||||
|
||||
@@ -1893,10 +1893,9 @@ export const pathActions = (function () {
|
||||
const absY = seglist.getItem(0).y;
|
||||
|
||||
sSeg = stretchy.pathSegList.getItem(1);
|
||||
if (sSeg.pathSegType === 4) {
|
||||
newseg = drawnPath.createSVGPathSegLinetoAbs(absX, absY);
|
||||
} else {
|
||||
newseg = drawnPath.createSVGPathSegCurvetoCubicAbs(
|
||||
newseg = (sSeg.pathSegType === 4)
|
||||
? drawnPath.createSVGPathSegLinetoAbs(absX, absY)
|
||||
: drawnPath.createSVGPathSegCurvetoCubicAbs(
|
||||
absX,
|
||||
absY,
|
||||
sSeg.x1 / currentZoom,
|
||||
@@ -1904,8 +1903,6 @@ export const pathActions = (function () {
|
||||
absX,
|
||||
absY
|
||||
);
|
||||
}
|
||||
|
||||
const endseg = drawnPath.createSVGPathSegClosePath();
|
||||
seglist.appendItem(newseg);
|
||||
seglist.appendItem(endseg);
|
||||
@@ -1960,13 +1957,12 @@ export const pathActions = (function () {
|
||||
|
||||
// Use the segment defined by stretchy
|
||||
sSeg = stretchy.pathSegList.getItem(1);
|
||||
if (sSeg.pathSegType === 4) {
|
||||
newseg = drawnPath.createSVGPathSegLinetoAbs(
|
||||
newseg = (sSeg.pathSegType === 4)
|
||||
? drawnPath.createSVGPathSegLinetoAbs(
|
||||
editorContext_.round(x),
|
||||
editorContext_.round(y)
|
||||
);
|
||||
} else {
|
||||
newseg = drawnPath.createSVGPathSegCurvetoCubicAbs(
|
||||
)
|
||||
: drawnPath.createSVGPathSegCurvetoCubicAbs(
|
||||
editorContext_.round(x),
|
||||
editorContext_.round(y),
|
||||
sSeg.x1 / currentZoom,
|
||||
@@ -1974,7 +1970,6 @@ export const pathActions = (function () {
|
||||
sSeg.x2 / currentZoom,
|
||||
sSeg.y2 / currentZoom
|
||||
);
|
||||
}
|
||||
|
||||
drawnPath.pathSegList.appendItem(newseg);
|
||||
|
||||
|
||||
@@ -269,13 +269,7 @@ export const recalculateDimensions = function (selected) {
|
||||
const gangle = getRotationAngle(selected);
|
||||
if (gangle) {
|
||||
const a = gangle * Math.PI / 180;
|
||||
let s;
|
||||
if (Math.abs(a) > (1.0e-10)) {
|
||||
s = Math.sin(a) / (1 - Math.cos(a));
|
||||
} else {
|
||||
// TODO: This blows up if the angle is exactly 0!
|
||||
s = 2 / a;
|
||||
}
|
||||
const s = Math.abs(a) > (1.0e-10) ? Math.sin(a) / (1 - Math.cos(a)) : 2 / a;
|
||||
for (let i = 0; i < tlist.numberOfItems; ++i) {
|
||||
const xform = tlist.getItem(i);
|
||||
if (xform.type === 4) {
|
||||
|
||||
@@ -2689,11 +2689,7 @@ class SvgCanvas {
|
||||
end = {x: 0, y: 0};
|
||||
const coords = element.getAttribute('points');
|
||||
const commaIndex = coords.indexOf(',');
|
||||
if (commaIndex >= 0) {
|
||||
keep = coords.includes(',', commaIndex + 1);
|
||||
} else {
|
||||
keep = coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
}
|
||||
keep = commaIndex >= 0 ? coords.includes(',', commaIndex + 1) : coords.includes(' ', coords.indexOf(' ') + 1);
|
||||
if (keep) {
|
||||
element = pathActions.smoothPolylineIntoPath(element);
|
||||
}
|
||||
@@ -4495,11 +4491,9 @@ function hideCursor () {
|
||||
|
||||
// set new svg document
|
||||
// If DOM3 adoptNode() available, use it. Otherwise fall back to DOM2 importNode()
|
||||
if (svgdoc.adoptNode) {
|
||||
svgcontent = svgdoc.adoptNode(newDoc.documentElement);
|
||||
} else {
|
||||
svgcontent = svgdoc.importNode(newDoc.documentElement, true);
|
||||
}
|
||||
svgcontent = svgdoc.adoptNode
|
||||
? svgdoc.adoptNode(newDoc.documentElement)
|
||||
: svgdoc.importNode(newDoc.documentElement, true);
|
||||
|
||||
svgroot.append(svgcontent);
|
||||
const content = $(svgcontent);
|
||||
@@ -4681,13 +4675,9 @@ function hideCursor () {
|
||||
this.prepareSvg(newDoc);
|
||||
|
||||
// import new svg document into our document
|
||||
let svg;
|
||||
// If DOM3 adoptNode() available, use it. Otherwise fall back to DOM2 importNode()
|
||||
if (svgdoc.adoptNode) {
|
||||
svg = svgdoc.adoptNode(newDoc.documentElement);
|
||||
} else {
|
||||
svg = svgdoc.importNode(newDoc.documentElement, true);
|
||||
}
|
||||
const svg =
|
||||
svgdoc.adoptNode ? svgdoc.adoptNode(newDoc.documentElement) : svgdoc.importNode(newDoc.documentElement, true);
|
||||
|
||||
uniquifyElems(svg);
|
||||
|
||||
@@ -4705,11 +4695,7 @@ function hideCursor () {
|
||||
canvash = Number(svgcontent.getAttribute('height'));
|
||||
// imported content should be 1/3 of the canvas on its largest dimension
|
||||
|
||||
if (innerh > innerw) {
|
||||
ts = 'scale(' + (canvash / 3) / vb[3] + ')';
|
||||
} else {
|
||||
ts = 'scale(' + (canvash / 3) / vb[2] + ')';
|
||||
}
|
||||
ts = innerh > innerw ? 'scale(' + (canvash / 3) / vb[3] + ')' : 'scale(' + (canvash / 3) / vb[2] + ')';
|
||||
|
||||
// Hack to make recalculateDimensions understand how to scale
|
||||
ts = 'translate(0) ' + ts + ' translate(0)';
|
||||
|
||||
Reference in New Issue
Block a user