mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 04:23:51 +00:00
Add ctrl/shift modifiers to mouse wheel zoom speed.
This commit is contained in:
parent
0bd6479f85
commit
4a8bfb4fac
@ -2236,15 +2236,20 @@ void View::HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, d
|
|||||||
const auto zoomSpan = t1 - t0;
|
const auto zoomSpan = t1 - t0;
|
||||||
const auto p1 = zoomSpan * p;
|
const auto p1 = zoomSpan * p;
|
||||||
const auto p2 = zoomSpan - p1;
|
const auto p2 = zoomSpan - p1;
|
||||||
|
|
||||||
|
double mod = 0.25;
|
||||||
|
if( io.KeyCtrl ) mod = 0.05;
|
||||||
|
else if( io.KeyShift ) mod = 0.5;
|
||||||
|
|
||||||
if( wheel > 0 )
|
if( wheel > 0 )
|
||||||
{
|
{
|
||||||
t0 += int64_t( p1 * 0.25 );
|
t0 += int64_t( p1 * mod );
|
||||||
t1 -= int64_t( p2 * 0.25 );
|
t1 -= int64_t( p2 * mod );
|
||||||
}
|
}
|
||||||
else if( zoomSpan < 1000ll * 1000 * 1000 * 60 * 60 )
|
else if( zoomSpan < 1000ll * 1000 * 1000 * 60 * 60 )
|
||||||
{
|
{
|
||||||
t0 -= std::max( int64_t( 1 ), int64_t( p1 * 0.25 ) );
|
t0 -= std::max( int64_t( 1 ), int64_t( p1 * mod ) );
|
||||||
t1 += std::max( int64_t( 1 ), int64_t( p2 * 0.25 ) );
|
t1 += std::max( int64_t( 1 ), int64_t( p2 * mod ) );
|
||||||
}
|
}
|
||||||
ZoomToRange( t0, t1, !m_worker.IsConnected() || m_viewMode == ViewMode::Paused );
|
ZoomToRange( t0, t1, !m_worker.IsConnected() || m_viewMode == ViewMode::Paused );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user