From f227707c2cb358ff77d0734bd64454037a57497d Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 22 Jun 2019 10:05:53 +0300 Subject: [PATCH] Precision movement in GUI --- applications/gui/src/main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/applications/gui/src/main.cpp b/applications/gui/src/main.cpp index 1a887d5a0..b5d1695a0 100644 --- a/applications/gui/src/main.cpp +++ b/applications/gui/src/main.cpp @@ -334,19 +334,22 @@ class FTLApplication : public nanogui::Screen { if (Screen::keyboardEvent(key, scancode, action, modifiers)) { return true; } else { - //LOG(INFO) << "Key press " << key << " - " << action; + LOG(INFO) << "Key press " << key << " - " << action << " - " << modifiers; if (key == 263 || key == 262) { - float scalar = (key == 263) ? -0.1f : 0.1f; + float mag = (modifiers & 0x1) ? 0.01f : 0.1f; + float scalar = (key == 263) ? -mag : mag; Eigen::Affine3f r = create_rotation_matrix(orientation_[0], orientation_[1], orientation_[2]); neye_ += r.matrix()*Vector4f(scalar,0.0,0.0,1.0); return true; } else if (key == 264 || key == 265) { - float scalar = (key == 264) ? -0.1f : 0.1f; + float mag = (modifiers & 0x1) ? 0.01f : 0.1f; + float scalar = (key == 264) ? -mag : mag; Eigen::Affine3f r = create_rotation_matrix(orientation_[0], orientation_[1], orientation_[2]); neye_ += r.matrix()*Vector4f(0.0,0.0,scalar,1.0); return true; } else if (key == 266 || key == 267) { - float scalar = (key == 266) ? -0.1f : 0.1f; + float mag = (modifiers & 0x1) ? 0.01f : 0.1f; + float scalar = (key == 266) ? -mag : mag; Eigen::Affine3f r = create_rotation_matrix(orientation_[0], orientation_[1], orientation_[2]); neye_ += r.matrix()*Vector4f(0.0,scalar,0.0,1.0); return true; -- GitLab