Update Mindmap connector.md

Bit of further cleanup. I prefer to use constants unless I explicitly know I want to change the value of a variable later. I replaced minxx, minxy, etc. declarations with constants.
Looking at the logic for s, I think it can be simplified as proposed.
This commit is contained in:
zsviczian
2022-07-21 15:53:54 +03:00
committed by GitHub
parent e759010ae0
commit be5d35e811

View File

@@ -23,22 +23,16 @@ ea.style.strokeColor = els[0].strokeColor;
ea.style.strokeWidth = els[0].strokeWidth;
ea.style.strokeStyle = els[0].strokeStyle;
ea.style.strokeSharpness = els[0].strokeSharpness;
let maxy = Math.max.apply(null, elsy);
let indexmaxy=elsy.indexOf(maxy);
let miny = Math.min.apply(null, elsy);
let indexminy = elsy.indexOf(miny);
const maxy = Math.max.apply(null, elsy);
const indexmaxy=elsy.indexOf(maxy);
const miny = Math.min.apply(null, elsy);
const indexminy = elsy.indexOf(miny);
let maxx = Math.max.apply(null, elsx);
let indexmaxx = elsx.indexOf(maxx);
let minx = Math.min.apply(null, elsx);
let indexminx = elsx.indexOf(minx);
let s=0;
if (indexminx==0) {
s=1;
}
else if (indexminy == 0) {
s=0;
}
const maxx = Math.max.apply(null, elsx);
const indexmaxx = elsx.indexOf(maxx);
const minx = Math.min.apply(null, elsx);
const indexminx = elsx.indexOf(minx);
const s = !Boolean(indexminx);
if(s) {
ea.addLine(