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:
mingenuity
2019-02-18 12:42:46 -05:00
committed by Alexander Bock
parent cdac35619e
commit df9fbf8195
+15 -1
View File
@@ -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
);
}