Skip to content

Commit

Permalink
add file and line information
Browse files Browse the repository at this point in the history
add file and line to tooltips
add file and line to anonymous methods
  • Loading branch information
sokra committed Sep 27, 2021
1 parent e37f6fa commit 66676e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/views/flamechart-pan-zoom-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ export class FlamechartPanZoomView extends Component<FlamechartPanZoomViewProps,

const trimmedText = trimTextMid(
ctx,
frame.node.frame.name,
frame.node.frame.name === '(anonymous)' && frame.node.frame.file
? `(anonymous ${frame.node.frame.file.split('/').pop()}:${frame.node.frame.line})`
: frame.node.frame.name,
physicalLabelBounds.width() - 2 * LABEL_PADDING_PX,
)

Expand Down
8 changes: 7 additions & 1 deletion src/views/flamechart-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class FlamechartView extends StatelessComponent<FlamechartViewProps> {
if (!hover) return null
const {width, height, left, top} = this.container.getBoundingClientRect()
const offset = new Vec2(hover.event.clientX - left, hover.event.clientY - top)
const frame = hover.node.frame

const style = this.getStyle()

Expand All @@ -88,7 +89,12 @@ export class FlamechartView extends StatelessComponent<FlamechartViewProps> {
<span className={css(style.hoverCount)}>
{this.formatValue(hover.node.getTotalWeight())}
</span>{' '}
{hover.node.frame.name}
{frame.name}
{frame.file ? (
<div>
{frame.file}:{frame.line}
</div>
) : undefined}
</Hovertip>
)
}
Expand Down
8 changes: 7 additions & 1 deletion src/views/flamechart-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@ export class FlamechartWrapper extends StatelessComponent<FlamechartViewProps> {
const {width, height, left, top} = this.container.getBoundingClientRect()
const offset = new Vec2(hover.event.clientX - left, hover.event.clientY - top)
const style = getStyle(this.props.theme)
const frame = hover.node.frame

return (
<Hovertip containerSize={new Vec2(width, height)} offset={offset}>
<span className={css(style.hoverCount)}>
{this.formatValue(hover.node.getTotalWeight())}
</span>{' '}
{hover.node.frame.name}
{frame.name}
{frame.file ? (
<div>
{frame.file}:{frame.line}
</div>
) : undefined}
</Hovertip>
)
}
Expand Down

0 comments on commit 66676e8

Please sign in to comment.