Replaces only the cargo_deny.sh script for now. Can be expanded over
time to replace the other shell and python scripts, so only Rust is
needed to work with the repository.
Closes <https://github.com/emilk/egui/issues/2887>
Closes <https://github.com/emilk/egui/issues/4373>
---------
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/4356
- Add `Undoer::new()`
- This is necessary to construct an `Undoer` whose `State` parameter
doesn't implement `Default`.
- Add `Undoer::with_settings(...)`
- This is necessary to actually pass settings into the `Undoer`. Without
this, API consumers could construct their own `Settings` but not
actually do anything with it.
I've refrained from adding any kind of builder API for `Settings`
because there are only three options and I don't want to duplicate or
move all the documentation onto the builder methods.
The painter, allocated by `Ui::allocate_painter`, doesn't inherit
properties from the `Ui` object, leading to improper widget rendering in
`egui`.
Specifically, if the `Ui` object is disabled, the corresponding painter
should also be disabled.
The `hex_color!` macro currently makes an unqualified reference to the
`color_hex` crate, which users may not have in their `Cargo.toml`. This
PR re-exports `color_hex` from the root of `ecolor` and changes the
macro to use the re-exported path.
<!--
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/2644
These two items are needed to implement the `PlotItem` trait (which is
already public) when using `PlotGeometry::Rects`.
Specifically, they are used in the return type of
`PlotItem::find_closest` and as arguments to `PlotItem::on_hover`, which
need to be implemented when using `PlotGeometry::Rects`.
<!--
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!
-->
While breaking a paragraph, it was possible to lose line break
candidates that could've been used on the next line, causing egui to
unnecessarily overrun `wrap.max_width`.
This PR fixes it so that we don't forget about those candidates.
Before:
Note that the window can't resize to the requested width because the
text is not wrapping.
https://github.com/emilk/egui/assets/1410520/6430a334-2995-4b40-bc34-8f01923f9f95
After:
https://github.com/emilk/egui/assets/1410520/225fa4cd-cbbb-4a7e-9580-7f1814c05ee7
---------
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!
-->
Adds a flag to ScrollArea that disables animations for the scroll_to_*
functions
Usually this isn't visible (the same label being painted on top of
itself), but it will be visible if the user has a custom formatter (e.g.
`y_axis_formatter`) that choses a different format based on
`GridMark:step_size` (e.g. using fewer decimals for thicker ticks).
Adds support for the ordering of windows passing through to the
underlying area.
Needed for a specific usecase of adding debug tools using windows with
the bevy integration.
* Closes https://github.com/emilk/egui/issues/4241
I would love some more testers of this.
I'm not sure if we really need the round-to-even code, but I'm hesitant
to out-right revert https://github.com/emilk/egui/pull/151 when I cannot
reproduce its problem. Keeping it seems quite safe though.
---
# Testing
Checkout the branch and run:
* `./scripts/start_server.sh`
* `./scripts/build_demo_web.sh` and then open
`http://localhost:8888/index.html#Rendering`
* `./scripts/build_demo_web.sh --wgpu` and then open
`http://localhost:8888/index.html#Rendering`
Check the "Rendering test" that the squares in the pixel alignment test
are perfectly sharp, like this:
<img width="576" alt="Screenshot 2024-04-01 at 13 27 20"
src="https://github.com/emilk/egui/assets/1148717/fb6c4824-9e25-4304-bc0c-3c50fbd44a52">
If it looks something like this, something is WRONG:
<img width="488" alt="Screenshot 2024-04-01 at 13 29 07"
src="https://github.com/emilk/egui/assets/1148717/04bd93ff-2108-40c5-95f6-76e3bcb9cd7f">
Please try it on different zoom levels in different browsers, and if
possible on different monitors with different native dpi scaling. Report
back the results!
### Mac
I have tested on a high-DPI Mac:
* Chromium (Brave): ✅ Can reproduce problem on `master`, and it's now
fixed
* Firefox: ✅ Can reproduce problem on `master`, and it's now fixed
* Safari: ❌ Can't get it to work; giving up for now
This is a fix meant mostly for Rerun, where we sometiems paint a
vertical time-line over the plot (which is interactive). Before this PR
you couldn't zoom or pan the plot while hovering that line, which was
really annoying.
At least all those above any interactive widget.
* Closes https://github.com/emilk/egui/issues/4286
I feel there is still more thinking to be done about what is considered
`hovered` and how it relates to `contains_pointer`, but this PR at least
fixes tooltips for uninteractive widgets
* Closes#4254
Changes egui-winit so that it calls `window.set_ime_cursor_area` when
the IME rect changes or the user interacts with the application instead
of calling it every time the app is rendered. This works around a winit
bug that causes the app to continuously repaint under certain
circumstances on Wayland.
Tested on Wayland and on X11 using the text edit in the egui_demo_app -
no changes in IME functionality as far as I can tell. Untested on
non-Linux platforms.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This means only one space allocation, which should allow putting it in
more types of layouts (right-to-left, centered, adjusted, …).
It also just makes the code simpler
`clicked_elsewhere` now checks against the clipped `interact_rect` of
the widget instead of the full `rect`.
In practice this shouldn't change much since the function is mostly used
for windows and areas, which aren't clipped.
This is mostly a refactor, but has some performance benefits:
* We (re)use the same tessellator as for everything else, leading to
less allocations
* We cull shapes before rendering them
Adding `RectShape::blur_width` means it can also be used for other
effects, such as glow.
Before, when setting the `zoom_factor`, the website was already
enlarged, but the zoom was ignored when calculating the logical window
size and mouse position, causing an offset between the actual cursor and
selected elements. That is addressed here
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>