Fix keyboard focus when switch highlight between overlays and entities

This commit is contained in:
David Rowe 2016-12-09 18:31:52 +13:00 committed by Seth Alves
parent d13e990ebe
commit 7a36e4eed8
2 changed files with 6 additions and 0 deletions

View file

@ -1184,6 +1184,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>();
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);
});

View file

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