From e028943645b2616662d24fe29259c50ec76604e1 Mon Sep 17 00:00:00 2001 From: HifiExperiments Date: Fri, 9 Oct 2020 13:33:48 -0700 Subject: [PATCH] CR --- interface/src/Application.cpp | 2 +- interface/src/FancyCamera.h | 4 ++++ libraries/shared/src/shared/Camera.h | 25 +++++++++++++------------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d8c4dde1a8..866d9ffe66 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2413,7 +2413,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo updateSystemTabletMode(); connect(&_myCamera, &Camera::modeUpdated, this, &Application::cameraModeChanged); - connect(&_myCamera, &Camera::captureMouseUpdated, this, &Application::captureMouseChanged); + connect(&_myCamera, &Camera::captureMouseChanged, this, &Application::captureMouseChanged); DependencyManager::get()->setShouldPickHUDOperator([]() { return DependencyManager::get()->isHMDMode(); }); DependencyManager::get()->setCalculatePos2DFromHUDOperator([this](const glm::vec3& intersection) { diff --git a/interface/src/FancyCamera.h b/interface/src/FancyCamera.h index 2a131d991f..afcd5197ff 100644 --- a/interface/src/FancyCamera.h +++ b/interface/src/FancyCamera.h @@ -36,6 +36,10 @@ class FancyCamera : public Camera { * @property {ViewFrustum} frustum - The camera frustum. * @property {Uuid} cameraEntity - The ID of the entity that is used for the camera position and orientation when the * camera is in entity mode. + * @property {boolean} captureMouse - The mouse capture state. When true, 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. When false, the mouse + * behaves normally. + * @property {number} sensitivity - The current camera sensitivity. Must be positive. */ Q_PROPERTY(QUuid cameraEntity READ getCameraEntity WRITE setCameraEntity) diff --git a/libraries/shared/src/shared/Camera.h b/libraries/shared/src/shared/Camera.h index f6ce9be2d8..f494318c73 100644 --- a/libraries/shared/src/shared/Camera.h +++ b/libraries/shared/src/shared/Camera.h @@ -44,7 +44,7 @@ class Camera : public QObject { Q_PROPERTY(glm::quat orientation READ getOrientation WRITE setOrientation) Q_PROPERTY(QString mode READ getModeString WRITE setModeString NOTIFY modeUpdated) Q_PROPERTY(QVariantMap frustum READ getViewFrustum CONSTANT) - Q_PROPERTY(bool captureMouse READ getCaptureMouse WRITE setCaptureMouse NOTIFY captureMouseUpdated) + Q_PROPERTY(bool captureMouse READ getCaptureMouse WRITE setCaptureMouse NOTIFY captureMouseChanged) Q_PROPERTY(float sensitivity READ getSensitivity WRITE setSensitivity) public: @@ -115,31 +115,32 @@ public slots: /**jsdoc * Gets the current mouse capture state. - * @function Camera.getMouseCapture - * @returns {boolean} The current mouse capture state. + * @function Camera.getCaptureMouse + * @returns {boolean} true if the mouse is captured (is invisible and cannot leave the bounds of Interface, + * if Interface is the active window and no menu item is selected), false if the mouse is behaving normally. */ bool getCaptureMouse() const { return _captureMouse; } /**jsdoc - * Sets the mouse capture state. When true, the mouse will be invisible and cannot leave the bounds of + * Sets the mouse capture state. When true, 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. When false, the mouse - * will behave normally. + * behaves normally. * @function Camera.setCaptureMouse * @param {boolean} captureMouse - true to capture the mouse, false to release the mouse. */ - void setCaptureMouse(bool captureMouse) { _captureMouse = captureMouse; emit captureMouseUpdated(captureMouse); } + void setCaptureMouse(bool captureMouse) { _captureMouse = captureMouse; emit captureMouseChanged(captureMouse); } /**jsdoc * Gets the current camera sensitivity. * @function Camera.getSensitivity - * @returns {boolean} The current camera sensitivity. + * @returns {number} The current camera sensitivity. Must be positive. */ float getSensitivity() const { return _sensitivity; } /**jsdoc * Sets the camera sensitivity. Higher values mean that the camera will be more sensitive to mouse movements. * @function Camera.setSensitivity - * @param {boolean} sensitivity - The desired camera sensitivity. + * @param {number} sensitivity - The desired camera sensitivity. Must be positive. */ void setSensitivity(float sensitivity) { _sensitivity = glm::max(0.0f, sensitivity); } @@ -216,17 +217,17 @@ signals: /**jsdoc * Triggered when the camera mouse capture state changes. - * @function Camera.captureMouseUpdated + * @function Camera.captureMouseChanged * @param {boolean} newCaptureMouse - The new mouse capture state. * @returns {Signal} * @example Report mouse capture state changes. - * function onCaptureMouseUpdated(newCaptureMouse) { + * function onCaptureMouseChanged(newCaptureMouse) { * print("The mouse capture has changed to " + newCaptureMouse); * } * - * Camera.captureMouseUpdated.connect(onCaptureMouseUpdated); + * Camera.captureMouseChanged.connect(onCaptureMouseChanged); */ - void captureMouseUpdated(bool newCaptureMouse); + void captureMouseChanged(bool newCaptureMouse); private: void recompose();