From aac45154de95260e63450fd56c2d0341179d35e3 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Sat, 6 Mar 2021 00:43:52 -0500 Subject: [PATCH] Change Profiler snapshot selector scale to log --- .../src/devtools/views/Profiler/SnapshotCommitListItem.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js b/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js index e8399a09bb37d..753b4fe187197 100644 --- a/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js +++ b/packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js @@ -41,7 +41,10 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) { // Guard against commits with duration 0 const percentage = - Math.min(1, Math.max(0, commitDuration / maxDuration)) || 0; + Math.min( + 1, + Math.max(0, Math.log(commitDuration) / Math.log(maxDuration)), + ) || 0; const isSelected = selectedCommitIndex === index; // Leave a 1px gap between snapshots @@ -77,7 +80,7 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) { style={{ height: `${Math.round(percentage * 100)}%`, backgroundColor: - percentage > 0 ? getGradientColor(percentage) : undefined, + commitDuration > 0 ? getGradientColor(percentage) : undefined, }} />