diff --git a/server/TracyView.cpp b/server/TracyView.cpp index f5f1c86f..31fd6805 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -763,6 +763,23 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d m_highlight.active = false; } + if( ImGui::IsMouseClicked( 2 ) ) + { + m_highlightZoom.active = true; + m_highlightZoom.start = m_highlightZoom.end = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx; + } + else if( ImGui::IsMouseDragging( 2, 0 ) ) + { + m_highlightZoom.end = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx; + } + else if( m_highlightZoom.active ) + { + m_highlightZoom.active = false; + const auto s = std::min( m_highlightZoom.start, m_highlightZoom.end ); + const auto e = std::max( m_highlightZoom.start, m_highlightZoom.end ); + ZoomToRange( s, e ); + } + if( ImGui::IsMouseDragging( 1, 0 ) ) { m_pause = true; @@ -1269,6 +1286,14 @@ void View::DrawZones() draw->AddLine( ImVec2( io.MousePos.x, linepos.y ), ImVec2( io.MousePos.x, linepos.y + lineh ), 0x33FFFFFF ); } + if( m_highlightZoom.active && 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 ); + draw->AddRectFilled( ImVec2( wpos.x + ( s - m_zvStart ) * pxns, linepos.y ), ImVec2( wpos.x + ( e - m_zvStart ) * pxns, linepos.y + lineh ), 0x1688DD88 ); + draw->AddRect( ImVec2( wpos.x + ( s - m_zvStart ) * pxns, linepos.y ), ImVec2( wpos.x + ( e - m_zvStart ) * pxns, linepos.y + lineh ), 0x2C88DD88 ); + } + if( m_memInfo.show && m_memInfo.restrictTime ) { const auto zvMid = ( m_zvEnd - m_zvStart ) / 2; diff --git a/server/TracyView.hpp b/server/TracyView.hpp index a2c76f92..77d8c3d6 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -196,6 +196,7 @@ private: int m_memoryAllocHoverWait; Region m_highlight; + Region m_highlightZoom; uint64_t m_gpuThread; int64_t m_gpuStart;