Provide small font height in TimelineContext.

This commit is contained in:
Bartosz Taudul 2023-03-25 17:25:10 +01:00
parent c0136dbdcc
commit dcf27f4989
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
4 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ namespace tracy
struct TimelineContext
{
float w, ty, scale;
float w, ty, sty, scale;
float yMin, yMax;
double pxns, nspx;
int64_t vStart, vEnd;

View File

@ -97,7 +97,7 @@ std::optional<int> TimelineController::CalculateScrollPosition() const
return std::nullopt;
}
void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool vcenter, float yMin, float yMax )
void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool vcenter, float yMin, float yMax, ImFont* smallFont )
{
auto shouldUpdateCenterItem = [&] () {
const auto imguiChangedScroll = m_scroll != ImGui::GetScrollY();
@ -123,6 +123,9 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool
TimelineContext ctx;
ctx.w = ImGui::GetContentRegionAvail().x - 1;
ctx.ty = ImGui::GetTextLineHeight();
ImGui::PushFont( smallFont );
ctx.sty = ImGui::GetTextLineHeight();
ImGui::PopFont();
ctx.scale = GetScale();
ctx.yMin = yMin;
ctx.yMax = yMax;

View File

@ -25,7 +25,7 @@ public:
void FirstFrameExpired();
void Begin();
void End( double pxns, const ImVec2& wpos, bool hover, bool vcenter, float yMin, float yMax );
void End( double pxns, const ImVec2& wpos, bool hover, bool vcenter, float yMin, float yMax, ImFont* smallFont );
template<class T, class U>
void AddItem( U* data )

View File

@ -385,7 +385,7 @@ void View::DrawTimeline()
}
const auto vcenter = verticallyCenterTimeline && drawMouseLine && m_viewMode == ViewMode::Paused;
m_tc.End( pxns, wpos, hover, vcenter, yMin, yMax );
m_tc.End( pxns, wpos, hover, vcenter, yMin, yMax, m_smallFont );
ImGui::EndChild();
m_lockHighlight = m_nextLockHighlight;