Enhance Profiler with pre-allocated sort buffers and frame management improvements
This commit is contained in:
@@ -283,15 +283,22 @@ public static class ProfilerVisualizer
|
||||
return;
|
||||
}
|
||||
|
||||
bool isZoom = io.KeyCtrl;
|
||||
if (isZoom)
|
||||
if (!io.KeyCtrl && !io.KeyShift)
|
||||
{
|
||||
return; // plain scroll goes to ImGui vertical scrolling
|
||||
}
|
||||
|
||||
float wheel = io.MouseWheel;
|
||||
io.MouseWheel = 0; // consume so the child window doesn't also scroll vertically
|
||||
|
||||
if (io.KeyCtrl)
|
||||
{
|
||||
float previousZoom = state.Zoom;
|
||||
double visibleStartTicksBefore = timelineStartTicks + state.PanTicks;
|
||||
double mouseT = Math.Clamp((ImGui.GetMousePos().X - originX) / Math.Max(1f, canvasWidth), 0f, 1f);
|
||||
double pivotTick = visibleStartTicksBefore + (visibleDurationTicks * mouseT);
|
||||
|
||||
state.Zoom = Math.Clamp(state.Zoom * MathF.Pow(1.12f, io.MouseWheel), 1f, 128f);
|
||||
state.Zoom = Math.Clamp(state.Zoom * MathF.Pow(1.12f, wheel), 1f, 128f);
|
||||
if (Math.Abs(previousZoom - state.Zoom) > float.Epsilon)
|
||||
{
|
||||
double newVisibleDurationTicks = Math.Max(1d, timelineDurationTicks / state.Zoom);
|
||||
@@ -303,7 +310,8 @@ public static class ProfilerVisualizer
|
||||
}
|
||||
else
|
||||
{
|
||||
state.PanTicks -= io.MouseWheel * (visibleDurationTicks * 0.10d);
|
||||
// Shift + scroll: horizontal pan
|
||||
state.PanTicks -= wheel * (visibleDurationTicks * 0.10d);
|
||||
state.FollowLatest = false;
|
||||
userNavigated = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user