1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add WASD panning/zooming functionality to timeline.

This commit is contained in:
simplyWiri
2022-08-21 21:26:28 +10:00
parent 49bda91be5
commit d2e3856724
2 changed files with 91 additions and 0 deletions
+19
View File
@@ -1,6 +1,7 @@
#ifndef __TRACYVIEW_HPP__
#define __TRACYVIEW_HPP__
#include <array>
#include <atomic>
#include <functional>
#include <memory>
@@ -154,6 +155,23 @@ private:
Inactive
};
struct KeyboardNavigation {
enum Direction : uint8_t {
// Pan left / right
Left,
Right,
// Zoom in / out
In,
Out
};
constexpr static auto DirectionToKeyMap = std::array<int, 4>{ImGuiKey_A, ImGuiKey_D, ImGuiKey_W, ImGuiKey_S};
constexpr static auto StartRangeMod = std::array<int, 4>{-1, 1, 1, -1};
constexpr static auto EndRangeMod = std::array<int, 4>{-1, 1, -1, 1};
std::array<float, 4> m_scrollInertia;
};
struct ZoneColorData
{
uint32_t color;
@@ -397,6 +415,7 @@ private:
ViewData m_vd;
TimelineController m_tc;
KeyboardNavigation m_kbNavCtrl;
const ZoneEvent* m_zoneInfoWindow = nullptr;
const ZoneEvent* m_zoneHighlight;