Fix vertical panning.

This commit is contained in:
Bartosz Taudul 2020-08-05 17:20:19 +02:00
parent f07eebebf7
commit 251e8f1fe2
2 changed files with 11 additions and 6 deletions

View File

@ -1902,6 +1902,7 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
m_zoomAnim.active = false;
if( !m_playback.pause && m_playback.sync ) m_playback.pause = true;
const auto delta = GetMouseDragDelta( 1 );
m_yDelta = delta.y;
const auto dpx = int64_t( (delta.x * nspx) + (hwheel_delta * nspx));
if( dpx != 0 )
{
@ -1922,12 +1923,6 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
m_vd.zvStart = m_vd.zvEnd - range;
}
}
if( delta.y != 0 )
{
auto y = ImGui::GetScrollY();
ImGui::SetScrollY( y - delta.y );
io.MouseClickedPos[1].y = io.MousePos.y;
}
}
const auto wheel = io.MouseWheel;
@ -2434,6 +2429,7 @@ void View::DrawZones()
m_zoneHover2.Decay( nullptr );
m_findZone.range.StartFrame();
m_statRange.StartFrame();
m_yDelta = 0;
if( m_vd.zvStart == m_vd.zvEnd ) return;
assert( m_vd.zvStart < m_vd.zvEnd );
@ -2494,6 +2490,14 @@ void View::DrawZones()
ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetWindowContentRegionWidth(), ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( m_yDelta != 0 )
{
auto& io = ImGui::GetIO();
auto y = ImGui::GetScrollY();
ImGui::SetScrollY( y - m_yDelta );
io.MouseClickedPos[1].y = io.MousePos.y;
}
const auto wpos = ImGui::GetCursorScreenPos();
const auto h = std::max<float>( m_vd.zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value

View File

@ -446,6 +446,7 @@ private:
bool m_reconnectRequested = false;
int m_firstFrame = 10;
float m_yDelta;
std::vector<SourceRegex> m_sourceSubstitutions;
bool m_sourceRegexValid = true;