mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Zoom in/out in zone view.
This commit is contained in:
parent
a353a7601d
commit
2f645c589d
@ -645,8 +645,8 @@ void View::DrawZones()
|
||||
ImGui::InvisibleButton( "##zones", ImVec2( w, h ) );
|
||||
bool hover = ImGui::IsItemHovered();
|
||||
|
||||
const auto timespan = m_zvEnd - m_zvStart;
|
||||
const auto pxns = w / double( timespan );
|
||||
auto timespan = m_zvEnd - m_zvStart;
|
||||
auto pxns = w / double( timespan );
|
||||
|
||||
if( hover )
|
||||
{
|
||||
@ -659,6 +659,28 @@ void View::DrawZones()
|
||||
m_zvEnd -= delta * nspx;
|
||||
io.MouseClickedPos[1].x = io.MousePos.x;
|
||||
}
|
||||
|
||||
const auto wheel = io.MouseWheel;
|
||||
if( wheel != 0 )
|
||||
{
|
||||
m_pause = true;
|
||||
const double mouse = io.MousePos.x - wpos.x;
|
||||
const auto p = mouse / w;
|
||||
const auto p1 = timespan * p;
|
||||
const auto p2 = timespan - p1;
|
||||
if( wheel > 0 )
|
||||
{
|
||||
m_zvStart += int64_t( p1 * 0.1f );
|
||||
m_zvEnd -= int64_t( p2 * 0.1f );
|
||||
}
|
||||
else if( timespan < 1000ull * 1000 * 1000 * 60 )
|
||||
{
|
||||
m_zvStart -= std::max( 1ll, int64_t( p1 * 0.1f ) );
|
||||
m_zvEnd += std::max( 1ll, int64_t( p2 * 0.1f ) );
|
||||
}
|
||||
timespan = m_zvEnd - m_zvStart;
|
||||
pxns = w / double( timespan );
|
||||
}
|
||||
}
|
||||
|
||||
const auto zitbegin = std::lower_bound( m_frames.begin(), m_frames.end(), m_zvStart );
|
||||
|
Loading…
Reference in New Issue
Block a user