Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make non interactable layers not interact #1240

Merged

Conversation

juancampa
Copy link
Contributor

@juancampa juancampa commented Feb 11, 2022

Areas in the Tooltip layer shouldn't block interactions to layers below them. Currently, layers under a tooltip won't get hovered if there's a tooltip covering it. Causing the flickering seen in #1239

Closes #1239 - Tooltips flicker when they can't fit on the screen

@juancampa
Copy link
Contributor Author

juancampa commented Feb 11, 2022

This currently breaks context menus as they become non-interactable. Do we need a separate layer for those?

Update: fixed

@juancampa
Copy link
Contributor Author

I'm not sure why the Area used for menus was marked as .interactable(false) but flipping that boolean fixed the problem. It makes sense the menus are interactable anyway, right?

@emilk
Copy link
Owner

emilk commented Feb 12, 2022

I'm not sure why the Area used for menus was marked as .interactable(false) but flipping that boolean fixed the problem. It makes sense the menus are interactable anyway, right?

I don't know why it was written like that, and it is likely unintentional. However, there is something else wrong, because your PR breaks the File menu in egui_demo_app

@juancampa
Copy link
Contributor Author

because your PR breaks the File menu in egui_demo_app

Hmm. Yeah, I see that, it's interesting that it works fine on the web version but not the native one. I'm investigating

@juancampa
Copy link
Contributor Author

@emilk so I finally figured out what's wrong with that menu. It's a stale app.ron file!

The Areas::areas IdMap is probably persisted on your local machine and the State for that particular menu has interactable set to false.

Deleting that file fixes the issue. Do we have any mechanism to either migrate old save states or delete them if they are incompatible?

@emilk
Copy link
Owner

emilk commented Feb 13, 2022

@juancampa nice debugging! I think the proper fix is to reset interactable in Area::begin in each frame:

        let mut state = state.unwrap_or_else(|| State {
            pos: default_pos.unwrap_or_else(|| automatic_area_position(ctx)),
            size: Vec2::ZERO,
            interactable,
        });
        state.pos = new_pos.unwrap_or(state.pos);
        state.interactable = interactable; // <--- ADDED

@juancampa
Copy link
Contributor Author

the proper fix is to reset interactable in Area::begin in each frame

I had the same thought last night. Fixed!

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, thanks!

@emilk emilk merged commit c4528be into emilk:master Feb 13, 2022
@juancampa juancampa deleted the make-non-interactable-layers-non-interactable branch February 13, 2022 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltips flicker when they can't fit on the screen
2 participants