Skip to content

Commit

Permalink
Don't show tooltips for flamegraph nodes that are too small to be vis…
Browse files Browse the repository at this point in the history
…ible
  • Loading branch information
Brian Vaughn committed Aug 1, 2021
1 parent a28ef99 commit 586aefa
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,17 @@ class FlamechartStackLayerView extends View {
const flamechartStackFrame = _stackLayer[currentIndex];
const {timestamp, duration} = flamechartStackFrame;

const width = durationToWidth(duration, scaleFactor);
const x = Math.floor(timestampToPosition(timestamp, scaleFactor, frame));
if (x <= location.x && x + width >= location.x) {
this.currentCursor = 'context-menu';
viewRefs.hoveredView = this;
_onHover(flamechartStackFrame);
return;
const width = durationToWidth(duration, scaleFactor);

// Don't show tooltips for nodes that are too small to render at this zoom level.
if (Math.floor(width - BORDER_SIZE) >= 1) {
if (x <= location.x && x + width >= location.x) {
this.currentCursor = 'context-menu';
viewRefs.hoveredView = this;
_onHover(flamechartStackFrame);
return;
}
}

if (x > location.x) {
Expand Down

0 comments on commit 586aefa

Please sign in to comment.