Showing the changes to interface/src/Application.cpp (1 of 7 files). Show all
Unified · Split
| @@ -3097,17 +3097,23 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 3096 unmodified lines | ||
| 3097 | 3097 | |
| 3098 | 3098 | if (compositor.getReticleVisible() || !isHMDMode() || !compositor.getReticleOverDesktop() || |
| 3099 | 3099 | getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_OVERLAY_ID) { |
| 3100 | − getOverlays().mouseMoveEvent(&mappedEvent); | |
| 3101 | − getEntities()->mouseMoveEvent(&mappedEvent); | |
| 3100 | + if (_mouseToOverlays) { | |
| 3101 | + getOverlays().mouseMoveEvent(&mappedEvent); | |
| 3102 | + } else { | |
| 3103 | + getEntities()->mouseMoveEvent(&mappedEvent); | |
| 3104 | + } | |
| 3105 | + } | |
| 3106 | + | |
| 3107 | + if (!_mouseToOverlays) { | |
| 3108 | + _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts | |
| 3102 | 3109 | } |
| 3103 | − _controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts | |
| 3104 | 3110 | |
| 3105 | 3111 | // if one of our scripts have asked to capture this event, then stop processing it |
| 3106 | 3112 | if (_controllerScriptingInterface->isMouseCaptured()) { |
| 3107 | 3113 | return; |
| 3108 | 3114 | } |
| 3109 | 3115 | |
| 3110 | − if (_keyboardMouseDevice->isActive()) { | |
| 3116 | + if (!_mouseToOverlays && _keyboardMouseDevice->isActive()) { | |
| 3111 | 3117 | _keyboardMouseDevice->mouseMoveEvent(event); |
| 3112 | 3118 | } |
| 3113 | 3119 | } |
| @@ -3115,6 +3121,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 1 unmodified line | ||
| 3115 | 3121 | void Application::mousePressEvent(QMouseEvent* event) { |
| 3116 | 3122 | // Inhibit the menu if the user is using alt-mouse dragging |
| 3117 | 3123 | _altPressed = false; |
| 3124 | + _mouseToOverlays = false; | |
| 3118 | 3125 | |
| 3119 | 3126 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 3120 | 3127 | // If we get a mouse press event it means it wasn't consumed by the offscreen UI, |
| @@ -3131,21 +3138,23 @@ void Application::mousePressEvent(QMouseEvent* event) { · 10 unmodified lines | ||
| 3131 | 3138 | event->buttons(), event->modifiers()); |
| 3132 | 3139 | |
| 3133 | 3140 | if (!_aboutToQuit) { |
| 3134 | − getOverlays().mousePressEvent(&mappedEvent); | |
| 3135 | − | |
| 3136 | − if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 3141 | + if (getOverlays().mousePressEvent(&mappedEvent)) { | |
| 3142 | + _mouseToOverlays = true; | |
| 3143 | + } else if (!_controllerScriptingInterface->areEntityClicksCaptured()) { | |
| 3137 | 3144 | getEntities()->mousePressEvent(&mappedEvent); |
| 3138 | 3145 | } |
| 3139 | 3146 | } |
| 3140 | 3147 | |
| 3141 | − _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts | |
| 3148 | + if (!_mouseToOverlays) { | |
| 3149 | + _controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts | |
| 3150 | + } | |
| 3142 | 3151 | |
| 3143 | 3152 | // if one of our scripts have asked to capture this event, then stop processing it |
| 3144 | 3153 | if (_controllerScriptingInterface->isMouseCaptured()) { |
| 3145 | 3154 | return; |
| 3146 | 3155 | } |
| 3147 | 3156 | |
| 3148 | − if (hasFocus()) { | |
| 3157 | + if (!_mouseToOverlays && hasFocus()) { | |
| 3149 | 3158 | if (_keyboardMouseDevice->isActive()) { |
| 3150 | 3159 | _keyboardMouseDevice->mousePressEvent(event); |
| 3151 | 3160 | } |
| @@ -3179,18 +3188,23 @@ void Application::mouseReleaseEvent(QMouseEvent* event) { · 27 unmodified lines | ||
| 3179 | 3188 | event->buttons(), event->modifiers()); |
| 3180 | 3189 | |
| 3181 | 3190 | if (!_aboutToQuit) { |
| 3182 | − getOverlays().mouseReleaseEvent(&mappedEvent); | |
| 3183 | − getEntities()->mouseReleaseEvent(&mappedEvent); | |
| 3191 | + if (_mouseToOverlays) { | |
| 3192 | + getOverlays().mouseReleaseEvent(&mappedEvent); | |
| 3193 | + } else { | |
| 3194 | + getEntities()->mouseReleaseEvent(&mappedEvent); | |
| 3195 | + } | |
| 3184 | 3196 | } |
| 3185 | 3197 | |
| 3186 | − _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts | |
| 3198 | + if (!_mouseToOverlays) { | |
| 3199 | + _controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts | |
| 3200 | + } | |
| 3187 | 3201 | |
| 3188 | 3202 | // if one of our scripts have asked to capture this event, then stop processing it |
| 3189 | 3203 | if (_controllerScriptingInterface->isMouseCaptured()) { |
| 3190 | 3204 | return; |
| 3191 | 3205 | } |
| 3192 | 3206 | |
| 3193 | − if (hasFocus()) { | |
| 3207 | + if (!_mouseToOverlays && hasFocus()) { | |
| 3194 | 3208 | if (_keyboardMouseDevice->isActive()) { |
| 3195 | 3209 | _keyboardMouseDevice->mouseReleaseEvent(event); |
| 3196 | 3210 | } |