mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-24 05:18:59 -05:00
Add support for zoom sensitivity adjustment with Ctrl/Shift (#792)
* Add support for zoom adjustment with Ctrl/Shift using Z (speed up zoom) and X (slow down zoom)
This commit is contained in:
committed by
Alexander Bock
parent
cdac35619e
commit
df9fbf8195
@@ -26,6 +26,11 @@
|
||||
|
||||
#include <openspace/interaction/inputstate.h>
|
||||
|
||||
namespace {
|
||||
const double SENSITIVITY_ADJUSTMENT_INCREASE = 8.0;
|
||||
const double SENSITIVITY_ADJUSTMENT_DECREASE = 0.5;
|
||||
}
|
||||
|
||||
namespace openspace::interaction {
|
||||
|
||||
MouseCameraStates::MouseCameraStates(double sensitivity, double velocityScaleFactor)
|
||||
@@ -82,8 +87,17 @@ void MouseCameraStates::updateStateFromInput(const InputState& inputState,
|
||||
if (button2Pressed || (keyAltPressed && button1Pressed)) {
|
||||
glm::dvec2 mousePositionDelta = _truckMovementState.previousPosition -
|
||||
mousePosition;
|
||||
|
||||
double sensitivity = _sensitivity;
|
||||
if (inputState.isKeyPressed(Key::Z)) {
|
||||
sensitivity *= SENSITIVITY_ADJUSTMENT_INCREASE;
|
||||
}
|
||||
else if (inputState.isKeyPressed(Key::X)) {
|
||||
sensitivity *= SENSITIVITY_ADJUSTMENT_DECREASE;
|
||||
}
|
||||
|
||||
_truckMovementState.velocity.set(
|
||||
mousePositionDelta * _sensitivity,
|
||||
mousePositionDelta * sensitivity,
|
||||
deltaTime
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user