fewer undesirable couplings

This commit is contained in:
SamGondelman 2017-10-16 13:46:23 -07:00
parent d274d99411
commit c6b636901a
3 changed files with 6 additions and 3 deletions

View file

@ -894,7 +894,7 @@ void Overlays::mousePressEvent(const OverlayID& overlayID, const PointerEvent& e
auto thisOverlay = std::dynamic_pointer_cast<Web3DOverlay>(getOverlay(overlayID));
if (thisOverlay) {
// Focus keyboard on web overlays
qApp->setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
DependencyManager::get<EntityScriptingInterface>()->setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
setKeyboardFocusOverlay(overlayID);
// Send to web overlay

View file

@ -567,8 +567,6 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event) {
_lastPointerEventValid = true;
} else {
// If the user clicks somewhere where there is NO entity at all, we will release focus
QMetaObject::invokeMethod(qApp, "setKeyboardFocusEntity", Qt::DirectConnection, Q_ARG(EntityItemID, UNKNOWN_ENTITY_ID));
emit entityScriptingInterface->mousePressOffEntity();
}
}

View file

@ -50,6 +50,11 @@ EntityScriptingInterface::EntityScriptingInterface(bool bidOnSimulationOwnership
connect(nodeList.data(), &NodeList::canRezCertifiedChanged, this, &EntityScriptingInterface::canRezCertifiedChanged);
connect(nodeList.data(), &NodeList::canRezTmpCertifiedChanged, this, &EntityScriptingInterface::canRezTmpCertifiedChanged);
connect(nodeList.data(), &NodeList::canWriteAssetsChanged, this, &EntityScriptingInterface::canWriteAssetsChanged);
// If the user clicks somewhere where there is no entity at all, we will release focus
connect(this, &EntityScriptingInterface::mousePressOffEntity, [=]() {
setKeyboardFocusEntity(UNKNOWN_ENTITY_ID);
});
}
void EntityScriptingInterface::queueEntityMessage(PacketType packetType,