Skip to content

Commit f051736

Browse files
committed
Code formatting for th2 draw options
1 parent c9fda09 commit f051736

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

scripts/JSRoot.hist.js

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5526,20 +5526,19 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
55265526
// try to build path which fills area to outside borders
55275527
function BuildPathOutside(xp,yp,iminus,iplus,side) {
55285528

5529-
let points = [{ x:0, y:0 }, {x:frame_w, y:0}, {x:frame_w, y:frame_h}, {x:0, y:frame_h} ];
5529+
const points = [{ x:0, y:0 }, {x:frame_w, y:0}, {x:frame_w, y:frame_h}, {x:0, y:frame_h} ];
55305530

5531-
function get_intersect(i,di) {
5531+
const get_intersect = (i,di) => {
55325532
let segm = { x1: xp[i], y1: yp[i], x2: 2*xp[i] - xp[i+di], y2: 2*yp[i] - yp[i+di] };
55335533
for (let i=0;i<4;++i) {
55345534
let res = get_segm_intersection(segm, { x1: points[i].x, y1: points[i].y, x2: points[(i+1)%4].x, y2: points[(i+1)%4].y});
55355535
if (res) {
5536-
55375536
res.indx = i + 0.5;
55385537
return res;
55395538
}
55405539
}
55415540
return null;
5542-
}
5541+
};
55435542

55445543
let pnt1, pnt2;
55455544
iminus--;
@@ -5621,7 +5620,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
56215620

56225621
/** @summary Create poly bin
56235622
* @private */
5624-
TH2Painter.prototype.createPolyBin = function(pmain, funcs, bin, text_pos) {
5623+
TH2Painter.prototype.createPolyBin = function(funcs, bin, text_pos) {
56255624
let cmd = "", grcmd = "", acc_x = 0, acc_y = 0, ngr, ngraphs = 1, gr = null;
56265625

56275626
if (bin.fPoly._typename == 'TMultiGraph')
@@ -5637,12 +5636,12 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
56375636
bin._sumx += (x1+x2)*len/2;
56385637
bin._sumy += (y1+y2)*len/2;
56395638
bin._suml += len;
5640-
}
5639+
};
56415640

56425641
const flush = () => {
56435642
if (acc_x) { grcmd += "h" + acc_x; acc_x = 0; }
56445643
if (acc_y) { grcmd += "v" + acc_y; acc_y = 0; }
5645-
}
5644+
};
56465645

56475646
for (ngr = 0; ngr < ngraphs; ++ ngr) {
56485647
if (!gr || (ngr>0)) gr = bin.fPoly.fGraphs.arr[ngr];
@@ -5654,7 +5653,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
56545653

56555654
if ((npnts > 2) && (x[0] === x[npnts-1]) && (y[0] === y[npnts-1])) npnts--;
56565655

5657-
let poscmd = "M"+grx+","+gry;
5656+
let poscmd = `M${grx},${gry}`;
56585657

56595658
grcmd = "";
56605659

@@ -5732,7 +5731,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
57325731
if ((bin.fXmin > funcs.scale_xmax) || (bin.fXmax < funcs.scale_xmin) ||
57335732
(bin.fYmin > funcs.scale_ymax) || (bin.fYmax < funcs.scale_ymin)) continue;
57345733

5735-
cmd = this.createPolyBin(pmain, funcs, bin, this.options.Text && bin.fContent);
5734+
cmd = this.createPolyBin(funcs, bin, this.options.Text && bin.fContent);
57365735

57375736
if (colPaths[colindx] === undefined)
57385737
colPaths[colindx] = cmd;
@@ -5996,14 +5995,12 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
59965995
cross += `M${xx},${yy}l${ww},${hh}m0,${-hh}l${-ww},${hh}`;
59975996

59985997
if ((this.options.BoxStyle === 11) && (ww>5) && (hh>5)) {
5999-
let pww = Math.round(ww*0.1),
6000-
phh = Math.round(hh*0.1),
6001-
side1 = "M"+xx+","+yy + "h"+ww + "l"+(-pww)+","+phh + "h"+(2*pww-ww) +
6002-
"v"+(hh-2*phh)+ "l"+(-pww)+","+phh + "z",
6003-
side2 = "M"+(xx+ww)+","+(yy+hh) + "v"+(-hh) + "l"+(-pww)+","+phh + "v"+(hh-2*phh)+
6004-
"h"+(2*pww-ww) + "l"+(-pww)+","+phh + "z";
6005-
if (binz<0) { btn2+=side1; btn1+=side2; }
6006-
else { btn1+=side1; btn2+=side2; }
5998+
const pww = Math.round(ww*0.1),
5999+
phh = Math.round(hh*0.1),
6000+
side1 = `M${xx},${yy}h${ww}l${-pww},${phh}h${2*pww-ww}v${hh-2*phh}l${-pww},${phh}z`,
6001+
side2 = `M${xx+ww},${yy+hh}v${-hh}l${-pww},${phh}v${hh-2*phh}h${2*pww-ww}l${-pww},${phh}z`;
6002+
if (binz < 0) { btn2 += side1; btn1 += side2; }
6003+
else { btn1 += side1; btn2 += side2; }
60076004
}
60086005
}
60096006
}
@@ -6222,13 +6219,13 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
62226219
colindx = cntr.getContourIndex(binz/cw/ch);
62236220
if (colindx < 0) continue;
62246221

6225-
cmd1 = "M"+handle.grx[i]+","+handle.gry[j+1];
6222+
cmd1 = `M${handle.grx[i]},${handle.gry[j+1]}`;
62266223
if (colPaths[colindx] === undefined) {
62276224
colPaths[colindx] = cmd1;
62286225
cell_w[colindx] = cw;
62296226
cell_h[colindx] = ch;
62306227
} else{
6231-
cmd2 = "m" + (handle.grx[i]-currx[colindx]) + "," + (handle.gry[j+1] - curry[colindx]);
6228+
cmd2 = `m${handle.grx[i]-currx[colindx]},${handle.gry[j+1] - curry[colindx]}`;
62326229
colPaths[colindx] += (cmd2.length < cmd1.length) ? cmd2 : cmd1;
62336230
cell_w[colindx] = Math.max(cell_w[colindx], cw);
62346231
cell_h[colindx] = Math.max(cell_h[colindx], ch);
@@ -6237,7 +6234,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
62376234
currx[colindx] = handle.grx[i];
62386235
curry[colindx] = handle.gry[j+1];
62396236

6240-
colPaths[colindx] += "v"+ch+"h"+cw+"v-"+ch+"z";
6237+
colPaths[colindx] += `v${ch}h${cw}v${-ch}z`;
62416238
}
62426239
}
62436240

@@ -6261,7 +6258,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
62616258
pattern.selectAll("*").remove();
62626259

62636260
let npix = Math.round(factor*cntr.arr[colindx]*cell_w[colindx]*cell_h[colindx]);
6264-
if (npix<1) npix = 1;
6261+
if (npix < 1) npix = 1;
62656262

62666263
let arrx = new Float32Array(npix), arry = new Float32Array(npix);
62676264

@@ -6280,7 +6277,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
62806277

62816278
let path = "";
62826279

6283-
for (let n=0;n<npix;++n)
6280+
for (let n = 0;n < npix; ++n)
62846281
path += this.markeratt.create(arrx[n] * cell_w[colindx], arry[n] * cell_h[colindx]);
62856282

62866283
pattern.attr("width", cell_w[colindx])
@@ -6502,7 +6499,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
65026499
res.changed = ttrect.property("current_bin") !== foundindx;
65036500

65046501
if (res.changed)
6505-
ttrect.attr("d", this.createPolyBin(pmain, funcs, bin))
6502+
ttrect.attr("d", this.createPolyBin(funcs, bin))
65066503
.style("opacity", "0.7")
65076504
.property("current_bin", foundindx);
65086505
}

0 commit comments

Comments
 (0)