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

Two buttons placed next to each other can both be clicked at the same time #2010

Closed
2 tasks done
veniamin-ilmer opened this issue Aug 7, 2023 · 3 comments · Fixed by #2017
Closed
2 tasks done

Two buttons placed next to each other can both be clicked at the same time #2010

veniamin-ilmer opened this issue Aug 7, 2023 · 3 comments · Fixed by #2017
Labels
bug Something isn't working

Comments

@veniamin-ilmer
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

If you place two buttons next to each other, you can place the cursor in between the two, and both will be highlighted. If you click, both buttons will receive the on_press command. This happens in both GPU and CPU rendering.

This is problematic for my minesweeper game, composed of many buttons touching each other.

My current workaround is to place a space between each button.

What is the expected behavior?

It should not be possible for the cursor to be touching both buttons at the same time. It should be either one or the other.

Version

crates.io release

Operating System

Windows

Do you have any log output?

No response

@veniamin-ilmer veniamin-ilmer added the bug Something isn't working label Aug 7, 2023
@veniamin-ilmer veniamin-ilmer changed the title Two buttons placed next to each other can accidently both be clicked Two buttons placed next to each other can accidently both be clicked at the same time Aug 7, 2023
@veniamin-ilmer veniamin-ilmer changed the title Two buttons placed next to each other can accidently both be clicked at the same time Two buttons placed next to each other can both be clicked at the same time Aug 7, 2023
@genusistimelord
Copy link

sounds like the bounds of the buttons are overlapping somehow? could you display a photo of this occurring or a video? any example code that can recreate the problem in a small test that we could run?

@veniamin-ilmer
Copy link
Author

Take a look:

Screen recording

You can feel free to test it out with an old version of my code here:

https://github.com/veniamin-ilmer/minesweeper/tree/801a78513b7b3b1871c0c2e80f250b86230bbbc5

The buttons are just lined up next to each other with columns and rows.

@genusistimelord
Copy link

ok I have pushed a PR that fixes this issue. Please give it a try. it is located here #2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants