Skip to content

Commit 2ecc90f

Browse files
committed
Formating around return
1 parent 29ee9d6 commit 2ecc90f

File tree

4 files changed

+57
-28
lines changed

4 files changed

+57
-28
lines changed

modules/hist2d/TGraphPainter.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,9 +825,11 @@ class TGraphPainter extends ObjectPainter {
825825
let vleft = vv, vright = vv, htop = hh, hbottom = hh, bb;
826826

827827
const mainLine = (dx, dy) => {
828-
if (!options.MainError) return `M${dx},${dy}`;
828+
if (!options.MainError)
829+
return `M${dx},${dy}`;
829830
const res = 'M0,0';
830-
if (dx) return res + (dy ? `L${dx},${dy}` : `H${dx}`);
831+
if (dx)
832+
return res + (dy ? `L${dx},${dy}` : `H${dx}`);
831833
return dy ? res + `V${dy}` : res;
832834
};
833835

modules/hist2d/TH2Painter.mjs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,8 @@ class TH2Painter extends THistPainter {
15721572
if (!cmd) {
15731573
cmd = `M${x},${y}`; x0 = x; y0 = y;
15741574
} else if ((i === iplus) && (iminus !== iplus) && (x === x0) && (y === y0)) {
1575-
if (!isany) return ''; // all same points
1575+
if (!isany)
1576+
return ''; // all same points
15761577
cmd += 'z'; do_close = false; matched = true;
15771578
} else {
15781579
const dx = x - lastx, dy = y - lasty;
@@ -1611,11 +1612,13 @@ class TH2Painter extends THistPainter {
16111612
iminus--;
16121613
while ((iminus < iplus - 1) && !pnt1)
16131614
pnt1 = get_intersect(++iminus, 1);
1614-
if (!pnt1) return '';
1615+
if (!pnt1)
1616+
return '';
16151617
iplus++;
16161618
while ((iminus < iplus - 1) && !pnt2)
16171619
pnt2 = get_intersect(--iplus, -1);
1618-
if (!pnt2) return '';
1620+
if (!pnt2)
1621+
return '';
16191622

16201623
// TODO: now side is always same direction, could be that side should be checked more precise
16211624

@@ -2267,13 +2270,15 @@ class TH2Painter extends THistPainter {
22672270
for (let j = 0; j < proj.length; ++j) {
22682271
if (proj[j] > 0) {
22692272
res.max = Math.max(res.max, proj[j]);
2270-
if (res.first < 0) res.first = j;
2273+
if (res.first < 0)
2274+
res.first = j;
22712275
res.last = j;
22722276
}
22732277
integral += proj[j];
22742278
sum1 += proj[j]*(xx[j]+xx[j+1])/2;
22752279
}
2276-
if (integral <= 0) return null;
2280+
if (integral <= 0)
2281+
return null;
22772282

22782283
res.entries = integral;
22792284
res.mean = sum1/integral;
@@ -2873,7 +2878,8 @@ class TH2Painter extends THistPainter {
28732878
if (axis.fLabels) {
28742879
for (let i = 0; i < axis.fLabels.arr.length; ++i) {
28752880
const tstr = axis.fLabels.arr[i];
2876-
if (tstr.fUniqueID === indx+1) return tstr.fString;
2881+
if (tstr.fUniqueID === indx + 1)
2882+
return tstr.fString;
28772883
}
28782884
}
28792885
return indx.toString();

modules/hist2d/THStackPainter.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ class THStackPainter extends ObjectPainter {
116116
domax = false;
117117
}
118118

119-
if (!domin && !domax) return res;
119+
if (!domin && !domax)
120+
return res;
120121

121122
let i1 = 1, i2 = hist.fXaxis.fNbins, j1 = 1, j2 = 1, first = true;
122123

modules/hist2d/THistPainter.mjs

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -735,19 +735,25 @@ class HistContour {
735735
return Math.floor(0.01 + (zc - this.colzmin) * (this.arr.length - 1) / (this.colzmax - this.colzmin));
736736

737737
let l = 0, r = this.arr.length - 1;
738-
if (zc < this.arr[0]) return -1;
739-
if (zc >= this.arr[r]) return r;
740-
while (l < r-1) {
738+
if (zc < this.arr[0])
739+
return -1;
740+
if (zc >= this.arr[r])
741+
return r;
742+
while (l < r - 1) {
741743
const mid = Math.round((l+r)/2);
742-
if (this.arr[mid] > zc) r = mid; else l = mid;
744+
if (this.arr[mid] > zc)
745+
r = mid;
746+
else
747+
l = mid;
743748
}
744749
return l;
745750
}
746751

747752
/** @summary Get palette color */
748753
getPaletteColor(palette, zc) {
749754
const zindx = this.getContourIndex(zc);
750-
if (zindx < 0) return null;
755+
if (zindx < 0)
756+
return null;
751757
const pindx = palette.calcColorIndex(zindx, this.arr.length);
752758
return palette.getColor(pindx);
753759
}
@@ -962,12 +968,18 @@ class THistPainter extends ObjectPainter {
962968
/** @summary Returns number of histogram dimensions */
963969
getDimension() {
964970
const histo = this.getHisto();
965-
if (!histo) return 0;
966-
if (histo._typename.match(/^TH2/)) return 2;
967-
if (histo._typename === clTProfile2D) return 2;
968-
if (histo._typename.match(/^TH3/)) return 3;
969-
if (histo._typename === clTProfile3D) return 3;
970-
if (this.isTH2Poly()) return 2;
971+
if (!histo)
972+
return 0;
973+
if (histo._typename.match(/^TH2/))
974+
return 2;
975+
if (histo._typename === clTProfile2D)
976+
return 2;
977+
if (histo._typename.match(/^TH3/))
978+
return 3;
979+
if (histo._typename === clTProfile3D)
980+
return 3;
981+
if (this.isTH2Poly())
982+
return 2;
971983
return 1;
972984
}
973985

@@ -1238,15 +1250,20 @@ class THistPainter extends ObjectPainter {
12381250
if (axis.fXbins.length >= axis.fNbins) {
12391251
axis.GetBinCoord = function(bin) {
12401252
const indx = Math.round(bin);
1241-
if (indx <= 0) return this.fXmin;
1242-
if (indx > this.fNbins) return this.fXmax;
1243-
if (indx === bin) return this.fXbins[indx];
1253+
if (indx <= 0)
1254+
return this.fXmin;
1255+
if (indx > this.fNbins)
1256+
return this.fXmax;
1257+
if (indx === bin)
1258+
return this.fXbins[indx];
12441259
const indx2 = (bin < indx) ? indx - 1 : indx + 1;
12451260
return this.fXbins[indx] * Math.abs(bin-indx2) + this.fXbins[indx2] * Math.abs(bin-indx);
12461261
};
12471262
axis.FindBin = function(x, add) {
1248-
for (let k = 1; k < this.fXbins.length; ++k)
1249-
if (x < this.fXbins[k]) return Math.floor(k-1+add);
1263+
for (let k = 1; k < this.fXbins.length; ++k) {
1264+
if (x < this.fXbins[k])
1265+
return Math.floor(k - 1 + add);
1266+
}
12501267
return this.fNbins;
12511268
};
12521269
} else {
@@ -1562,8 +1579,10 @@ class THistPainter extends ObjectPainter {
15621579
return null;
15631580

15641581
if (!force && !o.ForceStat) {
1565-
if (o.NoStat || histo.TestBit(kNoStats) || !settings.AutoStat) return null;
1566-
if (!this.isMainPainter()) return null;
1582+
if (o.NoStat || histo.TestBit(kNoStats) || !settings.AutoStat)
1583+
return null;
1584+
if (!this.isMainPainter())
1585+
return null;
15671586
}
15681587

15691588
const st = gStyle;
@@ -2327,7 +2346,8 @@ class THistPainter extends ObjectPainter {
23272346
} else {
23282347
pal_painter.Enabled = true;
23292348
// real drawing will be perform at the end
2330-
if (postpone_draw) return pal_painter;
2349+
if (postpone_draw)
2350+
return pal_painter;
23312351
pr = pal_painter.drawPave(arg);
23322352
}
23332353

0 commit comments

Comments
 (0)