This is particularly interesting if you want to authorize a single hover
tooltip on an item in the event of an interaction.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* Closes https://github.com/emilk/egui/issues/4243
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
It would return the causes for repainting again collected this frame,
instead of the cause for repainting the current frame.
* Part of https://github.com/emilk/egui/issues/3931
* Closes https://github.com/emilk/egui/issues/4238
The comment in the code explains it well, but the short of it is this:
we can't handle a shadow blur width larger than the shadow rectangle, so
we need to clamp the blur. This means smaller things will cast shadows
with a smaller blur width, but that's better than having visual
glitches.
Previously, putting the cursor in the gap between two menu buttons would
not hover any of the buttons, but the click-sensitive menu itself. Now
the menu is no longer click-sensitive.
This PR allows customizing the return key in the TextEdit widget. Right
now, it's hard-coded to the Enter key, which is problematic in cases
when you want to use the Enter key for something else, and insert the
newline in a different way instead.
An alternative to the "Phone Size" button useful for testing
`ViewportCommand::InnerSize`.
I created this to make it easy to debug
https://github.com/emilk/egui/issues/4196 there are more details there.
* Closes#3987
* Closes#3988
There is a need to prevent egui::Window from becoming larger than the
Viewport.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Expose `egui_plot::items::values::PlotGeometry` in public API so that
`PlotItem`, which is already public, can actually be implemented by
applications. Fixes#3464.
---------
Co-authored-by: Dominique Würtz <dom@blaukraut.info>
I'm trying to create some custom collapsing headers that add additional
buttons inside the header itself. Because of this, I load the
`CollapsingState` in my special widget manually. But because
`HeaderResponse` owns the `Ui` and the `CollapsingState`, there is no
way for me to open/close the collapsing header based on response of the
inner widget.
Initially, I considered just exposing `state` member of
`HeaderResponse`, but that exposes too much of the API at the wrong
time, in my opinion.
So instead I found it'd be safer to just expose the open/close API to
the response itself, and that's what this PR does.
Not sure about the api, currently I've mapped the whole XWindowType
enum, but maybe there's something more sensible to do?
* Closes <https://github.com/emilk/egui/issues/4150>
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
I added a handfull of lines to allow for the red highlight on weekends
in `DatePickerPopup` to be disabled.
I tried to follow the rules, but I've never done any kind of PR before,
and I'm also not sure if this is at all the kind of thing that is wanted
at the moment. If it is not, I'm happy to just have this removed. Just a
tiny little addition I would find useful.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Simply allows date picker buttons to show other formats than `%Y-%m-%d`,
while keeping that as default to not break compatibility.
I'm not that experienced with Rust, so I was unsure whether you'd prefer
`&'a str` rather than a `String`, let me know if I should change that.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
I believe that the underlying issue that caused the stuck modifier keys
was resolved in the 0.29 winit keyboard refactor.
This probably needs to tested on other desktop platforms however since I
am only able to test this on windows 11.
* Closes <https://github.com/emilk/egui/issues/2332>
* Closes https://github.com/emilk/egui/issues/3444
* Closes https://github.com/emilk/egui/issues/865
On a touch screen, if you press down on a widget and hold for 0.6
seconds (`MAX_CLICK_DURATION`), it will now trigger a secondary click,
i.e. `Response::secondary_clicked` will be `true`. This means you can
now open context menus on touch screens.
This is a refactor on the way to add support for opening context menus
on touch screens via press-and-hold.
This PR changes what `InputState::button_clicked` does (it was ver badly
named before), and also changes `Response::clicked_by` to no longer be
true if clicking with keyboard (i.e. a widget has keyboard focus and the
user presses Space or Enter).
This PR fixes two issues related to `ScrollArea`.
1) When a `ScrollArea` would have `drag_to_scroll` set to `false` (e.g.
because some custom logic is at play or some other reason), it would not
animate to the `target_offset`, effectively making
`Response::scroll_to_me()` ineffective.
2) Single-direction `ScrollArea`s would leak the `scroll_target`'s other
direction. In certain specific circumstances (e.g. an horizontal area
nested in a vertical one, or inversely), this _could_ work as intended,
but in many other cases it could cause unwanted effects. With this PR,
both `scroll_target` directions are consumed by nearest enclosing
`ScrollArea`, regardless of the actually enabled scroll axes.
Previously, any frames in flight (`requestAnimationFrame`) on web were
not being cancelled (`cancelAnimationFrame`) when `WebRunner::destroy`
was called. If a user called `destroy`, then immediately removed the
canvas from the DOM, eframe could panic with a "failed to find (canvas)
element by id" error message.
This PR changes two things:
- The canvas element is directly referenced everywhere it's needed
instead of being looked up by `canvas_id`[^1]
- The RAF handle is stored in `WebRunner` and `cancelAnimationFrame` is
called on it inside of `WebRunner::destroy`[^2]
[^1]: The WebGL/WGPU backends were already holding onto the canvas (and
associated GPU context), so the change is just converting all the
`get_element_by_id` lookups to retrieve the canvas from the web runner
handle.
[^2]: There is only ever one frame in flight, so we store it directly as
a scalar field.
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo cranky`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* Closes <https://github.com/emilk/egui/issues/4144>
* Closes#3846
* Closes#3878
Dear emilk.
Leaving aside other function,
I think this is all you need to fix to patch the panic that occurs when
Shift + TAB.
Thank you, emilk.
Hi!
I'm using egui for the UI of a VST3/Clap plugin, and this kind of
environment is rather picky on performance. I use
[assert_no_alloc](https://crates.io/crates/assert_no_alloc) to make sure
the audio thread is never allocating. The audio thread may request a
repaint of the GUI tho, and this is where a saw that it may allocate
when tracing the repaint reason.
Turns out it's not necessary, `Location::caller` is `'static`, so using
a `&'static str` instead of a `String` in `RepaintCause::file` will just
work, so this PR just does that.
Update modifier state from web mouse events. This allows modifiers to be
correctly updated when the window is not in focus but the mouse is still
moving over the window.