1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00
Commit Graph

3866 Commits

Author SHA1 Message Date
Hubert Głuchowski
48e4e8ca92 Don't round row sizes again in Galley::concat 2025-04-01 16:32:42 +02:00
Emil Ernerfeldt
00ed9c1547 Be more forgiving in our comparison 2025-03-30 20:29:52 +02:00
Emil Ernerfeldt
a72e10ab23 Remove outdated TODO 2025-03-30 20:18:06 +02:00
Emil Ernerfeldt
59442ca4d5 Make Debug for Rect heed precision 2025-03-30 20:05:09 +02:00
Emil Ernerfeldt
8a33a6a6ce Make the section index private so we don't need to calculate it corectly 2025-03-30 20:03:47 +02:00
Emil Ernerfeldt
22ea9e91bd Optimize concat 2025-03-30 19:48:10 +02:00
Emil Ernerfeldt
d74bee536f Fix first performance performance problem 2025-03-30 18:54:15 +02:00
Emil Ernerfeldt
f4fca5a117 Better handling of invisible underlines/strikethrough 2025-03-30 17:52:48 +02:00
Emil Ernerfeldt
5f01b0dc9d Round glyph to closes pixel 2025-03-30 17:52:29 +02:00
Emil Ernerfeldt
20667a0592 put PlacedRow::pos first in struct 2025-03-30 17:52:13 +02:00
Emil Ernerfeldt
1b1f0726ce Simplify Galley bounding rect calulcation 2025-03-30 17:23:21 +02:00
Emil Ernerfeldt
9e44490b31 Refactor galley size rounding 2025-03-30 17:13:39 +02:00
Emil Ernerfeldt
b0d0d2f279 Test that halign & justify works the same 2025-03-30 16:58:19 +02:00
Emil Ernerfeldt
4ee4572f02 Fix bug in code transforming TextShape 2025-03-30 16:50:05 +02:00
Emil Ernerfeldt
7824e2ac18 Implement MulAssign for Pos2 2025-03-30 16:41:20 +02:00
Emil Ernerfeldt
3d70f7289a Small code cleanup 2025-03-30 16:37:43 +02:00
Emil Ernerfeldt
88340eee76 Merge branch 'master' into cache_galley_lines 2025-03-30 16:36:54 +02:00
Emil Ernerfeldt
e275409eb1 Fix: transform TextShape underline width (#5865)
Minor bug fix when transforming a `TextShape` with a `underline` (used
for e.g. hyperlinks). Before the underline width would not scale
properly; now it will.
2025-03-30 16:36:03 +02:00
Emil Ernerfeldt
072c8fc8ed Merge branch 'master' into cache_galley_lines 2025-03-30 16:22:59 +02:00
Emil Ernerfeldt
e3acd71090 Make text background rects pixel-sharp (#5864)
Small visual teak: make sure the background text color is pixel-aligned.
2025-03-30 16:21:00 +02:00
Alexander Nadeau
995058bbd1 Update web-sys min version to 0.3.73 (#5862)
This should prevent compilation errors (which I ran into) where eframe
tries to use HtmlElement::set_autofocus(), which doesn't exist until
0.3.73.

```
error[E0599]: no method named `set_autofocus` found for struct `HtmlElement` in the current scope
  --> C:\Users\wareya\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\eframe-0.31.1\src\web\text_agent.rs:24:15
   |
24 |         input.set_autofocus(true)?;
   |               ^^^^^^^^^^^^^
   |
help: there is a method `set_onfocus` with a similar name
   |
24 |         input.set_onfocus(true)?;
   |               ~~~~~~~~~~~
```

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

* [x] I have followed the instructions in the PR template
2025-03-30 14:04:07 +02:00
Hank Jordan
943e3618fc Improve drag-to-select text (add margins) (#5797)
Might want to draw from `interaction.interact_radius` style instead of
hard-coding the margin, but I didn't want to create a breaking change.
If desired, I can follow up with a separate PR to address that concern.

* Closes <https://github.com/emilk/egui/issues/5796>
* [x] I have followed the instructions in the PR template
2025-03-30 14:03:19 +02:00
Timo von Hartz
ab0f0b7b64 Rename should_propagate_event & add should_prevent_default (#5779)
* [x] I have followed the instructions in the PR template

Currently eframe [calls
`prevent_default()`](962c7c7516/crates/eframe/src/web/events.rs (L307-L369))
for all copy / paste events on the
[*document*](962c7c7516/crates/eframe/src/web/events.rs (L88)),
making embedding an egui application in a page (e.g. an react
application) hard (as all copy & paste functionality for other elements
on the page is broken by this).

I'm not sure what the motivation for this is, if any.

This commit / PR adds a callback (`should_prevent_default`), similar to
`should_propgate_event`, that an egui application can use to overwrite
this behavior. It defaults to returning `true` for all events, to keep
the existing behavior.

I call `should_prevent_default` in every place that
`should_propagate_event` is called (which is not all places that
`prevent_default` is called!). I'm not sure for the motivation of not
calling `should_propagate_event` everywhere that `stop_propagation` is
called, but I kept that behavior for the `should_prevent_default`
callback too.

Please let me know if I'm missing some existing functionality that would
allow me to do this, or if there's a reason that we don't want
applications to be able to customize this (i.e. if there's a reason to
always `prevent_default` for all copy / paste events on the whole
document)
2025-03-30 14:00:46 +02:00
Emil Ernerfeldt
83254718a3 Clean up strikethrough/underline code in epaint 2025-03-30 13:15:41 +02:00
Emil Ernerfeldt
e393a38307 Merge branch 'master' into cache_galley_lines 2025-03-28 20:37:57 +01:00
Emil Ernerfeldt
7ea3f762b8 Make text underline and strikethrough pixel perfect crisp (#5857)
Small visual fix: pixel-align any text underline or strikethrough.
Before they could be often be blurry.
2025-03-28 20:37:38 +01:00
Emil Ernerfeldt
5ecc31885c Pre-existing bug fix: round strikethrough and underline to pixel coord 2025-03-28 20:24:33 +01:00
Emil Ernerfeldt
ed847f1a55 Refactor: create Stroke::round_center_to_pixel 2025-03-28 20:22:10 +01:00
Emil Ernerfeldt
25f647322e Make test a bit more forgiving 2025-03-28 20:08:47 +01:00
Emil Ernerfeldt
cbc3c33051 Don't round row positions to ui 2025-03-28 20:05:03 +01:00
Emil Ernerfeldt
1cdf525797 Remove dbg! 2025-03-28 16:10:49 +01:00
Emil Ernerfeldt
33ff4bd7da Simplify 2025-03-28 16:09:40 +01:00
Emil Ernerfeldt
2fb0764a24 Fix section_index 2025-03-28 16:08:46 +01:00
Emil Ernerfeldt
b060fd25b0 Remove unwraps 2025-03-28 16:08:35 +01:00
Emil Ernerfeldt
46ef7a1159 code cleanup 2025-03-28 15:55:23 +01:00
Emil Ernerfeldt
47f916ca80 Fix wrong mesh_bounds 2025-03-28 15:34:00 +01:00
Emil Ernerfeldt
947945f0ba Remove done TODO 2025-03-28 15:13:57 +01:00
Emil Ernerfeldt
79d114dfb0 Use similar-asserts for better test output 2025-03-28 15:11:30 +01:00
Emil Ernerfeldt
2ac4c93cc3 Move Galley::concat 2025-03-28 12:54:53 +01:00
Emil Ernerfeldt
29d47c1641 Clean up code slightly 2025-03-28 12:52:07 +01:00
Emil Ernerfeldt
d8a45d0836 Silence a warning 2025-03-28 12:39:02 +01:00
Emil Ernerfeldt
6f4732b068 Simplify the code slightly 2025-03-28 12:38:55 +01:00
Emil Ernerfeldt
3e89613dc1 Add messages to asserts 2025-03-28 12:29:12 +01:00
Emil Ernerfeldt
9bd23ef79a Stop using deprecated rand functions 2025-03-28 12:29:00 +01:00
Emil Ernerfeldt
a5bc318e20 Update to rand 0.9 2025-03-28 11:36:47 +01:00
Emil Ernerfeldt
8a45db62f1 Create should_cache_each_paragraph_individually and heed max_rows 2025-03-28 11:33:56 +01:00
Hubert Głuchowski
085d9b56e9 Merge branch 'master' into cache_galley_lines 2025-03-26 19:08:40 +01:00
Lucas Meurer
884be3491d Fix color picker button (#5847)
* related to #5832 
(I want to keep that open and actually update the button to use the new
popup, but this should be enough to fix it for now)
* [X] I have followed the instructions in the PR template
2025-03-25 14:38:51 +01:00
TPhoenix
5d6aaa239b Fix typo in style.rs (#5845)
lien -> line

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

* Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>
* [ x ] I have followed the instructions in the PR template
2025-03-25 14:19:23 +01:00
Nicolas
8b62fd9286 Fix Lint for debug-assert (#5846)
Fixes the current ci workflow error
2025-03-25 14:18:45 +01:00