Change GetNextFrameHeight() to GetHeight().

The GetNextFrameHeight() name correctness was very situational. It was
often used in the meaning of "get current frame height".
This commit is contained in:
Bartosz Taudul 2023-03-25 15:12:33 +01:00
parent 7ec68f8b52
commit 96d60ce626
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 7 additions and 7 deletions

View File

@ -57,7 +57,7 @@ void TimelineController::UpdateCenterItem()
{
m_centerItemkey = item->GetKey();
yBegin = yEnd;
yEnd += item->GetNextFrameHeight();
yEnd += item->GetHeight();
const auto inLowerBounds = m_centerItemkey == m_items.front()->GetKey() || yBegin <= centerY;
const auto inUpperBounds = m_centerItemkey == m_items.back()->GetKey() || centerY < yEnd;
@ -85,7 +85,7 @@ std::optional<int> TimelineController::CalculateScrollPosition() const
for( auto& item : m_items )
{
yBegin = yEnd;
yEnd += item->GetNextFrameHeight();
yEnd += item->GetHeight();
if( item->GetKey() != m_centerItemkey ) continue;
@ -139,19 +139,19 @@ void TimelineController::End( double pxns, const ImVec2& wpos, bool hover, bool
if( item->WantPreprocess() && item->IsVisible() )
{
const auto yPos = wpos.y + yOffset;
const bool visible = m_firstFrame || ( yPos < yMax && yPos + item->GetNextFrameHeight() >= yMin );
const bool visible = m_firstFrame || ( yPos < yMax && yPos + item->GetHeight() >= yMin );
item->Preprocess( ctx, m_td, visible );
}
yOffset += m_firstFrame ? 0 : item->GetNextFrameHeight();
yOffset += m_firstFrame ? 0 : item->GetHeight();
}
m_td.Sync();
yOffset = 0;
for( auto& item : m_items )
{
auto currentFrameItemHeight = item->GetNextFrameHeight();
auto currentFrameItemHeight = item->GetHeight();
item->Draw( m_firstFrame, ctx, yOffset );
if( m_firstFrame ) currentFrameItemHeight = item->GetNextFrameHeight();
if( m_firstFrame ) currentFrameItemHeight = item->GetHeight();
yOffset += currentFrameItemHeight;
}

View File

@ -33,7 +33,7 @@ public:
void SetShowFull( bool showFull ) { m_showFull = showFull; }
// returns 0 instead of the correct value for the first frame
int GetNextFrameHeight() const { return m_height; }
int GetHeight() const { return m_height; }
const void* GetKey() const { return m_key; }