es6 refactor

This commit is contained in:
JFH
2021-08-29 12:52:40 +02:00
parent 2f606232ed
commit 4c8f568c6d
4 changed files with 25 additions and 34 deletions

View File

@@ -136,11 +136,7 @@ export default {
} catch (err) {
// Should only occur in FF which formats points attr as "n,n n,n", so just split
const ptArr = elem.getAttribute('points').split(' ');
for (let i = 0; i < ptArr.length; i++) {
if (i === pos) {
ptArr[i] = x + ',' + y;
}
}
ptArr[pos] = x + ',' + y;
elem.setAttribute('points', ptArr.join(' '));
}
@@ -208,7 +204,7 @@ export default {
let addThis;
// Grab the ends
const parts = [];
[ 'start', 'end' ].forEach(function (pos, i) {
[ 'start', 'end' ].forEach( (pos, i) => {
const key = 'c_' + pos;
let part = dataStorage.get(ethis, key);
if (part === null || part === undefined) { // Does this ever return nullish values?

View File

@@ -41,7 +41,7 @@ export default {
$id("sidepanel_content").insertAdjacentHTML( 'beforeend', propsWindowHtml );
// Define dynamic animation of the view box.
const updateViewBox = function () {
const updateViewBox = () => {
const { workarea } = svgEditor;
const portHeight = parseFloat(getComputedStyle(workarea, null).height.replace("px", ""));
const portWidth = parseFloat(getComputedStyle(workarea, null).width.replace("px", ""));