Skip to content

Make non interactable layers not interact - #1240

Merged
emilk merged 4 commits into
emilk:masterfrom
membrane-io:make-non-interactable-layers-non-interactable
Feb 13, 2022
Merged

emilk merged 4 commits into
emilk:masterfrom
membrane-io:make-non-interactable-layers-non-interactable

Conversation

@juancampa

@juancampa juancampa commented Feb 11, 2022

Copy link
Copy Markdown
Contributor

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

juancampa commented Feb 11, 2022

Copy link
Copy Markdown
Contributor Author

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

Update: fixed

@juancampa

Copy link
Copy Markdown
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

emilk commented Feb 12, 2022

Copy link
Copy Markdown
Owner

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
Copy Markdown
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
Copy Markdown
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

emilk commented Feb 13, 2022

Copy link
Copy Markdown
Owner

@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
Copy Markdown
Contributor Author

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

I had the same thought last night. Fixed!

@emilk emilk left a comment

Copy link
Copy Markdown
Owner

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