diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f39be77c88..b254afb5e0 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1184,6 +1184,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo auto entityScriptingInterface = DependencyManager::get(); connect(entityScriptingInterface.data(), &EntityScriptingInterface::clickDownOnEntity, [this](const EntityItemID& entityItemID, const PointerEvent& event) { + setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); setKeyboardFocusEntity(entityItemID); }); @@ -1202,6 +1203,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo auto overlays = &(qApp->getOverlays()); connect(overlays, &Overlays::mousePressOnOverlay, [=](unsigned int overlayID, const PointerEvent& event) { + setKeyboardFocusEntity(UNKNOWN_ENTITY_ID); setKeyboardFocusOverlay(overlayID); }); diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 77dae56a7b..922d32e38b 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1568,6 +1568,7 @@ function MyController(hand) { name = entityPropertiesCache.getProps(entity).name; if (Entities.keyboardFocusEntity != entity) { + Overlays.keyboardFocusOverlay = 0; Entities.keyboardFocusEntity = entity; pointerEvent = { @@ -1647,6 +1648,7 @@ function MyController(hand) { overlay = rayPickInfo.overlayID; if (Overlays.keyboardFocusOverlay != overlay) { + Entities.keyboardFocusEntity = null; Overlays.keyboardFocusOverlay = overlay; pointerEvent = { @@ -2468,6 +2470,7 @@ function MyController(hand) { if (intersectInfo) { if (Entities.keyboardFocusEntity != this.grabbedEntity) { + Overlays.keyboardFocusOverlay = 0; Entities.keyboardFocusEntity = this.grabbedEntity; } @@ -2570,6 +2573,7 @@ function MyController(hand) { if (intersectInfo) { if (Overlays.keyboardFocusOverlay != this.grabbedOverlay) { + Entities.keyboardFocusEntity = null; Overlays.keyboardFocusOverlay = this.grabbedOverlay; }