Add switch for vertical centering on/off at compile-time.

This commit is contained in:
Tomaž Vöröš 2023-01-27 20:00:05 +01:00
parent bca8f28f43
commit ea1a0299f3

View File

@ -324,9 +324,16 @@ void View::DrawTimeline()
ImGui::SetNextWindowContentSize( ImVec2( 0, m_tc.GetHeight() ) ); ImGui::SetNextWindowContentSize( ImVec2( 0, m_tc.GetHeight() ) );
ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse ); ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
const auto verticallyCenterTimeline = true;
if( m_yDelta != 0 ) if( m_yDelta != 0 )
{ {
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
if( !verticallyCenterTimeline )
{
auto y = ImGui::GetScrollY();
ImGui::SetScrollY( y - m_yDelta );
}
io.MouseClickedPos[1].y = io.MousePos.y; io.MouseClickedPos[1].y = io.MousePos.y;
} }
@ -378,7 +385,8 @@ void View::DrawTimeline()
} }
} }
m_tc.End( pxns, wpos, hover, drawMouseLine && m_viewMode == ViewMode::Paused, yMin, yMax ); const auto vcenter = verticallyCenterTimeline && drawMouseLine && m_viewMode == ViewMode::Paused;
m_tc.End( pxns, wpos, hover, vcenter, yMin, yMax );
ImGui::EndChild(); ImGui::EndChild();
m_lockHighlight = m_nextLockHighlight; m_lockHighlight = m_nextLockHighlight;