|
|
|
@ -16,6 +16,7 @@ type Props = { |
|
|
|
setSelectedBarIndex: (bar: number) => void; |
|
|
|
setSelectedBarIndex: (bar: number) => void; |
|
|
|
setRangeMin: (range: number) => void; |
|
|
|
setRangeMin: (range: number) => void; |
|
|
|
setRangeMax: (range: number) => void; |
|
|
|
setRangeMax: (range: number) => void; |
|
|
|
|
|
|
|
getLabelValue: (label: string | number) => string; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const FlameGraphContextMenu = ({ |
|
|
|
const FlameGraphContextMenu = ({ |
|
|
|
@ -28,6 +29,7 @@ const FlameGraphContextMenu = ({ |
|
|
|
setSelectedBarIndex, |
|
|
|
setSelectedBarIndex, |
|
|
|
setRangeMin, |
|
|
|
setRangeMin, |
|
|
|
setRangeMax, |
|
|
|
setRangeMax, |
|
|
|
|
|
|
|
getLabelValue, |
|
|
|
}: Props) => { |
|
|
|
}: Props) => { |
|
|
|
const renderMenuItems = () => { |
|
|
|
const renderMenuItems = () => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
@ -55,7 +57,7 @@ const FlameGraphContextMenu = ({ |
|
|
|
onClick={() => { |
|
|
|
onClick={() => { |
|
|
|
if (graphRef.current && contextMenuData) { |
|
|
|
if (graphRef.current && contextMenuData) { |
|
|
|
const bar = levels[contextMenuData.levelIndex][contextMenuData.barIndex]; |
|
|
|
const bar = levels[contextMenuData.levelIndex][contextMenuData.barIndex]; |
|
|
|
navigator.clipboard.writeText(bar.label).then(() => { |
|
|
|
navigator.clipboard.writeText(getLabelValue(bar.label)).then(() => { |
|
|
|
setContextMenuData(undefined); |
|
|
|
setContextMenuData(undefined); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|