From 9546cebe3cae48dbf186fe5f620b040a2fb241f6 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Wed, 9 Sep 2020 08:32:54 -0700 Subject: [PATCH] CR --- interface/src/Application.cpp | 10 ++++++---- libraries/shared/src/shared/Camera.h | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a83b2c4431..795325d761 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -680,7 +680,9 @@ private: * CameraIndependentnumbernumberThe camera is in independent mode. * CameraEntitynumbernumberThe camera is in entity mode. * InHMDnumbernumberThe user is in HMD mode. - * CaptureMousenumbernumberThe mouse is captured. + * CaptureMousenumbernumberThe mouse is captured. In this mode, + * the mouse is invisible and cannot leave the bounds of Interface, as long as Interface is the active window and + * no menu item is selected. * AdvancedMovementnumbernumberAdvanced movement (walking) controls are * enabled. * StrafeEnablednumbernumberStrafing is enabled @@ -716,7 +718,7 @@ static const QString STATE_PLATFORM_ANDROID = "PlatformAndroid"; static const QString STATE_LEFT_HAND_DOMINANT = "LeftHandDominant"; static const QString STATE_RIGHT_HAND_DOMINANT = "RightHandDominant"; static const QString STATE_STRAFE_ENABLED = "StrafeEnabled"; -static const QString STATE_CAMERA_CAPTURE_MOUSE = "CaptureMouse"; +static const QString STATE_CAPTURE_MOUSE = "CaptureMouse"; // Statically provided display and input plugins extern DisplayPluginList getDisplayPlugins(); @@ -920,7 +922,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { DependencyManager::set(); controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_FIRST_PERSON_LOOK_AT, STATE_CAMERA_THIRD_PERSON, - STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, STATE_CAMERA_LOOK_AT, STATE_CAMERA_SELFIE, STATE_CAMERA_CAPTURE_MOUSE, + STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, STATE_CAMERA_LOOK_AT, STATE_CAMERA_SELFIE, STATE_CAPTURE_MOUSE, STATE_SNAP_TURN, STATE_ADVANCED_MOVEMENT_CONTROLS, STATE_GROUNDED, STATE_NAV_FOCUSED, STATE_PLATFORM_WINDOWS, STATE_PLATFORM_MAC, STATE_PLATFORM_ANDROID, STATE_LEFT_HAND_DOMINANT, STATE_RIGHT_HAND_DOMINANT, STATE_STRAFE_ENABLED } }); DependencyManager::set(); @@ -1893,7 +1895,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo _applicationStateDevice->setInputVariant(STATE_CAMERA_INDEPENDENT, []() -> float { return qApp->getCamera().getMode() == CAMERA_MODE_INDEPENDENT ? 1 : 0; }); - _applicationStateDevice->setInputVariant(STATE_CAMERA_CAPTURE_MOUSE, []() -> float { + _applicationStateDevice->setInputVariant(STATE_CAPTURE_MOUSE, []() -> float { return qApp->getCamera().getCaptureMouse() ? 1 : 0; }); _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float { diff --git a/libraries/shared/src/shared/Camera.h b/libraries/shared/src/shared/Camera.h index 76d344c21c..0dc8703b2d 100644 --- a/libraries/shared/src/shared/Camera.h +++ b/libraries/shared/src/shared/Camera.h @@ -120,7 +120,9 @@ public slots: bool getCaptureMouse() const { return _captureMouse; } /**jsdoc - * Sets the mouse capture state. + * Sets the mouse capture state. When true, the mouse will be invisible and cannot leave the bounds of + * Interface, as long as Interface is the active window and no menu item is selected. When false, the mouse + * will behave normally. * @function Camera.setCaptureMouse * @param {boolean} captureMouse - true to capture the mouse, false to release the mouse. */