EM_Task/TraceInsights/Public/Insights/ViewModels/TimingViewLayout.h

67 lines
2.3 KiB
C
Raw Permalink Normal View History

2026-02-13 16:18:33 +08:00
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
struct TRACEINSIGHTS_API FTimingViewLayout
{
static constexpr float RealMinTimelineH = 7.0f;
static constexpr float NormalLayoutEventH = 14.0f;
static constexpr float NormalLayoutEventDY = 2.0f;
static constexpr float NormalLayoutTimelineDY = 10.0f;
static constexpr float NormalLayoutMinTimelineH = 0.0f;
static constexpr float CompactLayoutEventH = 4.0f;
static constexpr float CompactLayoutEventDY = 1.0f;
static constexpr float CompactLayoutTimelineDY = 1.0f;
static constexpr float CompactLayoutMinTimelineH = 0.0f;
//////////////////////////////////////////////////
bool bIsCompactMode;
float EventH; // height of a timing event, in Slate units
float EventDY; // vertical space between timing events in two adjacent lanes, in Slate units
float TimelineDY; // space at top and bottom of each track (i.e. above first lane and below last lane), in Slate units
float MinTimelineH; // current minimum height of a track, in Slate units
float TargetMinTimelineH; // targeted minimum height of a track (for animating min track height), in Slate units
//////////////////////////////////////////////////
float GetLaneY(int32 Depth) const
{
// 1.0f is for the top horizontal line of each track
return 1.0f + TimelineDY + (EventDY + EventH) * Depth;
}
float ComputeTrackHeight(int32 NumLanes) const
{
if (NumLanes <= 0)
{
return MinTimelineH;
}
else // if (NumLanes > 0)
{
// 1.0f is for horizontal line between timelines
const float TrackHeight = 1.0f + TimelineDY + (EventH + EventDY) * NumLanes - EventDY + TimelineDY;
if (TrackHeight < FTimingViewLayout::RealMinTimelineH)
{
return FTimingViewLayout::RealMinTimelineH;
}
return TrackHeight;
}
}
void ForceNormalMode();
void ForceCompactMode();
bool Update();
};
////////////////////////////////////////////////////////////////////////////////////////////////////