From be5d35e81150bc258412fb719c337ee07aebeec9 Mon Sep 17 00:00:00 2001 From: zsviczian Date: Thu, 21 Jul 2022 15:53:54 +0300 Subject: [PATCH] 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. --- ea-scripts/Mindmap connector.md | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/ea-scripts/Mindmap connector.md b/ea-scripts/Mindmap connector.md index 623f15e..855358c 100644 --- a/ea-scripts/Mindmap connector.md +++ b/ea-scripts/Mindmap connector.md @@ -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(