-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Allow resize on one both or no axis. #7047
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
base: main
Are you sure you want to change the base?
Conversation
Here's a video of the Resize control in combination with a table, using taffy for layout: Recording.2025-05-13.091334.mp4This video also highlights a usability issue, where it's hard to resize a table due to the scrollbars. It's hard to find the resize handle; you have to hover around until you see the pointer change. not all of the visible area of the resize handle actually works for resizing. |
A nice cool improvement would be also to change the cursor to be only horizontal/vertical/diagonal based on the available x/y/x&y |
Preview available at https://egui-pr-preview.github.io/pr/7047-resize-improvements-1 |
crates/egui/src/containers/resize.rs
Outdated
if self.resizable.x { | ||
state.desired_size.x = user_requested_size.x; | ||
} | ||
if self.resizable.y { | ||
state.desired_size.y = user_requested_size.y; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT this code path is only hit by Window
, which should already respect resizable
. Is this really changing any behavior in practice? Or is the PR just about demonstrating an existing behavior in the demo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's definately changing behavior in practice.
It didn't work for me, so I fixed it and made this PR as a result.
The demo exists to prove the fix works.
Updated original comment with demo of the existing behavor and with the fix.
Sorry for late response to your question (#7047 (comment)) Rebased on 0.32.0, fix is still required, video added to original comment. |
3299adf
to
56eb753
Compare
…g checkboxes to control X/Y axis resizing. * Note: the original API accepted a `Vec2b`, but didn't use the x/y properties independently. # Conflicts: # crates/egui_demo_lib/src/demo/misc_demo_window.rs
56eb753
to
09b8818
Compare
@emilk I just discovered this PR has unintended consequences, I'm not sure of the correct direction to go. when this PR is enabled, a resize inside a container works as per the demo, however Windows themselves are no-longer resizable, probably this is because the resize for the window is being created with a I feel this PR is the correct fix, but that other fixes are also required. Guidance appreciated. |
The smoking gun is this, in
Going to investigate a little more... I found this hack in if resize_interaction.any_dragged() {
if let Some(mut state) = resize::State::load(ctx, resize_id) {
state.requested_size = Some(new_rect.size() - margins);
state.store(ctx, resize_id);
}
} It really doesn't feel right that the So, basically, even though there is a resize that has
it turns out that is NOT the case, there are two things that update the user_requested_size, a) the window, by the hack above. b) the corner handle, by this chunk of code in
|
I added a commit, which avoid the can-of-worms |
…he egui resize issue. * See emilk/egui#7047 (comment) for details.
…ocess externally modified state (in `Window` before applying corner resizing). Only apply resize axis constrains to corner resizing.
97b71cb
to
f0c4130
Compare
Vec2b
, but didn't use the x/y properties independently, thus this is a non-breaking change and should probably be considered a bug-fix.Video:
Recording.2025-05-12.211409.mp4
Fix (before and after):
Recording.2025-07-14.133811.mp4