Skip to content

Commit 4c1cacb

Browse files
committed
Adjust rendering of legend to resolve image baselines
It appears the element marked with `legendtoggle` contributes visually, which means it should not be skipped over when rendering in order to preserve the existing tests for image baselines. Fixes #5177
1 parent 73d4606 commit 4c1cacb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/components/legend/draw.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -460,18 +460,19 @@ function ensureLength(str, maxLength) {
460460
}
461461

462462
function setupTraceToggle(g, gd) {
463-
if(gd._context.staticPlot) return;
464-
465463
var doubleClickDelay = gd._context.doubleClickDelay;
466464
var newMouseDownTime;
467465
var numClicks = 1;
468466

469467
var traceToggle = Lib.ensureSingle(g, 'rect', 'legendtoggle', function(s) {
470-
s.style('cursor', 'pointer')
471-
.attr('pointer-events', 'all')
472-
.call(Color.fill, 'rgba(0,0,0,0)');
468+
if(!gd._context.staticPlot) {
469+
s.style('cursor', 'pointer').attr('pointer-events', 'all');
470+
}
471+
s.call(Color.fill, 'rgba(0,0,0,0)');
473472
});
474473

474+
if(gd._context.staticPlot) return;
475+
475476
traceToggle.on('mousedown', function() {
476477
newMouseDownTime = (new Date()).getTime();
477478
if(newMouseDownTime - gd._legendMouseDownTime < doubleClickDelay) {

0 commit comments

Comments
 (0)