Skip to content

Commit 12802b2

Browse files
committed
When showing TGraph tooltip, take into account marker size
Can be that marker is much bigger than error bars
1 parent 0941f8f commit 12802b2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

scripts/JSRootPainter.more.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,8 @@
11641164
height = this.frame_height(),
11651165
pmain = this.main_painter(),
11661166
painter = this,
1167-
findbin = null, best_dist2 = 1e10, best = null;
1167+
findbin = null, best_dist2 = 1e10, best = null,
1168+
msize = this.marker_size ? Math.round(this.marker_size/2 + 1.5) : 0;
11681169

11691170
this.draw_g.selectAll('.grpoint').each(function() {
11701171
var d = d3.select(this).datum();
@@ -1176,12 +1177,11 @@
11761177
var rect = null;
11771178

11781179
if (d.error || d.rect || d.marker) {
1179-
rect = { x1: Math.min(-painter.error_size, d.grx0),
1180-
x2: Math.max(painter.error_size, d.grx2),
1181-
y1: Math.min(-painter.error_size, d.gry2),
1182-
y2: Math.max(painter.error_size, d.gry0) };
1183-
} else
1184-
if (d.bar) {
1180+
rect = { x1: Math.min(-painter.error_size, d.grx0, -msize),
1181+
x2: Math.max(painter.error_size, d.grx2, msize),
1182+
y1: Math.min(-painter.error_size, d.gry2, -msize),
1183+
y2: Math.max(painter.error_size, d.gry0, msize) };
1184+
} else if (d.bar) {
11851185
rect = { x1: -d.width/2, x2: d.width/2, y1: 0, y2: height - d.gry1 };
11861186

11871187
if (painter.options.Bar===1) {
@@ -1192,8 +1192,8 @@
11921192
} else {
11931193
rect = { x1: -5, x2: 5, y1: -5, y2: 5 };
11941194
}
1195-
var matchx = (pnt.x >= d.grx1 + rect.x1) && (pnt.x <= d.grx1 + rect.x2);
1196-
var matchy = (pnt.y >= d.gry1 + rect.y1) && (pnt.y <= d.gry1 + rect.y2);
1195+
var matchx = (pnt.x >= d.grx1 + rect.x1) && (pnt.x <= d.grx1 + rect.x2),
1196+
matchy = (pnt.y >= d.gry1 + rect.y1) && (pnt.y <= d.gry1 + rect.y2);
11971197

11981198
if (matchx && (matchy || (pnt.nproc > 1))) {
11991199
best_dist2 = dist2;

0 commit comments

Comments
 (0)