Skip to content

Commit de83fa9

Browse files
committed
Improve tooltip handling for th1 marker draw
1 parent 337c4f6 commit de83fa9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

scripts/JSRoot.hist.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,7 +3842,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
38423842
show_text = this.options.Text,
38433843
text_profile = show_text && (this.options.TextKind == "E") && this.isTProfile() && histo.fBinEntries,
38443844
path_fill = null, path_err = null, path_marker = null, path_line = null,
3845-
hints_err = null, hints_marker = null,
3845+
hints_err = null, hints_marker = null, hsz = 5,
38463846
do_marker = false, do_err = false,
38473847
dend = 0, dlw = 0, my, yerr1, yerr2, bincont, binerr, mx1, mx2, midx, mmx1, mmx2,
38483848
text_col, text_angle, text_size;
@@ -3873,7 +3873,9 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
38733873
path_marker = "";
38743874
do_marker = true;
38753875
this.markeratt.resetPos();
3876-
if ((hints_err === null) && want_tooltip) hints_marker = "";
3876+
if ((hints_err === null) && want_tooltip && (!this.markeratt.fill || (this.markeratt.getFullSize() < 7))) {
3877+
hints_marker = ""; hsz = Math.max(5, Math.round(this.markeratt.getFullSize()*0.7))
3878+
}
38773879
} else {
38783880
show_markers = false;
38793881
}
@@ -3975,7 +3977,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
39753977
if ((path_marker !== null) && do_marker) {
39763978
path_marker += this.markeratt.create(midx, my);
39773979
if (hints_marker !== null)
3978-
hints_marker += "M" + (midx-5)+","+(my-5) + "h10v10h-10z";
3980+
hints_marker += `M${midx-hsz},${my-hsz}h${2*hsz}v${2*hsz}h${-2*hsz}z`;
39793981
}
39803982

39813983
if ((path_err !== null) && do_err)
@@ -3993,7 +3995,7 @@ JSROOT.define(['d3', 'painter', 'gpad'], (d3, jsrp) => {
39933995
if (path_marker !== null)
39943996
path_marker += this.markeratt.create(midx, my);
39953997
if (hints_marker !== null)
3996-
hints_marker += "M" + (midx-5)+","+(my-5) + "h10v10h-10z";
3998+
hints_marker += `M${midx-hsz},${my-hsz}h${2*hsz}v${2*hsz}h${-2*hsz}z`;
39973999
if (path_err !== null)
39984000
draw_errbin();
39994001
}

scripts/JSRoot.more.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,18 +1464,16 @@ JSROOT.define(['d3', 'painter', 'math', 'gpad'], (d3, jsrp) => {
14641464

14651465
this.markeratt.resetPos();
14661466

1467-
let want_tooltip = !JSROOT.batch_mode && JSROOT.settings.Tooltip && !this.markeratt.fill && !nodes,
1468-
hints_marker = "", hsz = Math.max(5, Math.round(this.marker_size*0.7));
1469-
1470-
// let produce SVG at maximum 1MB
1471-
let maxnummarker = 1000000 / (this.markeratt.getMarkerLength() + 7), step = 1;
1467+
let want_tooltip = !JSROOT.batch_mode && JSROOT.settings.Tooltip && (!this.markeratt.fill || (this.marker_size < 7)) && !nodes,
1468+
hints_marker = "", hsz = Math.max(5, Math.round(this.marker_size*0.7)),
1469+
maxnummarker = 1000000 / (this.markeratt.getMarkerLength() + 7), step = 1; // let produce SVG at maximum 1MB
14721470

14731471
if (!drawbins)
14741472
drawbins = this.optimizeBins(maxnummarker);
14751473
else if (this.canOptimize() && (drawbins.length > 1.5*maxnummarker))
14761474
step = Math.min(2, Math.round(drawbins.length/maxnummarker));
14771475

1478-
for (let n = 0; n < drawbins.length; n+=step) {
1476+
for (let n = 0; n < drawbins.length; n += step) {
14791477
pnt = drawbins[n];
14801478
grx = funcs.grx(pnt.x);
14811479
if ((grx > -this.marker_size) && (grx < w + this.marker_size)) {

0 commit comments

Comments
 (0)