mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:00:41 +02:00
turn off ContextOverlay for pal, edit. Improve clicks too
This commit is contained in:
parent
0544c1e561
commit
b7be727b4c
3 changed files with 13 additions and 4 deletions
|
@ -29,6 +29,7 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
||||||
_entityPropertyFlags += PROP_ROTATION;
|
_entityPropertyFlags += PROP_ROTATION;
|
||||||
_entityPropertyFlags += PROP_MARKETPLACE_ID;
|
_entityPropertyFlags += PROP_MARKETPLACE_ID;
|
||||||
_entityPropertyFlags += PROP_DIMENSIONS;
|
_entityPropertyFlags += PROP_DIMENSIONS;
|
||||||
|
_entityPropertyFlags += PROP_REGISTRATION_POINT;
|
||||||
|
|
||||||
auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>().data();
|
auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>().data();
|
||||||
connect(entityTreeRenderer, SIGNAL(mousePressOnEntity(const EntityItemID&, const PointerEvent&)), this, SLOT(createOrDestroyContextOverlay(const EntityItemID&, const PointerEvent&)));
|
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) {
|
if (_enabled && event.getButton() == PointerEvent::SecondaryButton) {
|
||||||
|
|
||||||
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
EntityItemProperties entityProperties = _entityScriptingInterface->getEntityProperties(entityItemID, _entityPropertyFlags);
|
||||||
|
glm::vec3 position = entityProperties.getPosition();
|
||||||
if (entityProperties.getMarketplaceID().length() != 0) {
|
if (entityProperties.getMarketplaceID().length() != 0) {
|
||||||
qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID;
|
qCDebug(context_overlay) << "Creating Context Overlay on top of entity with ID: " << entityItemID;
|
||||||
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
_entityMarketplaceID = entityProperties.getMarketplaceID();
|
||||||
|
@ -50,11 +52,13 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
_bbOverlay->setIsSolid(false);
|
_bbOverlay->setIsSolid(false);
|
||||||
_bbOverlay->setColor(BB_OVERLAY_COLOR);
|
_bbOverlay->setColor(BB_OVERLAY_COLOR);
|
||||||
_bbOverlay->setDrawInFront(true);
|
_bbOverlay->setDrawInFront(true);
|
||||||
|
_bbOverlay->setIgnoreRayIntersection(true);
|
||||||
|
_bbOverlay->setParentID(entityItemID);
|
||||||
_bbOverlayID = qApp->getOverlays().addOverlay(_bbOverlay);
|
_bbOverlayID = qApp->getOverlays().addOverlay(_bbOverlay);
|
||||||
}
|
}
|
||||||
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
_bbOverlay->setDimensions(entityProperties.getDimensions());
|
||||||
_bbOverlay->setRotation(entityProperties.getRotation());
|
_bbOverlay->setRotation(entityProperties.getRotation());
|
||||||
_bbOverlay->setPosition(entityProperties.getPosition());
|
_bbOverlay->setPosition(position);
|
||||||
_bbOverlay->setVisible(true);
|
_bbOverlay->setVisible(true);
|
||||||
|
|
||||||
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
|
||||||
|
@ -67,11 +71,12 @@ void ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
|
||||||
_contextOverlay->setDrawInFront(true);
|
_contextOverlay->setDrawInFront(true);
|
||||||
_contextOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
_contextOverlay->setURL("http://i.imgur.com/gksZygp.png");
|
||||||
_contextOverlay->setIsFacingAvatar(true);
|
_contextOverlay->setIsFacingAvatar(true);
|
||||||
|
_contextOverlay->setParentID(entityItemID);
|
||||||
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
|
_contextOverlayID = qApp->getOverlays().addOverlay(_contextOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
_contextOverlay->setDimensions(glm::vec2(0.05f, 0.05f) * glm::distance(entityProperties.getPosition(), qApp->getCamera().getPosition()));
|
_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->setRotation(entityProperties.getRotation());
|
||||||
_contextOverlay->setVisible(true);
|
_contextOverlay->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */
|
Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */
|
||||||
|
|
||||||
(function() { // BEGIN LOCAL_SCOPE
|
(function() { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
@ -388,7 +388,6 @@ var toolBar = (function () {
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
|
||||||
Window.domainChanged.connect(function () {
|
Window.domainChanged.connect(function () {
|
||||||
that.setActive(false);
|
that.setActive(false);
|
||||||
that.clearEntityList();
|
that.clearEntityList();
|
||||||
|
@ -614,6 +613,7 @@ var toolBar = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setActive = function (active) {
|
that.setActive = function (active) {
|
||||||
|
ContextOverlay.enabled = !active;
|
||||||
Settings.setValue(EDIT_SETTING, active);
|
Settings.setValue(EDIT_SETTING, active);
|
||||||
if (active) {
|
if (active) {
|
||||||
Controller.captureEntityClickEvents();
|
Controller.captureEntityClickEvents();
|
||||||
|
@ -2184,6 +2184,7 @@ var PopupMenu = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
|
ContextOverlay.enabled = true;
|
||||||
for (var i = 0; i < overlays.length; i++) {
|
for (var i = 0; i < overlays.length; i++) {
|
||||||
Overlays.deleteOverlay(overlays[i]);
|
Overlays.deleteOverlay(overlays[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,7 +732,9 @@ function onTabletButtonClicked() {
|
||||||
if (onPalScreen) {
|
if (onPalScreen) {
|
||||||
// for toolbar-mode: go back to home screen, this will close the window.
|
// for toolbar-mode: go back to home screen, this will close the window.
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
|
ContextOverlay.enabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
ContextOverlay.enabled = false;
|
||||||
tablet.loadQMLSource(PAL_QML_SOURCE);
|
tablet.loadQMLSource(PAL_QML_SOURCE);
|
||||||
tablet.tabletShownChanged.connect(tabletVisibilityChanged);
|
tablet.tabletShownChanged.connect(tabletVisibilityChanged);
|
||||||
Users.requestsDomainListData = true;
|
Users.requestsDomainListData = true;
|
||||||
|
@ -883,6 +885,7 @@ function shutdown() {
|
||||||
if (onPalScreen) {
|
if (onPalScreen) {
|
||||||
tablet.gotoHomeScreen();
|
tablet.gotoHomeScreen();
|
||||||
}
|
}
|
||||||
|
ContextOverlay.enable = true;
|
||||||
button.clicked.disconnect(onTabletButtonClicked);
|
button.clicked.disconnect(onTabletButtonClicked);
|
||||||
tablet.removeButton(button);
|
tablet.removeButton(button);
|
||||||
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
tablet.screenChanged.disconnect(onTabletScreenChanged);
|
||||||
|
|
Loading…
Reference in a new issue