mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Basic histogram introspection.
This commit is contained in:
parent
fbe1af80b5
commit
f6cc360c69
@ -4204,6 +4204,7 @@ void View::DrawFindZone()
|
||||
const auto wpos = ImGui::GetCursorScreenPos();
|
||||
|
||||
ImGui::InvisibleButton( "##histogram", ImVec2( w, Height ) );
|
||||
const bool hover = ImGui::IsItemHovered();
|
||||
|
||||
auto draw = ImGui::GetWindowDrawList();
|
||||
draw->AddRectFilled( wpos, wpos + ImVec2( w, Height ), 0x22FFFFFF );
|
||||
@ -4255,6 +4256,21 @@ void View::DrawFindZone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( hover && ImGui::IsMouseHoveringRect( wpos + ImVec2( 2, 2 ), wpos + ImVec2( w-2, Height-2 ) ) )
|
||||
{
|
||||
auto& io = ImGui::GetIO();
|
||||
draw->AddLine( ImVec2( io.MousePos.x, wpos.y ), ImVec2( io.MousePos.x, wpos.y+Height-2 ), 0x33FFFFFF );
|
||||
|
||||
const auto bin = double( io.MousePos.x - wpos.x - 2 );
|
||||
const auto t0 = int64_t( tmin + bin / numBins * ( tmax - tmin ) );
|
||||
const auto t1 = int64_t( tmin + (bin+1) / numBins * ( tmax - tmin ) );
|
||||
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text( "Time range: %s - %s", TimeToString( t0 ), TimeToString( t1 ) );
|
||||
ImGui::Text( "Count: %" PRIu64, bins[bin] );
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user