Draw vertical line on mouse position in zone view.

This commit is contained in:
Bartosz Taudul 2017-10-13 15:26:18 +02:00
parent b217e6ab30
commit d1c43ef917
2 changed files with 19 additions and 4 deletions

View File

@ -1392,7 +1392,7 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
}
}
void View::DrawZoneFrames()
bool View::DrawZoneFrames()
{
auto& io = ImGui::GetIO();
@ -1485,6 +1485,8 @@ void View::DrawZoneFrames()
}
}
while( false );
return hover;
}
void View::DrawZones()
@ -1495,7 +1497,10 @@ void View::DrawZones()
ImGuiWindow* window = ImGui::GetCurrentWindow();
if( window->SkipItems ) return;
DrawZoneFrames();
const auto linepos = ImGui::GetCursorScreenPos();
const auto lineh = ImGui::GetContentRegionAvail().y;
auto drawMouseLine = DrawZoneFrames();
ImGui::BeginChild( "##zoneWin", ImVec2( ImGui::GetWindowContentRegionWidth(), ImGui::GetContentRegionAvail().y ), false, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
@ -1511,7 +1516,11 @@ void View::DrawZones()
auto timespan = m_zvEnd - m_zvStart;
auto pxns = w / double( timespan );
if( hover ) HandleZoneViewMouse( timespan, wpos, w, pxns );
if( hover )
{
drawMouseLine = true;
HandleZoneViewMouse( timespan, wpos, w, pxns );
}
// zones
LockHighlight nextLockHighlight { -1 };
@ -1578,6 +1587,12 @@ void View::DrawZones()
m_zvScroll = scrollPos;
ImGui::EndChild();
if( drawMouseLine )
{
auto& io = ImGui::GetIO();
draw->AddLine( ImVec2( io.MousePos.x, linepos.y ), ImVec2( io.MousePos.x, linepos.y + lineh ), 0x33FFFFFF );
}
}
int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth )

View File

@ -128,7 +128,7 @@ private:
void DrawImpl();
void DrawConnection();
void DrawFrames();
void DrawZoneFrames();
bool DrawZoneFrames();
void DrawZones();
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight );