mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Move mouse highlight data to a separate struct.
This commit is contained in:
parent
f7829a7eae
commit
dee7fd27be
@ -161,7 +161,6 @@ View::View( const char* addr )
|
||||
, m_zoneInfoWindow( nullptr )
|
||||
, m_lockHighlight { -1 }
|
||||
, m_gpuInfoWindow( nullptr )
|
||||
, m_drawRegion( false )
|
||||
, m_gpuThread( 0 )
|
||||
, m_gpuStart( 0 )
|
||||
, m_gpuEnd( 0 )
|
||||
@ -193,7 +192,6 @@ View::View( FileRead& f )
|
||||
, m_zvScroll( 0 )
|
||||
, m_zoneInfoWindow( nullptr )
|
||||
, m_gpuInfoWindow( nullptr )
|
||||
, m_drawRegion( false )
|
||||
, m_gpuThread( 0 )
|
||||
, m_gpuStart( 0 )
|
||||
, m_gpuEnd( 0 )
|
||||
@ -608,16 +606,16 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
|
||||
|
||||
if( ImGui::IsMouseClicked( 0 ) )
|
||||
{
|
||||
m_drawRegion = true;
|
||||
m_regionEnd = m_regionStart = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
m_highlight.active = true;
|
||||
m_highlight.start = m_highlight.end = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
}
|
||||
else if( ImGui::IsMouseDragging( 0, 0 ) )
|
||||
{
|
||||
m_regionEnd = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
m_highlight.end = m_zvStart + ( io.MousePos.x - wpos.x ) * nspx;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_drawRegion = false;
|
||||
m_highlight.active = false;
|
||||
}
|
||||
|
||||
if( ImGui::IsMouseDragging( 1, 0 ) )
|
||||
@ -1062,10 +1060,10 @@ void View::DrawZones()
|
||||
draw->AddRect( ImVec2( wpos.x + px0, linepos.y ), ImVec2( wpos.x + px1, linepos.y + lineh ), 0x4488DD88 );
|
||||
}
|
||||
|
||||
if( m_drawRegion && m_regionStart != m_regionEnd )
|
||||
if( m_highlight.active && m_highlight.start != m_highlight.end )
|
||||
{
|
||||
const auto s = std::min( m_regionStart, m_regionEnd );
|
||||
const auto e = std::max( m_regionStart, m_regionEnd );
|
||||
const auto s = std::min( m_highlight.start, m_highlight.end );
|
||||
const auto e = std::max( m_highlight.start, m_highlight.end );
|
||||
draw->AddRectFilled( ImVec2( wpos.x + ( s - m_zvStart ) * pxns, linepos.y ), ImVec2( wpos.x + ( e - m_zvStart ) * pxns, linepos.y + lineh ), 0x22DD8888 );
|
||||
draw->AddRect( ImVec2( wpos.x + ( s - m_zvStart ) * pxns, linepos.y ), ImVec2( wpos.x + ( e - m_zvStart ) * pxns, linepos.y + lineh ), 0x44DD8888 );
|
||||
|
||||
|
@ -32,6 +32,13 @@ class View
|
||||
double lenMod;
|
||||
};
|
||||
|
||||
struct Region
|
||||
{
|
||||
bool active = false;
|
||||
int64_t start;
|
||||
int64_t end;
|
||||
};
|
||||
|
||||
public:
|
||||
View() : View( "127.0.0.1" ) {}
|
||||
View( const char* addr );
|
||||
@ -142,9 +149,7 @@ private:
|
||||
const GpuEvent* m_gpuHighlight;
|
||||
uint64_t m_gpuInfoWindowThread;
|
||||
|
||||
bool m_drawRegion;
|
||||
int64_t m_regionStart;
|
||||
int64_t m_regionEnd;
|
||||
Region m_highlight;
|
||||
|
||||
uint64_t m_gpuThread;
|
||||
int64_t m_gpuStart;
|
||||
|
Loading…
Reference in New Issue
Block a user