Skip to content

Commit 4eaf62e

Browse files
committed
Fix off-screen trace detection
Make the condition test work regardless of the drawing method
1 parent c25484b commit 4eaf62e

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

Diff for: src/traces/heatmap/plot.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,18 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
136136
// setup image nodes
137137

138138
// if image is entirely off-screen, don't even draw it
139-
var isOffScreen = (imageWidth <= 0 || imageHeight <= 0);
139+
var isOffScreen = (
140+
left >= xa._length || right <= 0 || top >= ya._length || bottom <= 0
141+
);
140142

141143
if(isOffScreen) {
142-
// console.log('isOffScreen', drawingMethod);
143-
144144
var noImage = plotGroup.selectAll('image').data([]);
145145
noImage.exit().remove();
146146

147147
removeLabels(plotGroup);
148148
return;
149149
}
150150

151-
// console.log('drawingMethod', drawingMethod);
152-
// console.log(left, right);
153-
154-
155151
// generate image data
156152

157153
var canvasW, canvasH;

Diff for: test/jasmine/tests/heatmap_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ describe('heatmap plot', function() {
683683

684684
return Plotly.relayout(gd, 'xaxis.range', [2, 3]);
685685
}).then(function() {
686-
assertImageCnt(3);
686+
assertImageCnt(2);
687687

688688
return Plotly.relayout(gd, 'xaxis.autorange', true);
689689
}).then(function() {

0 commit comments

Comments
 (0)