turn off ContextOverlay for pal, edit. Improve clicks too

This commit is contained in:
David Kelly 2017-07-20 11:30:55 -07:00
parent 0544c1e561
commit b7be727b4c
3 changed files with 13 additions and 4 deletions

View file

@ -29,6 +29,7 @@ ContextOverlayInterface::ContextOverlayInterface() {
_entityPropertyFlags += PROP_ROTATION;
_entityPropertyFlags += PROP_MARKETPLACE_ID;
_entityPropertyFlags += PROP_DIMENSIONS;
_entityPropertyFlags += PROP_REGISTRATION_POINT;
auto entityTreeRenderer = DependencyManager::get<EntityTreeRenderer>().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);
}

View file

@ -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]);
}

View file

@ -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);