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.
When scaling an `egui::Shape` of variant `Rect` using the new
`transform` function, corner rounding isn't taken into account.
The fix is to multiply the rounding by the scaling factor.
* Closes <https://github.com/emilk/egui/issues/4152>
# What's New
* eframe: Added `App::raw_input_hook` allows for the manipulation or
filtering of raw input events
A filter applied to raw input before [`Self::update`]
This allows for the manipulation or filtering of input events before
they are processed by egui.
This can be used to exclude specific keyboard shortcuts, mouse events,
etc.
Additionally, it can be used to add custom keyboard or mouse events
generated by a virtual keyboard.
* examples: Added an example to demonstrates how to implement a custom
virtual keyboard.
[eframe-custom-keypad.webm](https://github.com/emilk/egui/assets/1274171/a9dc8e34-2c35-4172-b7ef-41010b794fb8)
* Remove the leading slash from the path if the target OS is Windows.
This is because Windows paths are not supposed to start with a slash.
For example, `file:///C:/path/to/file` is a valid URI, but
`/C:/path/to/file` is not a valid path.
* Use the input URI consistently as the cache key.
Currently, the cache key is inconsistently set as either the path or the
URI, while the forget key is always the URI. This inconsistency should
be resolved.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
The `Shape::translate` method has been replaced with `Shape::transform`,
which introduces breaking changes that could negatively impact existing
users.
This patch adds a `Shape::translate` wrapper to prevent these breaking
changes.
- Introduces `WidgetType::ProgressIndicator` and maps it to the
corresponding AccessKit role.
- A `Spinner` is now exposed as a widget indicating a progress for which
a completion state is not known.
- On the other hand, a `ProgressBar` reports a completion state and can
possibly be labeled. Note that a label is not used if not explicitly
asked by the user, as it would be redundant information. Assistive
technologies prefer the numerical value so they can, for instance, emit
beeps of which the frequency rise as the completion state increase. I
had to call `floor` on the progression as it seems all the ATs I tested
would round the value, hence reporting something different than what is
displayed on the label.