mirror of
https://github.com/wolfpld/tracy.git
synced 2026-10-14 04:45:22 +00:00
Fix issues with timeline highlight code when IsMouseClickReleased is called
`HandleTimelineMouse` did the following - `m_highlight.active = true` when clicked - update range while dragging - `m_highlight.active = false` when not dragging This causes issues when `IsMouseClickReleased` is called somewhere else as - `mousePotentialClickRelease` is set to true on click - At beginning of frame, `mouseDragging` is set to `false` as long as `mousePotentialClickRelease` is `true` and mouse delta is under the drag threshold - This means that if the mouse didn't move enough in the duration of a frame, highlight would immediately stop, even though we were still holding the mouse button down Instead, it now only stops highlighting once the mouse is no longer down (ie: has been "released", cursor having moved or not)
This commit is contained in:
@@ -444,7 +444,7 @@ bool View::DrawCpuData( const TimelineContext& ctx, const std::vector<CpuUsageDr
|
||||
offset += sstep;
|
||||
}
|
||||
|
||||
if( IsMouseClickReleased( ImGuiMouseButton_Left ) && ImGui::IsMouseHoveringRect( wpos, wpos + ImVec2( w, offset ) ) )
|
||||
if( ImGui::IsMouseHoveringRect( wpos, wpos + ImVec2( w, offset ) ) && IsMouseClickReleased( ImGuiMouseButton_Left ) )
|
||||
{
|
||||
if( m_drawThreadHighlight != 0 )
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w )
|
||||
{
|
||||
m_highlight.end = m_vd.zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
}
|
||||
else if( m_highlight.active )
|
||||
else if( m_highlight.active && !IsMouseDown( 0 ) )
|
||||
{
|
||||
if( ImGui::GetIO().KeyCtrl && m_highlight.start != m_highlight.end )
|
||||
{
|
||||
@@ -49,7 +49,7 @@ void View::HandleTimelineMouse( int64_t timespan, const ImVec2& wpos, float w )
|
||||
{
|
||||
m_highlightZoom.end = m_vd.zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
}
|
||||
else if( m_highlightZoom.active )
|
||||
else if( m_highlightZoom.active && !IsMouseDown( 2 ) )
|
||||
{
|
||||
if( m_highlightZoom.start != m_highlightZoom.end )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user