Skip to content

Commit

Permalink
Change Profiler snapshot selector scale to log
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Mar 6, 2021
1 parent 7df6572 commit aac4515
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}}
/>
</div>
Expand Down

0 comments on commit aac4515

Please sign in to comment.