Commit Graph

3365 Commits

Author SHA1 Message Date
rustbasic fcd02bd7d1
Handle the IME event first in `TextEdit` to fix some bugs (#4794)
Handle the `IME` event first 
There is a need to handle the Ime event first.

Fix Issues : When you press `BackSpace`, the entire text is erased, and
when you press another letter, it appears again.
Fix Issues : When you press `Left`, the character being entered will be
copied once more.
Fix Issues : When you press `Enter`, `Enter` with `repeat` set is
entered and `Enter` is entered twice.
Fix Issues : When you press a key in `IME` mode, `repeat` is often set.

Fix Issues : Since you may be selecting something in the IME, this also
disables the `Arrow` keys.
2024-07-07 22:03:13 +02:00
rustbasic cd1e4c573a
Remove dead code (`EpiIntegration::frame_start`) (#4790)
`frame_start` appears to be deprecated now.
( Am I wrong? )

It would be a good idea to add `#[allow(dead_code)]` or remove
`frame_start`.
2024-07-07 08:52:14 +02:00
YgorSouza 39f7368d2e
Fix typos (#4796) 2024-07-07 08:50:04 +02:00
Emil Ernerfeldt 0f6310c598 Add release title to changelog entry 2024-07-05 12:14:03 +02:00
Emil Ernerfeldt abab06867c Release 0.28.1 - Tooltip tweaks 2024-07-05 12:09:21 +02:00
Emil Ernerfeldt 13fddc6416
Hide tooltip on click (#4789)
Affects uses of `on_hover_ui_at_pointer` and `show_tooltip_at_pointer`
2024-07-05 11:53:49 +02:00
Emil Ernerfeldt f92fe5544b Document Vec2 constants 2024-07-05 11:39:47 +02:00
Emil Ernerfeldt 0a9e0c87a4
Fix occational flickering of pointer-tooltips (#4788)
Affects uses of `on_hover_ui_at_pointer` and `show_tooltip_at_pointer`
2024-07-05 11:36:26 +02:00
Emil Ernerfeldt 0be4450e3d
Smoother animations (#4787)
This makes animations slightly smoother, especially in reactive mode
2024-07-05 11:36:19 +02:00
Emil Ernerfeldt 1059e0e7f1 Fix tooltip delay, bug introduced in #4784 2024-07-05 10:27:11 +02:00
Emil Ernerfeldt 2e2366e88d
Make `serde` a default (opt-out) feature of `egui_extras` (#4786)
This is a workaround for https://github.com/emilk/egui/issues/4771 to
make it less likely to bite users
2024-07-05 10:05:40 +02:00
Emil Ernerfeldt 977d83a08f
Hide tooltips when scrolling (#4784)
* Closes #4781
2024-07-05 09:39:12 +02:00
Emil Ernerfeldt 143119943d
Show the innermost debug rectangle when pressing all modifier keys (#4782)
This is usually what the user is interested in.
2024-07-05 08:36:56 +02:00
rustbasic ad597a8491
Add `Image::uri()` (#4720)
`uri()` for image

The advantages of this are :

1. No need for `ctx()` and `source()`
2. Displays `name.gif#0` as `name.gif`
2024-07-05 08:20:20 +02:00
lucasmerlin 9a4c46289e
Check if the mouse / touch event is above the canvas via element_from_point (#4775)
* Closes #4752 

To test, start the web demo and follow the repro steps from #4752
2024-07-05 08:18:53 +02:00
Emil Ernerfeldt b31d02dd21
Fix default height of top/bottom panels (#4779)
The inner size is now `interactive_size.y`, like in 0.27.

* Closes https://github.com/emilk/egui/issues/4773
* Broke in https://github.com/emilk/egui/pull/4351

Thanks to @valadaptive for reporting and diagnosing the bug
2024-07-04 11:05:43 +02:00
Emil Ernerfeldt 042e1add41
Better documentation for `Event::Zoom` (#4778)
* Closes https://github.com/emilk/egui/issues/4777

Also add this to the 0.28 migration guide.
2024-07-04 10:31:27 +02:00
Emil Ernerfeldt 8bf498d2bf Fix sizing of `images` example 2024-07-03 15:49:05 +02:00
Emil Ernerfeldt 234274d46f Release 0.28.0 - Sizing pass, and better eframe web 2024-07-03 14:54:08 +02:00
Emil Ernerfeldt bca9a04acd
Use correct cursor icons when resizing panels too wide or narrow (#4769) 2024-07-03 14:33:11 +02:00
Emil Ernerfeldt 47accb0eeb Tooltip fix: Only treat enabled widgets as interactive 2024-07-03 13:11:48 +02:00
Emil Ernerfeldt 249b69d534
Make sure all tooltips close if you open a menu in the same layer (#4766) 2024-07-03 12:33:23 +02:00
Emil Ernerfeldt d1be5a1efb
Only show one tooltip per layer at a time (#4763)
Before, you could accidentally get multiple tooltips if a tooltips was
interactive (e.g. had a link in it) and on the way to interact with it
you would hover another widget with a tooltip.

This PR ensures that each `LayerId` only has one tooltip open at a time.
You can still have a tooltip for an item inside of a tooltip.
2024-07-03 11:28:26 +02:00
Emil Ernerfeldt c0296fb47b
When debugging widget rects on hover, show width and height (#4762)
As requested by @gavrelina


![image](https://github.com/emilk/egui/assets/1148717/15d9600a-ae2e-43dd-981b-c690f9b1bdf1)
2024-07-03 10:48:52 +02:00
Emil Ernerfeldt dca552ea48
Save `FrameState` of previous frame (#4761)
By saving the `FrameState` of the previous frame, we make it much more
versatile, and allows us to remove some other double-buffering.
2024-07-03 10:31:02 +02:00
Emil Ernerfeldt 1b06c69d01
Fix text selection when there's multiple viewports (#4760)
* Closes https://github.com/emilk/egui/issues/4758

Thanks to @lukexor for finding and diagnosing the problem!
2024-07-03 10:19:03 +02:00
Emil Ernerfeldt fcb7764e48
Fix menus and interactive popups not closing when framerate was low (#4757) 2024-07-02 21:33:22 +02:00
Emil Ernerfeldt 8ef0e85b85
egui_extras: Improve the auto-sizing of `Table` (#4756)
This makes the sizing pass of an `egui_table` ensure the table uses as
little width as possible.
Subsequently, it will redistribute all non-resizable columns on the
available space, so that a table better follow the parent container as
it is resized.

I also added `table.reset()` for forgetting the current column widths.
2024-07-02 21:13:55 +02:00
Emil Ernerfeldt 753412193c
Improve `egui_extras::Table` layout (#4755)
Mostly a refactor, but some minor fixes to how it works.

Mostly preparing for a few bigger changes.
2024-07-02 20:57:46 +02:00
Emil Ernerfeldt f0e2bd8b00
Make it easier to grab the handle of a floating scroll bar (#4754)
Should solve https://github.com/rerun-io/rerun/issues/6700
2024-07-02 10:39:01 +02:00
William Zhang 770c82a3f3
Prevent `TextEdit` widgets from sending fake primary clicks (#4751)
<!--
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 test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* 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!
-->

This prevents TextEdit widgets from sending fake primary clicks when a
user types Space / Enter. Small change but having Space / Enter send
`OutputEvent::ValueChanged` instead of `OutputEvent::Clicked` makes more
sense I believe.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-07-02 09:18:47 +02:00
Wybe Westra fa8d535fe7
Disabled widgets are now also disabled in the accesskit output (#4750)
Marking widgets as disabled was not reflected in the accesskit output,
now the disabled status should match.

---------

Co-authored-by: Wybe Westra <w.westra@kwantcontrols.nl>
2024-07-02 09:18:30 +02:00
Emil Ernerfeldt fcec84ca74 Clarify version numbers in egui trunk 2024-07-02 09:09:30 +02:00
Emil Ernerfeldt af404fec63
Persist `Area` positions again (#4749)
* Reverts https://github.com/emilk/egui/pull/4577

We again persist area positions, but not sizes.
2024-07-01 17:33:03 +02:00
Emil Ernerfeldt 0fc79aea14 egui_demo_app: include `log::trace` in debug builds 2024-07-01 16:26:20 +02:00
Emil Ernerfeldt 7b61e426d7 eframe web: map `log::debug` to `console.debug`; not `console.trace` 2024-07-01 16:25:48 +02:00
Emil Ernerfeldt f3a0ac1d1b eframe web fix: `save()` on "blur" event 2024-07-01 16:16:56 +02:00
Emil Ernerfeldt 051b90bfc7 eframe web: Position the IME input position in the middle of the cursor 2024-07-01 16:08:20 +02:00
Emil Ernerfeldt d271718065
Fix focus problems on web (#4745)
* Closes https://github.com/emilk/egui/issues/4743
* Related to https://github.com/emilk/egui/issues/4569
2024-07-01 10:38:54 +02:00
Emil Ernerfeldt 31716d787e
Fix plot bounds of empty plots (#4741)
We would sometimes hit a `debug_assert` when plots were empty

* Closes https://github.com/rerun-io/rerun/issues/6681
2024-06-30 17:49:54 +02:00
Emil Ernerfeldt dc1f032846
Add `Style::number_formatter` as the default used by `DragValue` (#4740)
This allows users to customize how numbers are converted into strings in
a `DragValue`, as a global default.

This can be used (for instance) to show thousands separators, or use `,`
as a decimal separator.
2024-06-30 17:17:15 +02:00
Emil Ernerfeldt e297a1d107 Handle unicode minus character when parsing floats 2024-06-30 14:48:05 +02:00
Emil Ernerfeldt 3add56f81b Fix wrong comment 2024-06-30 14:35:46 +02:00
Emil Ernerfeldt 6222e031b5
The default parser for `DragValue` and `Slider` now ignores whitespace (#4739)
It's easy to include whitespace when copy-pasting values. Also, some
formatters use half-spaces as thousands separators.
2024-06-30 14:34:36 +02:00
Emil Ernerfeldt b6fd1cfc99
egui_plot: Improve default formatter of tick-marks (#4738)
The default `Plot` formatter now picks precision intelligently based on
zoom level. The width of the Y axis are is now much smaller by default,
and expands as needed.

Also deprecates `Plot::y_axis_with`; replaced with `y_axis_min_width`.
2024-06-30 14:20:41 +02:00
Emil Ernerfeldt 17fd305967 Fix `cargo test -p egui` 2024-06-30 14:12:40 +02:00
Emil Ernerfeldt d4e8966aac
Ensure `Window` scroll bars are at the window edges (#4733)
Set `auto_shrink(false)` on `Window`s `ScrollArea`.
This ensures that the scroll bars are always the outermost.

* Closes https://github.com/emilk/egui/pull/4602
2024-06-28 18:14:48 +02:00
Emil Ernerfeldt d10b3c1f4e
eframe web: Fix stuck keys after pressing ctrl+C, cmd+A, etc (#4731)
* Closes https://github.com/emilk/egui/issues/4724
2024-06-28 18:12:50 +02:00
Emil Ernerfeldt 2180f16cba
eframe web: Fix drag-and-drop file preview/hover (#4732)
* Closes https://github.com/emilk/egui/issues/4726
2024-06-28 18:07:53 +02:00
Emil Ernerfeldt 0c059ac113
Only repaint on cursor movements of area, or if dragging outside (#4730)
* Closes https://github.com/emilk/egui/issues/4723

Also fix some small bugs in the touch input on web
2024-06-28 17:40:48 +02:00