Prevent range-zoom when range has zero length.

This commit is contained in:
Bartosz Taudul 2018-08-05 01:19:08 +02:00
parent b92087bd95
commit 1b44b31eff

View File

@ -827,6 +827,8 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
m_highlightZoom.end = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx;
}
else if( m_highlightZoom.active )
{
if( m_highlightZoom.start != m_highlightZoom.end )
{
const auto s = std::min( m_highlightZoom.start, m_highlightZoom.end );
const auto e = std::max( m_highlightZoom.start, m_highlightZoom.end );
@ -847,6 +849,11 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
ZoomToRange( s, e );
}
}
else
{
m_highlightZoom.active = false;
}
}
if( ImGui::IsMouseDragging( 1, 0 ) )
{