mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 20:53:52 +00:00
Only smooth zoom now.
This commit is contained in:
parent
cd774b9e96
commit
45750a05a1
3
NEWS
3
NEWS
@ -44,8 +44,7 @@ v0.5 (xxxx-xx-xx)
|
||||
- User experience improvements in the graphical profiler.
|
||||
- Thread position and height is now animated, to eliminate flickering that
|
||||
was happening when depth of displayed zones was changing.
|
||||
- Zooming in/out using the mouse wheel is now animated. Press the control
|
||||
key for old behavior.
|
||||
- Zooming in/out using the mouse wheel is now animated.
|
||||
- Plot range adjustment is now animated.
|
||||
- System CPU usage is now being monitored.
|
||||
- Threads that have nothing to display in the current view are now hidden by
|
||||
|
@ -1399,53 +1399,31 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
|
||||
const double mouse = io.MousePos.x - wpos.x;
|
||||
const auto p = mouse / w;
|
||||
|
||||
if( io.KeyCtrl )
|
||||
int64_t t0, t1;
|
||||
if( m_zoomAnim.active )
|
||||
{
|
||||
m_zoomAnim.active = false;
|
||||
m_pause = true;
|
||||
const auto p1 = timespan * p;
|
||||
const auto p2 = timespan - p1;
|
||||
if( wheel > 0 )
|
||||
{
|
||||
m_zvStart += int64_t( p1 * 0.25 );
|
||||
m_zvEnd -= int64_t( p2 * 0.25 );
|
||||
}
|
||||
else if( timespan < 1000ll * 1000 * 1000 * 60 * 60 )
|
||||
{
|
||||
m_zvStart -= std::max( int64_t( 1 ), int64_t( p1 * 0.25 ) );
|
||||
m_zvEnd += std::max( int64_t( 1 ), int64_t( p2 * 0.25 ) );
|
||||
}
|
||||
timespan = m_zvEnd - m_zvStart;
|
||||
pxns = w / double( timespan );
|
||||
t0 = m_zoomAnim.start1;
|
||||
t1 = m_zoomAnim.end1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int64_t t0, t1;
|
||||
if( m_zoomAnim.active )
|
||||
{
|
||||
t0 = m_zoomAnim.start1;
|
||||
t1 = m_zoomAnim.end1;
|
||||
}
|
||||
else
|
||||
{
|
||||
t0 = m_zvStart;
|
||||
t1 = m_zvEnd;
|
||||
}
|
||||
const auto zoomSpan = t1 - t0;
|
||||
const auto p1 = zoomSpan * p;
|
||||
const auto p2 = zoomSpan - p1;
|
||||
if( wheel > 0 )
|
||||
{
|
||||
t0 += int64_t( p1 * 0.25 );
|
||||
t1 -= int64_t( p2 * 0.25 );
|
||||
}
|
||||
else if( zoomSpan < 1000ll * 1000 * 1000 * 60 * 60 )
|
||||
{
|
||||
t0 -= std::max( int64_t( 1 ), int64_t( p1 * 0.25 ) );
|
||||
t1 += std::max( int64_t( 1 ), int64_t( p2 * 0.25 ) );
|
||||
}
|
||||
ZoomToRange( t0, t1 );
|
||||
t0 = m_zvStart;
|
||||
t1 = m_zvEnd;
|
||||
}
|
||||
const auto zoomSpan = t1 - t0;
|
||||
const auto p1 = zoomSpan * p;
|
||||
const auto p2 = zoomSpan - p1;
|
||||
if( wheel > 0 )
|
||||
{
|
||||
t0 += int64_t( p1 * 0.25 );
|
||||
t1 -= int64_t( p2 * 0.25 );
|
||||
}
|
||||
else if( zoomSpan < 1000ll * 1000 * 1000 * 60 * 60 )
|
||||
{
|
||||
t0 -= std::max( int64_t( 1 ), int64_t( p1 * 0.25 ) );
|
||||
t1 += std::max( int64_t( 1 ), int64_t( p2 * 0.25 ) );
|
||||
}
|
||||
ZoomToRange( t0, t1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user