Skip to content

Commit 586aefa

Browse files
author
Brian Vaughn
committed
Don't show tooltips for flamegraph nodes that are too small to be visible
1 parent a28ef99 commit 586aefa

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

packages/react-devtools-scheduling-profiler/src/content-views/FlamechartView.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,17 @@ class FlamechartStackLayerView extends View {
195195
const flamechartStackFrame = _stackLayer[currentIndex];
196196
const {timestamp, duration} = flamechartStackFrame;
197197

198-
const width = durationToWidth(duration, scaleFactor);
199198
const x = Math.floor(timestampToPosition(timestamp, scaleFactor, frame));
200-
if (x <= location.x && x + width >= location.x) {
201-
this.currentCursor = 'context-menu';
202-
viewRefs.hoveredView = this;
203-
_onHover(flamechartStackFrame);
204-
return;
199+
const width = durationToWidth(duration, scaleFactor);
200+
201+
// Don't show tooltips for nodes that are too small to render at this zoom level.
202+
if (Math.floor(width - BORDER_SIZE) >= 1) {
203+
if (x <= location.x && x + width >= location.x) {
204+
this.currentCursor = 'context-menu';
205+
viewRefs.hoveredView = this;
206+
_onHover(flamechartStackFrame);
207+
return;
208+
}
205209
}
206210

207211
if (x > location.x) {

0 commit comments

Comments
 (0)