Merge branch 'context-overlays' of https://github.com/highfidelity/hifi into context-overlays

This commit is contained in:
David Kelly 2017-07-21 07:20:19 -07:00
commit 875d0eb815
3 changed files with 37 additions and 4 deletions

View file

@ -1348,9 +1348,19 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
});
connect(overlays,
SIGNAL(mousePressOnOverlay(const OverlayID&, const PointerEvent&)),
DependencyManager::get<ContextOverlayInterface>().data(),
SLOT(clickContextOverlay(const OverlayID&, const PointerEvent&)));
SIGNAL(mousePressOnOverlay(const OverlayID&, const PointerEvent&)),
DependencyManager::get<ContextOverlayInterface>().data(),
SLOT(clickContextOverlay(const OverlayID&, const PointerEvent&)));
connect(overlays,
SIGNAL(hoverEnterOverlay(const OverlayID&, const PointerEvent&)),
DependencyManager::get<ContextOverlayInterface>().data(),
SLOT(hoverEnterContextOverlay(const OverlayID&, const PointerEvent&)));
connect(overlays,
SIGNAL(hoverLeaveOverlay(const OverlayID&, const PointerEvent&)),
DependencyManager::get<ContextOverlayInterface>().data(),
SLOT(hoverLeaveContextOverlay(const OverlayID&, const PointerEvent&)));
// Add periodic checks to send user activity data
static int CHECK_NEARBY_AVATARS_INTERVAL_MS = 10000;

View file

@ -69,7 +69,7 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
if (_contextOverlayID == UNKNOWN_OVERLAY_ID || !qApp->getOverlays().isAddedOverlay(_contextOverlayID)) {
_contextOverlay = std::make_shared<Image3DOverlay>();
_contextOverlay->setAlpha(0.85f);
_contextOverlay->setPulseMin(0.75f);
_contextOverlay->setPulseMin(0.6f);
_contextOverlay->setPulseMax(1.0f);
_contextOverlay->setColorPulse(1.0f);
_contextOverlay->setIgnoreRayIntersection(false);
@ -130,6 +130,27 @@ void ContextOverlayInterface::clickContextOverlay(const OverlayID& overlayID, co
destroyContextOverlay(_currentEntityWithContextOverlay, PointerEvent());
}
}
void ContextOverlayInterface::hoverEnterContextOverlay(const OverlayID& overlayID, const PointerEvent& event) {
if (_contextOverlayID != UNKNOWN_OVERLAY_ID && _contextOverlay) {
qCDebug(context_overlay) << "Started hovering over Context Overlay. Overlay ID:" << overlayID;
_contextOverlay->setColor({ 0xFF, 0xFF, 0xFF });
_contextOverlay->setColorPulse(0.0f);
_contextOverlay->setPulsePeriod(0.0f);
_contextOverlay->setAlpha(1.0f);
}
}
void ContextOverlayInterface::hoverLeaveContextOverlay(const OverlayID& overlayID, const PointerEvent& event) {
if (_contextOverlayID != UNKNOWN_OVERLAY_ID && _contextOverlay) {
qCDebug(context_overlay) << "Stopped hovering over Context Overlay. Overlay ID:" << overlayID;
_contextOverlay->setColor({ 0xFF, 0xFF, 0xFF });
_contextOverlay->setColorPulse(1.0f);
_contextOverlay->setPulsePeriod(1.0f);
_contextOverlay->setAlpha(0.85f);
}
}
static const QString MARKETPLACE_BASE_URL = "http://metaverse.highfidelity.com/marketplace/items/";
void ContextOverlayInterface::openMarketplace() {

View file

@ -58,6 +58,8 @@ public slots:
bool destroyContextOverlay(const EntityItemID& entityItemID, const PointerEvent& event);
bool destroyContextOverlay(const EntityItemID& entityItemID);
void clickContextOverlay(const OverlayID& overlayID, const PointerEvent& event);
void hoverEnterContextOverlay(const OverlayID& overlayID, const PointerEvent& event);
void hoverLeaveContextOverlay(const OverlayID& overlayID, const PointerEvent& event);
private:
bool _verboseLogging { true };