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

Centering around the mouse pointer.

This commit is contained in:
Tomaž Vöröš
2023-01-27 20:00:05 +01:00
parent dbefb70db3
commit bca8f28f43
3 changed files with 97 additions and 5 deletions
+8 -1
View File
@@ -2,6 +2,7 @@
#define __TRACYTIMELINECONTROLLER_HPP__
#include <assert.h>
#include <optional>
#include <vector>
#include "../public/common/TracyForceInline.hpp"
@@ -18,7 +19,7 @@ public:
void FirstFrameExpired();
void Begin();
void End( double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax );
void End( double pxns, const ImVec2& wpos, bool hover, bool vcenter, float yMin, float yMax );
template<class T, class U>
void AddItem( U* data )
@@ -39,12 +40,18 @@ public:
}
private:
void UpdateCenterItem();
std::optional<int> CalculateScrollPosition() const;
std::vector<TimelineItem*> m_items;
unordered_flat_map<const void*, std::unique_ptr<TimelineItem>> m_itemMap;
float m_height;
float m_scroll;
const void* m_centerItemkey;
int m_centerItemOffsetY;
bool m_firstFrame;
View& m_view;