From 8ad7ba1dd07e7e8bef41b0ecd3e5dec5b641214a Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 26 Sep 2017 21:49:50 +0200 Subject: [PATCH] Middle click to zoom to zone. --- server/TracyView.cpp | 14 ++++++++++++++ server/TracyView.hpp | 3 +++ 2 files changed, 17 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 1b3ae2cf..d075408d 100755 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -999,6 +999,8 @@ void View::DrawZones() } while( false ); + m_zvStartNext = 0; + // zones const auto ostep = ImGui::GetFontSize(); int offset = 20; @@ -1012,6 +1014,12 @@ void View::DrawZones() offset += ostep * ( depth + 1.2f ); } + + if( m_zvStartNext != 0 ) + { + m_zvStart = m_zvStartNext; + m_zvEnd = m_zvEndNext; + } } int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth ) @@ -1110,6 +1118,12 @@ int View::DrawZoneLevel( const Vector& vec, bool hover, double pxns, con ImGui::Text( "Execution time: %s", TimeToString( end - ev.start ) ); ImGui::Text( "Without profiling: %s", TimeToString( end - ev.start - m_delay ) ); ImGui::EndTooltip(); + + if( ImGui::IsMouseDown( 2 ) && ev.end - ev.start > 0 ) + { + m_zvStartNext = ev.start; + m_zvEndNext = ev.end; + } } if( !ev.child.empty() ) diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 975566f2..e3d66f6d 100755 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -120,6 +120,9 @@ private: int64_t m_zvStart; int64_t m_zvEnd; + int64_t m_zvStartNext; + int64_t m_zvEndNext; + uint64_t m_delay; double m_timerMul; };