mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 14:07:22 +02:00
in 2d mode, clicks on tablet don't get used for other things
Conflicts: scripts/system/libraries/entitySelectionTool.js
This commit is contained in:
parent
73774a6590
commit
70060eb464
7 changed files with 57 additions and 23 deletions
|
@ -3097,17 +3097,23 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
if (compositor.getReticleVisible() || !isHMDMode() || !compositor.getReticleOverDesktop() ||
|
if (compositor.getReticleVisible() || !isHMDMode() || !compositor.getReticleOverDesktop() ||
|
||||||
getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_OVERLAY_ID) {
|
getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_OVERLAY_ID) {
|
||||||
getOverlays().mouseMoveEvent(&mappedEvent);
|
if (_mouseToOverlays) {
|
||||||
getEntities()->mouseMoveEvent(&mappedEvent);
|
getOverlays().mouseMoveEvent(&mappedEvent);
|
||||||
|
} else {
|
||||||
|
getEntities()->mouseMoveEvent(&mappedEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_mouseToOverlays) {
|
||||||
|
_controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
|
||||||
}
|
}
|
||||||
_controllerScriptingInterface->emitMouseMoveEvent(&mappedEvent); // send events to any registered scripts
|
|
||||||
|
|
||||||
// if one of our scripts have asked to capture this event, then stop processing it
|
// if one of our scripts have asked to capture this event, then stop processing it
|
||||||
if (_controllerScriptingInterface->isMouseCaptured()) {
|
if (_controllerScriptingInterface->isMouseCaptured()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_keyboardMouseDevice->isActive()) {
|
if (!_mouseToOverlays && _keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mouseMoveEvent(event);
|
_keyboardMouseDevice->mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3115,6 +3121,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
void Application::mousePressEvent(QMouseEvent* event) {
|
void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
// Inhibit the menu if the user is using alt-mouse dragging
|
// Inhibit the menu if the user is using alt-mouse dragging
|
||||||
_altPressed = false;
|
_altPressed = false;
|
||||||
|
_mouseToOverlays = false;
|
||||||
|
|
||||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||||
// If we get a mouse press event it means it wasn't consumed by the offscreen UI,
|
// 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) {
|
||||||
event->buttons(), event->modifiers());
|
event->buttons(), event->modifiers());
|
||||||
|
|
||||||
if (!_aboutToQuit) {
|
if (!_aboutToQuit) {
|
||||||
getOverlays().mousePressEvent(&mappedEvent);
|
if (getOverlays().mousePressEvent(&mappedEvent)) {
|
||||||
|
_mouseToOverlays = true;
|
||||||
if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
|
} else if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
|
||||||
getEntities()->mousePressEvent(&mappedEvent);
|
getEntities()->mousePressEvent(&mappedEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
|
if (!_mouseToOverlays) {
|
||||||
|
_controllerScriptingInterface->emitMousePressEvent(&mappedEvent); // send events to any registered scripts
|
||||||
|
}
|
||||||
|
|
||||||
// if one of our scripts have asked to capture this event, then stop processing it
|
// if one of our scripts have asked to capture this event, then stop processing it
|
||||||
if (_controllerScriptingInterface->isMouseCaptured()) {
|
if (_controllerScriptingInterface->isMouseCaptured()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus()) {
|
if (!_mouseToOverlays && hasFocus()) {
|
||||||
if (_keyboardMouseDevice->isActive()) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mousePressEvent(event);
|
_keyboardMouseDevice->mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -3179,18 +3188,23 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
event->buttons(), event->modifiers());
|
event->buttons(), event->modifiers());
|
||||||
|
|
||||||
if (!_aboutToQuit) {
|
if (!_aboutToQuit) {
|
||||||
getOverlays().mouseReleaseEvent(&mappedEvent);
|
if (_mouseToOverlays) {
|
||||||
getEntities()->mouseReleaseEvent(&mappedEvent);
|
getOverlays().mouseReleaseEvent(&mappedEvent);
|
||||||
|
} else {
|
||||||
|
getEntities()->mouseReleaseEvent(&mappedEvent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
|
if (!_mouseToOverlays) {
|
||||||
|
_controllerScriptingInterface->emitMouseReleaseEvent(&mappedEvent); // send events to any registered scripts
|
||||||
|
}
|
||||||
|
|
||||||
// if one of our scripts have asked to capture this event, then stop processing it
|
// if one of our scripts have asked to capture this event, then stop processing it
|
||||||
if (_controllerScriptingInterface->isMouseCaptured()) {
|
if (_controllerScriptingInterface->isMouseCaptured()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus()) {
|
if (!_mouseToOverlays && hasFocus()) {
|
||||||
if (_keyboardMouseDevice->isActive()) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mouseReleaseEvent(event);
|
_keyboardMouseDevice->mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,6 +676,8 @@ private:
|
||||||
void addAssetToWorldInfoDone(QString modelName);
|
void addAssetToWorldInfoDone(QString modelName);
|
||||||
void addAssetToWorldError(QString modelName, QString errorText);
|
void addAssetToWorldError(QString modelName, QString errorText);
|
||||||
|
|
||||||
|
bool _mouseToOverlays { false };
|
||||||
|
|
||||||
QQuickItem* _addAssetToWorldMessageBox{ nullptr };
|
QQuickItem* _addAssetToWorldMessageBox{ nullptr };
|
||||||
QStringList _addAssetToWorldInfoKeys; // Model name
|
QStringList _addAssetToWorldInfoKeys; // Model name
|
||||||
QStringList _addAssetToWorldInfoMessages; // Info message
|
QStringList _addAssetToWorldInfoMessages; // Info message
|
||||||
|
|
|
@ -760,7 +760,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionForMouseEvent(PickRa
|
||||||
return findRayIntersection(ray);
|
return findRayIntersection(ray);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::mousePressEvent(QMouseEvent* event) {
|
bool Overlays::mousePressEvent(QMouseEvent* event) {
|
||||||
PerformanceTimer perfTimer("Overlays::mousePressEvent");
|
PerformanceTimer perfTimer("Overlays::mousePressEvent");
|
||||||
|
|
||||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||||
|
@ -773,15 +773,14 @@ void Overlays::mousePressEvent(QMouseEvent* event) {
|
||||||
if (thisOverlay) {
|
if (thisOverlay) {
|
||||||
auto pointerEvent = calculatePointerEvent(thisOverlay, ray, rayPickResult, event, PointerEvent::Press);
|
auto pointerEvent = calculatePointerEvent(thisOverlay, ray, rayPickResult, event, PointerEvent::Press);
|
||||||
emit mousePressOnOverlay(_currentClickingOnOverlayID, pointerEvent);
|
emit mousePressOnOverlay(_currentClickingOnOverlayID, pointerEvent);
|
||||||
} else {
|
return true;
|
||||||
emit mousePressOffOverlay();
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
emit mousePressOffOverlay();
|
|
||||||
}
|
}
|
||||||
|
emit mousePressOffOverlay();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
bool Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
PerformanceTimer perfTimer("Overlays::mouseReleaseEvent");
|
PerformanceTimer perfTimer("Overlays::mouseReleaseEvent");
|
||||||
|
|
||||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||||
|
@ -797,9 +796,10 @@ void Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentClickingOnOverlayID = UNKNOWN_OVERLAY_ID;
|
_currentClickingOnOverlayID = UNKNOWN_OVERLAY_ID;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overlays::mouseMoveEvent(QMouseEvent* event) {
|
bool Overlays::mouseMoveEvent(QMouseEvent* event) {
|
||||||
PerformanceTimer perfTimer("Overlays::mouseMoveEvent");
|
PerformanceTimer perfTimer("Overlays::mouseMoveEvent");
|
||||||
|
|
||||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||||
|
@ -843,6 +843,7 @@ void Overlays::mouseMoveEvent(QMouseEvent* event) {
|
||||||
_currentHoverOverOverlayID = UNKNOWN_OVERLAY_ID;
|
_currentHoverOverOverlayID = UNKNOWN_OVERLAY_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QUuid> Overlays::findOverlays(const glm::vec3& center, float radius) const {
|
QVector<QUuid> Overlays::findOverlays(const glm::vec3& center, float radius) const {
|
||||||
|
|
|
@ -100,9 +100,9 @@ public:
|
||||||
OverlayID addOverlay(Overlay* overlay) { return addOverlay(Overlay::Pointer(overlay)); }
|
OverlayID addOverlay(Overlay* overlay) { return addOverlay(Overlay::Pointer(overlay)); }
|
||||||
OverlayID addOverlay(Overlay::Pointer overlay);
|
OverlayID addOverlay(Overlay::Pointer overlay);
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent* event);
|
bool mousePressEvent(QMouseEvent* event);
|
||||||
void mouseReleaseEvent(QMouseEvent* event);
|
bool mouseReleaseEvent(QMouseEvent* event);
|
||||||
void mouseMoveEvent(QMouseEvent* event);
|
bool mouseMoveEvent(QMouseEvent* event);
|
||||||
|
|
||||||
void cleanupAllOverlays();
|
void cleanupAllOverlays();
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,12 @@ Grabber.prototype.pressEvent = function(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
|
||||||
|
var overlayResult = Overlays.findRayIntersection(pickRay, true, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]);
|
||||||
|
if (overlayResult.intersects) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var pickResults = Entities.findRayIntersection(pickRay, true); // accurate picking
|
var pickResults = Entities.findRayIntersection(pickRay, true); // accurate picking
|
||||||
if (!pickResults.intersects) {
|
if (!pickResults.intersects) {
|
||||||
// didn't click on anything
|
// didn't click on anything
|
||||||
|
|
|
@ -564,6 +564,11 @@ function findClickedEntity(event) {
|
||||||
|
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
|
||||||
|
var overlayResult = Overlays.findRayIntersection(pickRay, true, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]);
|
||||||
|
if (overlayResult.intersects) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var entityResult = Entities.findRayIntersection(pickRay, true); // want precision picking
|
var entityResult = Entities.findRayIntersection(pickRay, true); // want precision picking
|
||||||
var lightResult = lightOverlayManager.findRayIntersection(pickRay);
|
var lightResult = lightOverlayManager.findRayIntersection(pickRay);
|
||||||
lightResult.accurate = true;
|
lightResult.accurate = true;
|
||||||
|
|
|
@ -3866,6 +3866,12 @@ SelectionDisplay = (function() {
|
||||||
var somethingClicked = false;
|
var somethingClicked = false;
|
||||||
var pickRay = generalComputePickRay(event.x, event.y);
|
var pickRay = generalComputePickRay(event.x, event.y);
|
||||||
|
|
||||||
|
var result = Overlays.findRayIntersection(pickRay, true, [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID]);
|
||||||
|
if (result.intersects) {
|
||||||
|
// mouse clicks on the tablet should override the edit affordances
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// before we do a ray test for grabbers, disable the ray intersection for our selection box
|
// before we do a ray test for grabbers, disable the ray intersection for our selection box
|
||||||
Overlays.editOverlay(selectionBox, {
|
Overlays.editOverlay(selectionBox, {
|
||||||
ignoreRayIntersection: true
|
ignoreRayIntersection: true
|
||||||
|
|
Loading…
Reference in a new issue