From b7be727b4ce89e4556ca2716e66378ff78e8ca69 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Thu, 20 Jul 2017 11:30:55 -0700 Subject: [PATCH 1/2] turn off ContextOverlay for pal, edit. Improve clicks too --- interface/src/ui/overlays/ContextOverlayInterface.cpp | 9 +++++++-- scripts/system/edit.js | 5 +++-- scripts/system/pal.js | 3 +++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp index e66b8ee39e..35ed81bf03 100644 --- a/interface/src/ui/overlays/ContextOverlayInterface.cpp +++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp @@ -29,6 +29,7 @@ ContextOverlayInterface::ContextOverlayInterface() { _entityPropertyFlags += PROP_ROTATION; _entityPropertyFlags += PROP_MARKETPLACE_ID; _entityPropertyFlags += PROP_DIMENSIONS; + _entityPropertyFlags += PROP_REGISTRATION_POINT; auto entityTreeRenderer = DependencyManager::get().data(); connect(entityTreeRenderer, SIGNAL(mousePressOnEntity(const EntityItemID&, const PointerEvent&)), this, SLOT(createOrDestroyContextOverlay(const EntityItemID&, const PointerEvent&))); @@ -40,6 +41,7 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& if (_enabled && event.getButton() == PointerEvent::SecondaryButton) { EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags); + glm::vec3 position = entityProperties.getPosition(); if (entityProperties.getMarketplaceID().length() != 0) { qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID; _entityMarketplaceID = entityProperties.getMarketplaceID(); @@ -50,11 +52,13 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& _bbOverlay->setIsSolid(false); _bbOverlay->setColor(BB_OVERLAY_COLOR); _bbOverlay->setDrawInFront(true); + _bbOverlay->setIgnoreRayIntersection(true); + _bbOverlay->setParentID(entityItemID); _bbOverlayID = qApp->getOverlays().addOverlay(_bbOverlay); } _bbOverlay->setDimensions(entityProperties.getDimensions()); _bbOverlay->setRotation(entityProperties.getRotation()); - _bbOverlay->setPosition(entityProperties.getPosition()); + _bbOverlay->setPosition(position); _bbOverlay->setVisible(true); if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) { @@ -67,11 +71,12 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID& _contextOverlay->setDrawInFront(true); _contextOverlay->setURL("http://i.imgur.com/gksZygp.png"); _contextOverlay->setIsFacingAvatar(true); + _contextOverlay->setParentID(entityItemID); _contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay); } _contextOverlay->setDimensions(glm::vec2(0.05f, 0.05f) * glm::distance(entityProperties.getPosition(), qApp->getCamera().getPosition())); - _contextOverlay->setPosition(entityProperties.getPosition()); + _contextOverlay->setPosition(position); _contextOverlay->setRotation(entityProperties.getRotation()); _contextOverlay->setVisible(true); } diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 6bb0675bc8..57cb8b2407 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -14,7 +14,7 @@ Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */ (function() { // BEGIN LOCAL_SCOPE - + "use strict"; var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/"; @@ -388,7 +388,6 @@ var toolBar = (function () { function initialize() { Script.scriptEnding.connect(cleanup); - Window.domainChanged.connect(function () { that.setActive(false); that.clearEntityList(); @@ -614,6 +613,7 @@ var toolBar = (function () { }; that.setActive = function (active) { + ContextOverlay.enabled = !active; Settings.setValue(EDIT_SETTING, active); if (active) { Controller.captureEntityClickEvents(); @@ -2184,6 +2184,7 @@ var PopupMenu = function () { }; function cleanup() { + ContextOverlay.enabled = true; for (var i = 0; i < overlays.length; i++) { Overlays.deleteOverlay(overlays[i]); } diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 8ea22192fc..112e1a7fd8 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -732,7 +732,9 @@ function onTabletButtonClicked() { if (onPalScreen) { // for toolbar-mode: go back to home screen, this will close the window. tablet.gotoHomeScreen(); + ContextOverlay.enabled = true; } else { + ContextOverlay.enabled = false; tablet.loadQMLSource(PAL_QML_SOURCE); tablet.tabletShownChanged.connect(tabletVisibilityChanged); Users.requestsDomainListData = true; @@ -883,6 +885,7 @@ function shutdown() { if (onPalScreen) { tablet.gotoHomeScreen(); } + ContextOverlay.enable = true; button.clicked.disconnect(onTabletButtonClicked); tablet.removeButton(button); tablet.screenChanged.disconnect(onTabletScreenChanged); From f365ce8abd545e0aa9f52c3f1a2dc67e06802fab Mon Sep 17 00:00:00 2001 From: David Kelly Date: Thu, 20 Jul 2017 12:58:06 -0700 Subject: [PATCH 2/2] typo --- scripts/system/pal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 112e1a7fd8..7f0629abaa 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -885,7 +885,7 @@ function shutdown() { if (onPalScreen) { tablet.gotoHomeScreen(); } - ContextOverlay.enable = true; + ContextOverlay.enabled = true; button.clicked.disconnect(onTabletButtonClicked); tablet.removeButton(button); tablet.screenChanged.disconnect(onTabletScreenChanged);