-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Ui::interact
's Response
hover detection is incorrect
#4239
Comments
I think this is due to the interact logic changing in #4026. You are using the same egui/crates/egui/src/context.rs Lines 939 to 945 in 4d4cb3d
(Maybe this If you offset the close button slightly (e.g., by 1 point), egui is able to see the clash. M src/widgets/dock_area/show/leaf.rs
@@ -588,7 +588,7 @@ impl<'tree, Tab> DockArea<'tree, Tab> {
let close_response = show_close_button.then(|| {
let mut close_button_rect = rect;
- close_button_rect.set_left(text_rect.right());
+ close_button_rect.set_left(text_rect.right() + 1.0);
close_button_rect =
Rect::from_center_size(close_button_rect.center(), Vec2::splat(close_button_size)); So I think you have to use |
@YgorSouza Thanks for the reply. Yeah, I have tried using a different |
I have found a fix. I made the close button I think the new interact logic simply exposed a bug in my code. Thank you again for helping me with that! |
The new interact logic make a difference, that the interaction depends on the interact function order. If there is an overlap, the top most one's "interact" should put at the end. |
@happydpc Yeah, this code became quite complicated so I didn't notice the ordering error. |
Describe the bug
Since I upgraded my crate egui_dock to egui 0.27, the
Response
s of all tab close buttons I allocated withUi::interact
"thinks they're being hovered and clicked always when I do these things to their corresponding tabs, even outside those close buttons.In the screenshot below, my pointer (invisible here, apologies for that) is on the Style Editor tab title, and you can see that the close button is highlighted:
I double-checked to confirm that this did not happen with egui 0.26 and only appeared after I changed it to 0.27.
To Reproduce
Steps to reproduce the behavior:
cargo run --example hello
.Expected behavior
In this particular scenario: tab close buttons should only say they're hovered/clicked when the
Rect
I allocated one with does indeed contain the mouse pointer.Additional context
According to the debugger, the close button's
Response
does indeed think it's both being hovered and containing pointer.The text was updated successfully, but these errors were encountered: