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

Impl ContextMenu #139

Merged
merged 13 commits into from
Jun 13, 2023
Merged

Impl ContextMenu #139

merged 13 commits into from
Jun 13, 2023

Conversation

wiiznokes
Copy link
Contributor

This pull request implement #133.

I think this widget could be improved in the future by adapting menu to be used as overlay (only one tree of course not the entire bar).

The overlay appears at the place where the right click was made but apart from that, the implementation is quit naive and does not take into account the available space. But the menu have already this behaviour.

@genusistimelord
Copy link
Collaborator

genusistimelord commented Jun 13, 2023

Ok so in order for this to work Correctly as a right click anywhere menu you will need to remove the underlay portion from context menu. I think you can do this by making it take a Screen height and width and in the layout using that as its height and width. Then I believe Event will trigger allowing you to do right click anywhere within the size. Probably should make the underlay Optional actually as this might be better for those who just want to create a screen right click area.

Looks like we may also need to Create a 2nd widget that could be called Screen. Where the first set of widgets inside of it are not layout bound somehow and the 2nd set are layout bound. Allowing us to click anywhere even over other widgets. But this will be difficult to do i believe.

@wiiznokes
Copy link
Contributor Author

Ok so in order for this to work Correctly as a right click anywhere menu

you mean if we combine menu and context menu ?

you will need to remove the underlay portion from context menu

why ?

Probably should make the underlay Optional actually as this might be better for those who just want to create a screen right click area

but the event is not propagated through the app. We could make a method on_right_click but this will be confusing I think.

And sorry but I don't understand why we need to click over other widgets ?

@genusistimelord
Copy link
Collaborator

well no I mean atm you are tied to the underlays position for a rigth click window. which is OK if you only want to give options of right click to certain things within a underlay. It would be nice if this could just be added and not count towards the Layout and just take right click events but this would require a special kind of change in iced. but the current method can work. we can merge this once cargo fmt is ran on the source.

@wiiznokes
Copy link
Contributor Author

I'm not sure I have enough knowledge of Iced to understand this approach. Maybe a start of api will help me.
But I think it's already good for a start.

I finished formatting everything.
We agree that there is no auto-fix command for cargo fmt right?

@genusistimelord
Copy link
Collaborator

if you type only "cargo fmt" and nothing else it should format the entire project including anything that was missed.

@genusistimelord genusistimelord merged commit f9ccada into iced-rs:main Jun 13, 2023
@wiiznokes wiiznokes deleted the dev-context-menu branch June 13, 2023 20:41
@wiiznokes
Copy link
Contributor Author

if you type only "cargo fmt" and nothing else it should format the entire project including anything that was missed.

I guess I just lost 30 minutes 😄

@genusistimelord
Copy link
Collaborator

it is a good learning Experience. You could always join the discord and ask for help on these things too.

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.

2 participants