mirror of
https://github.com/overte-org/overte.git
synced 2025-04-12 19:58:15 +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() ||
|
||||
getOverlays().getOverlayAtPoint(glm::vec2(transformedPos.x(), transformedPos.y())) != UNKNOWN_OVERLAY_ID) {
|
||||
getOverlays().mouseMoveEvent(&mappedEvent);
|
||||
getEntities()->mouseMoveEvent(&mappedEvent);
|
||||
if (_mouseToOverlays) {
|
||||
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 (_controllerScriptingInterface->isMouseCaptured()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_keyboardMouseDevice->isActive()) {
|
||||
if (!_mouseToOverlays && _keyboardMouseDevice->isActive()) {
|
||||
_keyboardMouseDevice->mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
@ -3115,6 +3121,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
|||
void Application::mousePressEvent(QMouseEvent* event) {
|
||||
// Inhibit the menu if the user is using alt-mouse dragging
|
||||
_altPressed = false;
|
||||
_mouseToOverlays = false;
|
||||
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
// 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());
|
||||
|
||||
if (!_aboutToQuit) {
|
||||
getOverlays().mousePressEvent(&mappedEvent);
|
||||
|
||||
if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
|
||||
if (getOverlays().mousePressEvent(&mappedEvent)) {
|
||||
_mouseToOverlays = true;
|
||||
} else if (!_controllerScriptingInterface->areEntityClicksCaptured()) {
|
||||
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 (_controllerScriptingInterface->isMouseCaptured()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasFocus()) {
|
||||
if (!_mouseToOverlays && hasFocus()) {
|
||||
if (_keyboardMouseDevice->isActive()) {
|
||||
_keyboardMouseDevice->mousePressEvent(event);
|
||||
}
|
||||
|
@ -3179,18 +3188,23 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
|
|||
event->buttons(), event->modifiers());
|
||||
|
||||
if (!_aboutToQuit) {
|
||||
getOverlays().mouseReleaseEvent(&mappedEvent);
|
||||
getEntities()->mouseReleaseEvent(&mappedEvent);
|
||||
if (_mouseToOverlays) {
|
||||
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 (_controllerScriptingInterface->isMouseCaptured()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasFocus()) {
|
||||
if (!_mouseToOverlays && hasFocus()) {
|
||||
if (_keyboardMouseDevice->isActive()) {
|
||||
_keyboardMouseDevice->mouseReleaseEvent(event);
|
||||
}
|
||||
|
|
|
@ -676,6 +676,8 @@ private:
|
|||
void addAssetToWorldInfoDone(QString modelName);
|
||||
void addAssetToWorldError(QString modelName, QString errorText);
|
||||
|
||||
bool _mouseToOverlays { false };
|
||||
|
||||
QQuickItem* _addAssetToWorldMessageBox{ nullptr };
|
||||
QStringList _addAssetToWorldInfoKeys; // Model name
|
||||
QStringList _addAssetToWorldInfoMessages; // Info message
|
||||
|
|
|
@ -760,7 +760,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionForMouseEvent(PickRa
|
|||
return findRayIntersection(ray);
|
||||
}
|
||||
|
||||
void Overlays::mousePressEvent(QMouseEvent* event) {
|
||||
bool Overlays::mousePressEvent(QMouseEvent* event) {
|
||||
PerformanceTimer perfTimer("Overlays::mousePressEvent");
|
||||
|
||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||
|
@ -773,15 +773,14 @@ void Overlays::mousePressEvent(QMouseEvent* event) {
|
|||
if (thisOverlay) {
|
||||
auto pointerEvent = calculatePointerEvent(thisOverlay, ray, rayPickResult, event, PointerEvent::Press);
|
||||
emit mousePressOnOverlay(_currentClickingOnOverlayID, pointerEvent);
|
||||
} else {
|
||||
emit mousePressOffOverlay();
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
emit mousePressOffOverlay();
|
||||
}
|
||||
emit mousePressOffOverlay();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
||||
bool Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
||||
PerformanceTimer perfTimer("Overlays::mouseReleaseEvent");
|
||||
|
||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||
|
@ -797,9 +796,10 @@ void Overlays::mouseReleaseEvent(QMouseEvent* event) {
|
|||
}
|
||||
|
||||
_currentClickingOnOverlayID = UNKNOWN_OVERLAY_ID;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Overlays::mouseMoveEvent(QMouseEvent* event) {
|
||||
bool Overlays::mouseMoveEvent(QMouseEvent* event) {
|
||||
PerformanceTimer perfTimer("Overlays::mouseMoveEvent");
|
||||
|
||||
PickRay ray = qApp->computePickRay(event->x(), event->y());
|
||||
|
@ -843,6 +843,7 @@ void Overlays::mouseMoveEvent(QMouseEvent* event) {
|
|||
_currentHoverOverOverlayID = UNKNOWN_OVERLAY_ID;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
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::Pointer overlay);
|
||||
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
bool mousePressEvent(QMouseEvent* event);
|
||||
bool mouseReleaseEvent(QMouseEvent* event);
|
||||
bool mouseMoveEvent(QMouseEvent* event);
|
||||
|
||||
void cleanupAllOverlays();
|
||||
|
||||
|
|
|
@ -331,6 +331,12 @@ Grabber.prototype.pressEvent = function(event) {
|
|||
}
|
||||
|
||||
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
|
||||
if (!pickResults.intersects) {
|
||||
// didn't click on anything
|
||||
|
|
|
@ -564,6 +564,11 @@ function findClickedEntity(event) {
|
|||
|
||||
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 lightResult = lightOverlayManager.findRayIntersection(pickRay);
|
||||
lightResult.accurate = true;
|
||||
|
|
|
@ -3866,6 +3866,12 @@ SelectionDisplay = (function() {
|
|||
var somethingClicked = false;
|
||||
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
|
||||
Overlays.editOverlay(selectionBox, {
|
||||
ignoreRayIntersection: true
|
||||
|
|
Loading…
Reference in a new issue