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

Windows cannot be resized when in front of a plot #3923

Closed
s-nie opened this issue Jan 30, 2024 · 4 comments · Fixed by #4026
Closed

Windows cannot be resized when in front of a plot #3923

s-nie opened this issue Jan 30, 2024 · 4 comments · Fixed by #4026
Labels
bug Something is broken

Comments

@s-nie
Copy link
Contributor

s-nie commented Jan 30, 2024

Happens on the current master branch: 527f4bf

Windows cannot be resized by dragging the bottom right corner when they are in front of a plot. The corner just jumps away.

@emilk Do you have a suspicion where the issue might come from? I'd be happy to try and fix it.

In the web demo it looks like this:

window_resize.mp4
@s-nie s-nie added the bug Something is broken label Jan 30, 2024
@YgorSouza
Copy link
Contributor

I've made the following observations, if it helps:

  • It has nothing to do with the plot specifically. It happens with anything that senses the drag event, like selectable text or a slider. It does not happen with non-draggable things like buttons.
  • Not every window is affected. For example, in the demo app, the settings window and the table demo window don't have the problem. But all the windows do that little jump when you click on the resize handle.
  • It only happens if the handle is above a draggable widget when you first click on it. Dragging the handle on top of something after you've clicked on it does not cause problems.

I'll try to bisect and find out when it started.

@YgorSouza
Copy link
Contributor

YgorSouza commented Jan 30, 2024

Looks like this goes way back. I couldn't find out the exact commit that caused it, because a few ones in the middle are making the demo app crash for some reason so I can't test them. But it has been this way at least since 0.21.0, and I think it started somewhere after 0.19.0.

@emilk
Copy link
Owner

emilk commented Feb 2, 2024

The interaction code could use some cleanup. I think the problem can be solved with:

@s-nie
Copy link
Contributor Author

s-nie commented Feb 5, 2024

Thanks for opening an issue! I was hoping that this would be something that the plot itself does not handle properly. Unfortunately I don't have the capacity to delve deep into the interaction code at the moment.

@emilk emilk mentioned this issue Feb 11, 2024
14 tasks
@emilk emilk closed this as completed in ca8c879 Feb 17, 2024
emilk added a commit to emilk/egui_plot that referenced this issue Jul 15, 2024
* Closes emilk/egui#3936
* Closes emilk/egui#3923
* Closes emilk/egui#4058

The interaction code is now done at the start of the frame, using stored
`WidgetRect`s from the previous frame.

The intention is that the new interaction code should be more accurate,
making it easier to hit widgets, and better respecting the rules of
overlapping widgets.

There is a new `style::Interaction::interact_radius` controlling how far
away from a widget the cursor can be and still hit it. This helps big
fat fingers hit small widgets on touch screens.

This PR adds a new `Context::read_response` which lets you read the
`Response` of a `Widget` _before_ you create the widget. This can be
used for styling, or for reading the result of an interaction early (to
prevent frame-delay) for a widget you add late (so it is on top of other
widgets).

# ⚠️ BREAKING CHANGES
`Memory::dragged_id`, `Memory::set_dragged_id` etc have been moved to
`Context`.
The semantics for `Context::dragged_id` is slightly different: a widget
is not considered dragged until egui it is sure this is not a
click-in-progress. For a widget that is only sensitive to drags, that is
right away, but for widgets sensitive to both clicks and drags it is not
until the mouse has moved a certain distance.

# TODO
* [x] Fix panel resizing
* [x] Fix scroll hover weirdness
* [x] Fix Resize widget
* [x] Fix drag-and-drop
* [x] Test all of egui_demo_app
* [x] Change `is_dragging` API
* [x] Consistent naming of start/stop or begin/end drag
* [x] Test `egui_tiles`
* [x] Test Rerun
* [x] Document
* [x] Document breaking changes in PR description
* [x] Test one final time

# Saving for a later PR
* [ ] Fix emilk/egui#4047
* [ ] Specify what the response order for e.g. `ui.horizontal` is

I think both these can be fixed if each `Ui` registers themselves as a
`WidgetRect`, with the possibility to interact with it later, as if the
interaction was under all widgets on top of it.
Hasenfellvy added a commit to Hasenfellvy/egui_plot that referenced this issue Aug 27, 2024
* Closes emilk/egui#3936
* Closes emilk/egui#3923
* Closes emilk/egui#4058

The interaction code is now done at the start of the frame, using stored
`WidgetRect`s from the previous frame.

The intention is that the new interaction code should be more accurate,
making it easier to hit widgets, and better respecting the rules of
overlapping widgets.

There is a new `style::Interaction::interact_radius` controlling how far
away from a widget the cursor can be and still hit it. This helps big
fat fingers hit small widgets on touch screens.

This PR adds a new `Context::read_response` which lets you read the
`Response` of a `Widget` _before_ you create the widget. This can be
used for styling, or for reading the result of an interaction early (to
prevent frame-delay) for a widget you add late (so it is on top of other
widgets).

# ⚠️ BREAKING CHANGES
`Memory::dragged_id`, `Memory::set_dragged_id` etc have been moved to
`Context`.
The semantics for `Context::dragged_id` is slightly different: a widget
is not considered dragged until egui it is sure this is not a
click-in-progress. For a widget that is only sensitive to drags, that is
right away, but for widgets sensitive to both clicks and drags it is not
until the mouse has moved a certain distance.

# TODO
* [x] Fix panel resizing
* [x] Fix scroll hover weirdness
* [x] Fix Resize widget
* [x] Fix drag-and-drop
* [x] Test all of egui_demo_app
* [x] Change `is_dragging` API
* [x] Consistent naming of start/stop or begin/end drag
* [x] Test `egui_tiles`
* [x] Test Rerun
* [x] Document
* [x] Document breaking changes in PR description
* [x] Test one final time

# Saving for a later PR
* [ ] Fix emilk/egui#4047
* [ ] Specify what the response order for e.g. `ui.horizontal` is

I think both these can be fixed if each `Ui` registers themselves as a
`WidgetRect`, with the possibility to interact with it later, as if the
interaction was under all widgets on top of it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants