1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

Profiler: Allow scaling the timeline with Ctrl+MouseWheel :^)

This commit is contained in:
Andreas Kling 2021-05-22 23:20:31 +02:00
parent 3dfc3e362b
commit 62819df713
5 changed files with 33 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include "TimelineView.h"
#include "Profile.h"
#include "TimelineTrack.h"
#include <LibGUI/BoxLayout.h>
namespace Profiler {
@ -62,4 +63,18 @@ void TimelineView::mouseup_event(GUI::MouseEvent& event)
m_profile.clear_timestamp_filter_range();
}
void TimelineView::mousewheel_event(GUI::MouseEvent& event)
{
if (event.modifiers() == Mod_Ctrl) {
event.accept();
m_scale += event.wheel_delta();
m_scale = clamp(m_scale, 1.0f, 100.0f);
for_each_child_of_type<TimelineTrack>([&](auto& track) {
track.set_scale(m_scale);
return IterationDecision::Continue;
});
on_scale_change();
}
}
}