mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[3d] Allow Shift+up/down/left/right keys to rotate/tilt camera
Just like user can drag map with mouse or move it with up/down/left/right keys, for consistency with Shift+drag we have now also support for arrow keys.
This commit is contained in:
parent
63c1925618
commit
9f3b3e50d5
@ -240,7 +240,7 @@ void QgsCameraController::frameTriggered( float dt )
|
||||
float tx = mTxAxis->value() * dt * mCameraData.dist * 1.5;
|
||||
float ty = -mTyAxis->value() * dt * mCameraData.dist * 1.5;
|
||||
|
||||
if ( tx || ty )
|
||||
if ( !mShiftAction->isActive() && ( tx || ty ) )
|
||||
{
|
||||
// moving with keyboard - take into account yaw of camera
|
||||
float t = sqrt( tx * tx + ty * ty );
|
||||
@ -253,9 +253,16 @@ void QgsCameraController::frameTriggered( float dt )
|
||||
|
||||
if ( ( mLeftMouseButtonAction->isActive() && mShiftAction->isActive() ) || mMiddleMouseButtonAction->isActive() )
|
||||
{
|
||||
// rotate/tilt using mouse
|
||||
mCameraData.pitch += dy;
|
||||
mCameraData.yaw -= dx / 2;
|
||||
}
|
||||
else if ( mShiftAction->isActive() && ( mTxAxis->value() || mTyAxis->value() ) )
|
||||
{
|
||||
// rotate/tilt using keyboard
|
||||
mCameraData.pitch -= mTyAxis->value(); // down key = moving camera toward terrain
|
||||
mCameraData.yaw -= mTxAxis->value(); // right key = moving camera clockwise
|
||||
}
|
||||
else if ( mLeftMouseButtonAction->isActive() && !mShiftAction->isActive() )
|
||||
{
|
||||
// translation works as if one grabbed a point on the plane and dragged it
|
||||
|
Loading…
x
Reference in New Issue
Block a user