Commit Graph

3017 Commits

Author SHA1 Message Date
Emil Ernerfeldt a8501c963d Release 0.26.1 - Bug Fixes 2024-02-11 08:59:02 +01:00
Varphone Wong 0d17b6748d egui: Fix custom `Window` `Frame`s (#4009)
Fix #4002 


![fixed-#4002](https://github.com/emilk/egui/assets/1274171/cf867d69-87df-46fe-a1e4-ff9a333fe2f2)
2024-02-11 08:56:44 +01:00
Emil Ernerfeldt 9aac3ef406 Revert hello_world example 2024-02-10 18:09:09 +01:00
Emil Ernerfeldt 109c0a8695 Revert renaming a field in `WidgetRect` to avoid semver breakage 2024-02-10 18:04:39 +01:00
Emil Ernerfeldt 6e4dab97fb Revert semver-breaking change, and replace with temporary HACK 2024-02-10 18:00:31 +01:00
Emil Ernerfeldt 12749f3b5a Take clip_rect into account when storing widget rects (#4020)
* Bug introduced in https://github.com/emilk/egui/pull/4013
* Closes https://github.com/emilk/egui/issues/4017

Unfortunately this is a breaking change, since it changes the fields of
`Response`, so can't do a patch-release with this.
2024-02-10 17:51:31 +01:00
Emil Ernerfeldt 45154fc1c8 Fix: `Response.interact_pointer_pos` is `Some` on click and drag released (#4014)
* Closes https://github.com/emilk/egui/issues/3999

In 0.26.0 is was accidentally set to `None` on the frame we got a click
or drag release
2024-02-10 17:51:09 +01:00
Emil Ernerfeldt df7e4a5db6 Fix `Response::interact` and `Ui:interact_with_hovered` (#4013)
These broke in 0.26

* #3989
* #4006
2024-02-10 17:51:09 +01:00
Georg Weisert db00dc6ea5 Fix `TextEdit` being too short whenever there is horizontal margin (#4005)
The allocated width is reduced by the horizontal margin inside
`show_content` but the margin is already factored into the content_ui's
rect.
This causes both text and frame (not shown here) to be `2.0 * margin.x`
too short.

Before:

![image](https://github.com/emilk/egui/assets/23122431/6a9a0264-3fc0-48b7-b462-82120ed47fcf)

After:

![image-1](https://github.com/emilk/egui/assets/23122431/ffef9edc-d571-4fca-96cf-c2e42e2f0057)
(*The blue rect is the TextEdit's (expected) final size.)

Co-authored-by: Georg Weisert <georg.weisert@freshx.de>
2024-02-10 17:51:09 +01:00
njust 820a3baf30 egui demo: Fix space reserved for source code link (#3983)
Clip the cell of the source code link to prevent the strip from growing
infinitely if the reserved size for the link is not sufficient.


![image](https://github.com/emilk/egui/assets/2380253/0cf214fc-addc-4212-90fc-d68834c1cfe7)

Closes <https://github.com/emilk/egui/issues/3980>.
2024-02-10 17:51:09 +01:00
Emil Ernerfeldt 1fe0f2417a Improve panic message in egui-wgpu when failing to create buffers (#3986)
Example:

> thread 'main' panicked at 'Failed to create staging buffer for vertex
data. Vertex count: 10 011 232. Required vertex buffer size:
200 224 640. Actual size 349 450 240 and capacity: 349 450 240 (bytes)
2024-02-10 17:51:09 +01:00
Emil Ernerfeldt a415aa4bc6 Update to document-features 0.2.8 (#4003)
Solves a build issue: https://github.com/rerun-io/rerun/issues/5113
2024-02-10 17:51:09 +01:00
YgorSouza a829fff19c Make `on_disabled_hover_ui` respect `tooltip_delay` (#4012)
* Closes <https://github.com/emilk/egui/issues/3997>
2024-02-10 17:51:09 +01:00
Magnus Larsen 826b1ac80d egui_glow: Only disable sRGB framebuffer on supported platforms (#3994)
This solves a GL_INVALID_ENUM error common on Windows (occurs on my
Windows 10 machine with a GTX 1070 Ti).

<!--
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!
-->

ARB_framebuffer_SRGB is entirely unsupported on WebGL, hence why latest
egui (master branch) doesn't try to disable SRGB framebuffers on wasm32
and this PR's code doesn't even check for ARB_framebuffer_sRGB on
wasm32.

*  For <servo/servo#30782>
2024-02-10 17:51:09 +01:00
Varphone Wong 26a87715f2 egui: Fixed window title bar incorrect handling spacing (#3995)
Currently, the window title bar does not correctly handle the
`item_spacing` and `window_margin`.

* Video snapshot on changing the `item_spacing` and `window_margin`
(master)


[egui-demo-app-incorrect.webm](https://github.com/emilk/egui/assets/1274171/a4e32d43-69b5-44be-a4c3-97b0533147ca)

* Video snapshot on changing the `item_spacing` and `window_margin`
(feature/fix-window-title-bar)


[egui-demo-app-fixed.webm](https://github.com/emilk/egui/assets/1274171/42bbc210-a1f3-4e0a-ab71-d068e58e0e35)
2024-02-10 17:51:09 +01:00
rustbasic 68eb3db648
Fix high CPU usage on Windows when app is minimized (#3985)
patch #3982
2024-02-06 13:24:49 +01:00
Emil Ernerfeldt 45e9e8df00 PR template: remind contributors to pick good PR titles 2024-02-06 09:22:14 +01:00
Emil Ernerfeldt 8ddd33fc89
README.md: put demo images next to each other 2024-02-06 08:13:37 +01:00
Emil Ernerfeldt 56bf8b79f3 Release 0.26.0 - Text selection in labels 2024-02-05 17:28:10 +01:00
Emil Ernerfeldt b36b3d69a8 Fix markdown formatting of link in docstring 2024-02-05 17:21:12 +01:00
Emil Ernerfeldt 579e84ec93 generate_changelog.py: add option to write it to the changelogs 2024-02-05 16:59:25 +01:00
Emil Ernerfeldt 74f00f9017 Turn repaint_on_widget_change off by default 2024-02-05 15:48:11 +01:00
Emil Ernerfeldt 217e066626
Make `egui_wgpu::renderer` a private module (#3979)
All its contents is exported to the top-level
2024-02-05 15:12:59 +01:00
Emil Ernerfeldt 1858167296
Fix calling request_repaint_after every frame causing immediate repaint (#3978)
* Closes https://github.com/emilk/egui/pull/3925
* Closes #3109
2024-02-05 14:45:49 +01:00
Emil Ernerfeldt d018265587
Wait with showing tooltip until mouse has been still for 300ms (#3977)
You can change this with `style.interaction.tooltip_delay§
2024-02-05 14:35:45 +01:00
Emil Ernerfeldt 28d3c8e2b5 Improve README.md 2024-02-05 14:11:54 +01:00
Emil Ernerfeldt b522200804 Update example screenshots 2024-02-05 13:01:10 +01:00
Emil Ernerfeldt d02491425c
Put all egui crates as workspace crates (#3976)
Second attempty
2024-02-05 12:59:49 +01:00
Emil Ernerfeldt bcebfecb84
Use more workspace dependencies (#3975) 2024-02-05 12:43:58 +01:00
Emil Ernerfeldt a5f3881d59
Add `Spacing::menu_width` (#3973)
Let users pick default menu width
2024-02-05 11:53:24 +01:00
StratusFearMe21 7a6d80cc8c
Pass `ScreenDescriptor` to `egui_wgpu::CallbackTrait::prepare` (#3960)
<!--
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.
* 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!
-->

`glyphon` requires the screen resolution during the `prepare` stage, and
passing that to the callback's `prepare` function seems pretty trivial.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-02-05 11:17:21 +01:00
Dan Lock a5973e5cac
Add `TextureOptions::wrap_mode` (#3954)
Exposes support in both glow and wgpu for texture wrap modes

This would be breaking for manual creations of TextureOptions but would
work with the current TextureOptions::NEAREST and LINEAR without change,
keeping those clamp to edge

I wasn't sure how best to expose the options to the user and added
consts for LINEAR_REPEAT LINEAR_MIRRORED_REPEAT NEAREST_REPEAT
NEAREST_MIRRORED_REPEAT

This does not include wrap mode clamp to border as it worked fine with
glow but with wgpu it panics due to Features
Features(ADDRESS_MODE_CLAMP_TO_BORDER) are required but not enabled on
the device, and I thought it was probably best not to try to enable that
feature, but happy to include that functionality also if that is okay to
be toggled


![image](https://github.com/emilk/egui/assets/5075747/bba71f61-a105-4e5b-b8ce-1083621eb3de)

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-02-05 09:37:05 +01:00
njust a41a04d635
Override text color with stroke selection color for selected cells (#3968)
Closes #3967 


![image](https://github.com/emilk/egui/assets/2380253/4aaa55bd-e6dc-4780-a9b1-14d537d10116)
2024-02-05 09:17:22 +01:00
YgorSouza bfdfb8894d
Fix typos in `crates/egui/src/context.rs` (#3966) 2024-02-05 09:12:01 +01:00
Ivan a6a9501d12
Fix `StripBuilder` not allocating its used space (#3957)
At crates\egui_extras\src\layout.rs :

Allocate allocation_rect instead of max_rect.
Go back from this:
```
let response = self.ui.allocate_rect(max_rect, self.sense);
let response = response.with_new_rect(allocation_rect);
return (used_rect, response)
```

to this:
```
let response = self.ui.allocate_rect(allocation_rect, self.sense);
return (used_rect, response)
```

In order to allocate the

Closes <https://github.com/emilk/egui/issues/3956>.
2024-02-05 08:34:46 +01:00
YgorSouza 1636b6af08
Fix clip rect for plot items (#3955)
Closes <https://github.com/emilk/egui/issues/3865>.
2024-02-05 08:24:49 +01:00
Emil Ernerfeldt 114f820170
`Context::repaint_causes`: `file:line` of what caused a repaint (#3949)
* Basic version of https://github.com/emilk/egui/issues/3931

This adds `Context::repaint_causes` which returns a `Vec<RepaintCause>`,
containing the `file:line` of the call to `ctx.request_repaint()`.

If your application is stuck forever repainting, this could be a useful
tool to diagnose it.
2024-02-02 16:06:37 +01:00
Emil Ernerfeldt c5352cf6c1 Remove profile scope from `tessellate_shape` 2024-02-02 15:53:01 +01:00
Emil Ernerfeldt 60e272f192
Make `egui_plot::PlotItem` a public trait (#3943) 2024-02-02 14:38:35 +01:00
Emil Ernerfeldt 8f2c8664e7
Emilk/revert workspace deps (#3942)
* Closes https://github.com/emilk/egui/issues/3941

Workspace dependencies can be annoying.

If you don't set them to `default-features=false`, then you cannot opt
out of their default features anywhere else, and get warnings if you
try.

So you set `default-features=false`, and then you need to manually opt
in to the default features everywhere else.
Or, as in my case, don't.

I don't have the energy to do this tonight, so I'll just revert.
2024-02-01 21:29:48 +01:00
Emil Ernerfeldt 00cd671ad8 Use workspace dependencies for the egui crates 2024-02-01 20:25:31 +01:00
Emil Ernerfeldt 948db61a8a
Update to puffin 0.19 (#3940)
…and some other smaller crate updates
2024-02-01 20:15:11 +01:00
Emil Ernerfeldt dda9f79838 Remove `version` field for path-dependencies 2024-02-01 20:11:40 +01:00
Emil Ernerfeldt 520b28ce22
Don't make labels focusable by default (#3937)
* Closes https://github.com/emilk/egui/issues/3910
2024-02-01 18:08:36 +01:00
Emil Ernerfeldt 67b796faee
Misc cleanup (#3935)
* Improve docstring
* Nicer welcome gif in README
* Misc cleanup
2024-02-01 17:09:35 +01:00
Emil Ernerfeldt 1db291721f
Parallell tessellation (#3934)
* Part of https://github.com/emilk/egui/issues/1485

This adds a `rayon` feature to `epaint` and `egui` to parallelize
tessellation of large shapes, such as high-resolution plot lines.
2024-02-01 16:27:59 +01:00
Emil Ernerfeldt 8860930ec8
Niche-optimize `Id` so that `Option<Id>` is the same size as `Id` (#3932)
This is an optimization for places that use `Option<Id>`
2024-02-01 12:18:36 +01:00
Emil Ernerfeldt 3a1244f672
Auto-repaint when widgets move or changes id. (#3930)
With this PR, if a widget moves or repaints, egui will automatically
repaint.

Usually this is what you want: if something is moving we should repaint
until it stops moving.

However, this could potentially create false positives in some rare
circumstances, so there is an option to turn it off with
`Options::repaint_on_widget_change`.
2024-02-01 11:33:23 +01:00
YgorSouza d72f92c41d
Add `x11` and `wayland` features to egui-wgpu and egui_glow (#3909)
This allows them to build correctly on Linux by passing one or both of
the features alongside `winit`.

Closes #3492
Closes #2286
2024-01-30 16:55:55 +01:00
Andreas Reich ca513ce241
Plot items now have optional id which is returned in the plot's response when hovered (#3920)
This allows users to check which item the user interacts with in the
plot.



https://github.com/emilk/egui/assets/1220815/1a174b38-8414-49be-a802-d187cd93d154

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-01-30 15:55:56 +01:00