From 6f0f26ebcc86fdac66d8da0f07c853e7acc64615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gr=C3=A9goire?= Date: Tue, 22 Jul 2025 22:07:53 +0200 Subject: [PATCH] View::DrawThread now properly accounts for the additional margin caused by cropper --- profiler/src/profiler/TracyView_ZoneTimeline.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/profiler/src/profiler/TracyView_ZoneTimeline.cpp b/profiler/src/profiler/TracyView_ZoneTimeline.cpp index 9d5fef28..13a52302 100644 --- a/profiler/src/profiler/TracyView_ZoneTimeline.cpp +++ b/profiler/src/profiler/TracyView_ZoneTimeline.cpp @@ -57,18 +57,18 @@ void View::DrawThread( const TimelineContext& ctx, const ThreadData& thread, con const auto yPos = wpos.y + offset; const float cropperWidth = ImGui::CalcTextSize(ICON_FA_CARET_DOWN).x; - const float radius = (cropperWidth - 2.0f * GetScale() ) / 2.0f ; - const float margin = wpos.x + cropperWidth; + const float cropperCircleRadius = (cropperWidth - 2.0f * GetScale() ) / 2.0f ; + const float cropperAdditionalMargin = cropperWidth + wpos.x; // We add the left window margin for symmetry if( depth > 0 ) { - depth = DrawThreadCropper( depth, thread.id, wpos.x, yPos, ostep, radius, cropperWidth, hasCtxSwitch ); + depth = DrawThreadCropper( depth, thread.id, wpos.x, yPos, ostep, cropperCircleRadius, cropperWidth, hasCtxSwitch ); } const auto* drawList = ImGui::GetWindowDrawList(); - ImGui::PushClipRect( drawList->GetClipRectMin() + ImVec2( margin, 0 ), drawList->GetClipRectMax(), true ); + ImGui::PushClipRect( drawList->GetClipRectMin() + ImVec2( cropperAdditionalMargin, 0 ), drawList->GetClipRectMax(), true ); if( !draw.empty() && yPos <= yMax && yPos + ostep * depth >= yMin ) { - DrawZoneList( ctx, draw, offset, thread.id, depth, margin ); + DrawZoneList( ctx, draw, offset, thread.id, depth, cropperAdditionalMargin + GetScale() /* Ensure text has a bit of space for text */ ); } offset += ostep * depth; @@ -218,7 +218,7 @@ void View::DrawZoneList( const TimelineContext& ctx, const std::vector