Skip to content

Commit 135c9f0

Browse files
committed
Fix - RH1 zero line drawing only when required
1 parent 82da5c2 commit 135c9f0

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

modules/hist2d/RH1Painter.mjs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -529,20 +529,16 @@ class RH1Painter extends RHistPainter {
529529
}
530530
}
531531

532-
let close_path = '',
533-
fill_for_interactive = !isBatchMode() && this.fillatt.empty() && options.Hist && settings.Tooltip && !draw_markers && !show_line;
534-
if (!this.fillatt.empty() || fill_for_interactive) {
535-
let h0 = height + 3;
536-
if (fill_for_interactive) {
537-
let gry0 = Math.round(funcs.gry(0));
538-
if (gry0 <= 0)
539-
h0 = -3;
540-
else if (gry0 < height)
541-
h0 = gry0;
542-
}
543-
close_path = `L${currx},${h0}H${startx}Z`;
544-
if (res) res += close_path;
532+
let fill_for_interactive = !isBatchMode() && this.fillatt.empty() && options.Hist && settings.Tooltip && !draw_markers && !show_line,
533+
h0 = height + 3;
534+
if (!fill_for_interactive) {
535+
let gry0 = Math.round(funcs.gry(0));
536+
if (gry0 <= 0)
537+
h0 = -3;
538+
else if (gry0 < height)
539+
h0 = gry0;
545540
}
541+
let close_path = `L${currx},${h0}H${startx}Z`;
546542

547543
if (draw_markers || show_line) {
548544
if (path_fill)
@@ -562,9 +558,9 @@ class RH1Painter extends RHistPainter {
562558
.style('pointer-events', isBatchMode() ? null : 'visibleFill');
563559

564560
if (path_line) {
565-
if (!this.fillatt.empty())
561+
if (!this.fillatt.empty() && !options.Hist)
566562
this.draw_g.append('svg:path')
567-
.attr('d', options.Fill ? (path_line + close_path) : res)
563+
.attr('d', path_line + close_path)
568564
.call(this.fillatt.func);
569565

570566
this.draw_g.append('svg:path')
@@ -580,7 +576,7 @@ class RH1Painter extends RHistPainter {
580576

581577
} else if (res && options.Hist) {
582578
this.draw_g.append('svg:path')
583-
.attr('d', res)
579+
.attr('d', res + ((!this.fillatt.empty() || fill_for_interactive) ? close_path : ''))
584580
.style('stroke-linejoin','miter')
585581
.call(this.lineatt.func)
586582
.call(this.fillatt.func);

0 commit comments

Comments
 (0)