mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Allow zooming to zone from zone info window.
This commit is contained in:
parent
b386e51edc
commit
fb80ac9488
@ -745,6 +745,13 @@ void View::DrawImpl()
|
||||
DrawZones();
|
||||
DrawZoneInfoWindow();
|
||||
ImGui::End();
|
||||
|
||||
if( m_zvStartNext != 0 )
|
||||
{
|
||||
m_zvStart = m_zvStartNext;
|
||||
m_zvEnd = m_zvEndNext;
|
||||
m_pause = true;
|
||||
}
|
||||
}
|
||||
|
||||
static ImU32 GetFrameColor( uint64_t frameTime )
|
||||
@ -1085,13 +1092,6 @@ void View::DrawZones()
|
||||
|
||||
offset += ostep * ( depth + 1.2f );
|
||||
}
|
||||
|
||||
if( m_zvStartNext != 0 )
|
||||
{
|
||||
m_zvStart = m_zvStartNext;
|
||||
m_zvEnd = m_zvEndNext;
|
||||
m_pause = true;
|
||||
}
|
||||
}
|
||||
|
||||
int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth )
|
||||
@ -1240,10 +1240,9 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
|
||||
|
||||
ImGui::EndTooltip();
|
||||
|
||||
if( m_zvStartNext == 0 && ImGui::IsMouseClicked( 2 ) && ev.end - ev.start > 0 )
|
||||
if( m_zvStartNext == 0 && ImGui::IsMouseClicked( 2 ) )
|
||||
{
|
||||
m_zvStartNext = ev.start;
|
||||
m_zvEndNext = ev.end;
|
||||
ZoomToZone( ev );
|
||||
}
|
||||
if( ImGui::IsMouseClicked( 0 ) )
|
||||
{
|
||||
@ -1270,6 +1269,10 @@ void View::DrawZoneInfoWindow()
|
||||
auto& ev = *m_zoneInfoWindow;
|
||||
bool show = true;
|
||||
ImGui::Begin( "Zone info", &show, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_ShowBorders );
|
||||
if( ImGui::Button( "Zoom to zone" ) )
|
||||
{
|
||||
ZoomToZone( ev );
|
||||
}
|
||||
if( ev.text && ev.text->zoneName )
|
||||
{
|
||||
ImGui::Text( "Zone name: %s", GetString( ev.text->zoneName ) );
|
||||
@ -1297,4 +1300,11 @@ uint32_t View::GetZoneHighlight( const Event& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void View::ZoomToZone( const Event& ev )
|
||||
{
|
||||
if( ev.end - ev.start <= 0 ) return;
|
||||
m_zvStartNext = ev.start;
|
||||
m_zvEndNext = ev.end;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ private:
|
||||
void DrawZoneInfoWindow();
|
||||
|
||||
uint32_t GetZoneHighlight( const Event& ev );
|
||||
void ZoomToZone( const Event& ev );
|
||||
|
||||
std::string m_addr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user