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
parent bad8d20dd9
commit e956608fa4
2 changed files with 6 additions and 0 deletions

View file

@ -1147,6 +1147,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);
});
@ -1165,6 +1166,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

@ -1558,6 +1558,7 @@ function MyController(hand) {
name = entityPropertiesCache.getProps(entity).name;
if (Entities.keyboardFocusEntity != entity) {
Overlays.keyboardFocusOverlay = 0;
Entities.keyboardFocusEntity = entity;
pointerEvent = {
@ -1637,6 +1638,7 @@ function MyController(hand) {
overlay = rayPickInfo.overlayID;
if (Overlays.keyboardFocusOverlay != overlay) {
Entities.keyboardFocusEntity = null;
Overlays.keyboardFocusOverlay = overlay;
pointerEvent = {
@ -2412,6 +2414,7 @@ function MyController(hand) {
if (intersectInfo) {
if (Entities.keyboardFocusEntity != this.grabbedEntity) {
Overlays.keyboardFocusOverlay = 0;
Entities.keyboardFocusEntity = this.grabbedEntity;
}
@ -2514,6 +2517,7 @@ function MyController(hand) {
if (intersectInfo) {
if (Overlays.keyboardFocusOverlay != this.grabbedOverlay) {
Entities.keyboardFocusEntity = null;
Overlays.keyboardFocusOverlay = this.grabbedOverlay;
}