mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Preserve timeline vertical scroll position.
This commit is contained in:
parent
abde0c252d
commit
17d4a82ca5
@ -68,6 +68,8 @@ void UserData::LoadState( ViewData& data )
|
||||
{
|
||||
fread( &data.zvStart, 1, sizeof( data.zvStart ), f );
|
||||
fread( &data.zvEnd, 1, sizeof( data.zvEnd ), f );
|
||||
fread( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
|
||||
fread( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
|
||||
}
|
||||
fclose( f );
|
||||
}
|
||||
@ -82,6 +84,8 @@ void UserData::SaveState( const ViewData& data )
|
||||
fwrite( &ver, 1, sizeof( ver ), f );
|
||||
fwrite( &data.zvStart, 1, sizeof( data.zvStart ), f );
|
||||
fwrite( &data.zvEnd, 1, sizeof( data.zvEnd ), f );
|
||||
fwrite( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
|
||||
fwrite( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
|
||||
fclose( f );
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ void View::DrawZones()
|
||||
ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetWindowContentRegionWidth(), ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
|
||||
|
||||
const auto wpos = ImGui::GetCursorScreenPos();
|
||||
const auto h = std::max<float>( m_zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value
|
||||
const auto h = std::max<float>( m_vd.zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value
|
||||
|
||||
ImGui::InvisibleButton( "##zones", ImVec2( w, h ) );
|
||||
bool hover = ImGui::IsItemHovered();
|
||||
@ -2223,15 +2223,15 @@ void View::DrawZones()
|
||||
}
|
||||
|
||||
const auto scrollPos = ImGui::GetScrollY();
|
||||
if( scrollPos == 0 && m_zvScroll != 0 )
|
||||
if( scrollPos == 0 && m_vd.zvScroll != 0 )
|
||||
{
|
||||
m_zvHeight = 0;
|
||||
m_vd.zvHeight = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( offset > m_zvHeight ) m_zvHeight = offset;
|
||||
if( offset > m_vd.zvHeight ) m_vd.zvHeight = offset;
|
||||
}
|
||||
m_zvScroll = scrollPos;
|
||||
m_vd.zvScroll = scrollPos;
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
|
@ -250,9 +250,6 @@ private:
|
||||
|
||||
ViewData m_vd;
|
||||
|
||||
int m_zvHeight = 0;
|
||||
int m_zvScroll = 0;
|
||||
|
||||
const ZoneEvent* m_zoneInfoWindow = nullptr;
|
||||
const ZoneEvent* m_zoneHighlight;
|
||||
DecayValue<int16_t> m_zoneSrcLocHighlight = 0;
|
||||
|
@ -10,6 +10,8 @@ struct ViewData
|
||||
{
|
||||
int64_t zvStart = 0;
|
||||
int64_t zvEnd = 0;
|
||||
int32_t zvHeight = 0;
|
||||
int32_t zvScroll = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user