1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 07:03:14 -04:00
Commit Graph

2686 Commits

Author SHA1 Message Date
Emil Ernerfeldt
bb987bb50b De-duplicate color_from_contrast 2023-08-14 14:07:23 +02:00
Emil Ernerfeldt
4217f4ba7c Add some vertical spacing 2023-08-14 14:04:24 +02:00
Emil Ernerfeldt
93c763be5d Use Margin instead of a,b,c,d 2023-08-14 13:44:07 +02:00
Emil Ernerfeldt
75617d5a15 Use Arc to avoid some expensive clones 2023-08-14 13:36:52 +02:00
Emil Ernerfeldt
29eb119714 Simpler generic syntax 2023-08-14 13:24:19 +02:00
Emil Ernerfeldt
fdb5dc4d3b Merge branch 'master' into axis-labels 2023-08-14 13:23:26 +02:00
Emil Ernerfeldt
9eff191bc0 Use TAU instead of the legacy PI 2023-08-14 11:28:26 +02:00
Emil Ernerfeldt
135a457ecd typo in comment 2023-08-14 11:27:47 +02:00
Emil Ernerfeldt
a3ae81cadb Add option to truncate text at wrap width (#3244)
* Add option to clip text to wrap width

* Spelling

* Better naming, and report back wether the text was elided

* Improve docstrings

* Simplify

* Fix max_rows with multiple paragraphs

* Add note

* Typos

* fix doclink

* Add `Label::elide`

* Label: show full non-elided text on hover

* Add demo of `Label::elide`

* Call it `Label::truncate`

* Clarify limitations of `break_anywhere`

* Better docstrings
2023-08-14 11:22:04 +02:00
Frederic L
1023f937a6 Add option to always open hyperlink in a new browser tab (#3242)
* add option to always open hyperlink in a new browser tab

* Fix logic error
2023-08-12 14:05:49 +02:00
lucasmerlin
1036cb1f7d Change force to be Option<f32> instead of f32 (#3240) 2023-08-12 13:50:40 +02:00
Emil Ernerfeldt
6633ecce64 Fix wrong detection of OS (#3238)
We had a bunch of `cfg!(windows)` and `cfg!(macos)` which should
have been `cfg!(target_os = "windows")`.

I wonder what the effects of this PR will be fore Windows 😬
2023-08-12 13:50:31 +02:00
Aaron Hill
98087029e0 Update to wgpu 0.17.0 (#3170)
* Bump `wgpu` to 0.17.0
This required bumping wasm-bindgen to 0.2.87
* cargo deny exception for `foreign-types`
* sort deny.toml
* Add fragile-send-sync-non-atomic-wasm feature to wgpu
* cargo deny: ignore children of foreign-types

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-08-11 17:10:10 +02:00
Emil Ernerfeldt
dd417cfc1a eframe: Better restore Window position on Mac when on secondary monitor (#3239) 2023-08-11 16:25:22 +02:00
Emil Ernerfeldt
f78db80840 Update to wasm-bindgen 0.2.87 (#3237)
* Update to wasm-bindgen 0.2.87

Required by the new `wgpu` version

* Catch unknown arguments to build_demo_web.sh
2023-08-11 15:34:16 +02:00
Emil Ernerfeldt
dd5285cccb Support multi-threaded Wasm (#3236)
Replace `atomic_refcell` with `parking_lot` on wasm32.

`parking_lot` has had problems running on wasm32 before
(https://github.com/emilk/egui/issues/1401)
but it works these days.
If we have problems again we can always switch to `std::sync::Mutex`.

Closes https://github.com/emilk/egui/issues/3102
2023-08-11 15:08:00 +02:00
Emil Ernerfeldt
08fb447fb5 Increase MSRV to 1.67 (#3234)
* Bump MSRV to 1.67

* clippy fixes

* cargo clippy: inline format args

* Add `clippy::uninlined_format_args` to cranky lints

* Fix clippy on wasm

* More clippy fixes
2023-08-11 13:54:02 +02:00
Emil Ernerfeldt
bdeae9e959 Fix crash in DragValue when only setting min_decimals (#3231) 2023-08-11 08:24:39 +02:00
Idan Arye
ea6bdfc1c9 Force ColorPickerFn to be Send + Sync (#3148) (#3233) 2023-08-11 08:23:29 +02:00
Emil Ernerfeldt
1e885abe08 Gracefully catch error saving state to disk (#3230) 2023-08-10 17:28:21 +02:00
Emil Ernerfeldt
7e035c6dd1 Allow users to opt-out of default winit features (#3228)
* Do not enable winit features by default

* Enable default winit features by default

* Add x11 feature
2023-08-10 17:09:01 +02:00
Emil Ernerfeldt
d568d9f5d0 Lint vertical spacing in the code (#3224)
* Lint vertical spacing in the code

* Add some vertical spacing for readability
2023-08-10 15:26:54 +02:00
Emil Ernerfeldt
83c18498e9 Refactor: turn ClippedShape from struct-enum to a normal struct (#3225) 2023-08-10 14:50:11 +02:00
Emil Ernerfeldt
66cbb61ad5 Add PlotUi::response() to replace plot_clicked() etc (#3223)
Closes https://github.com/emilk/egui/pull/2571
2023-08-10 13:14:19 +02:00
Valentin
b15e17587a Document when Galleys get invalidated (#3024) 2023-08-10 13:11:56 +02:00
Emil Ernerfeldt
8cdffc4e2d Replace uses of RangeInclusive<f32> with emath::Rangef (#3221)
* Replace uses of `RangeInclusive<f32>` with `emath::Rangef`

* Fix doc-test
2023-08-10 13:07:00 +02:00
Valeriy V. Vorotyntsev
4c3b380889 Fix the "ever-growing height" problem of Strip and Table demos (#3122)
* Fix the "ever-growing height" problem of Strip and Table Demos

Problem
-------

The height of "Table Demo" or "Strip Demo" floating window grows
when the demo app is interacted with. If 'Continuous' mode is enabled
in 'Backend' settings, the window grows irrespectively of user interaction.

Observations
------------

I noticed that [`area_content_ui.min_rect().max.y`][1] is increasing
monotonically with speed 0.5 px/frame.

I also noticed that commenting out `ui.add(crate::egui_github_link_file!());`
[statement][2] in `table_demo.rs` makes the problem disappear.

The "Fix"
---------

I added 0.5 to the height of the row with GitHub link.
This solved the problem.

Closes #3029.

Warning
-------

I failed to find the root cause of the problem.
I don't understand why this change makes the problem disappear.

[1]: 9478e50d01/crates/egui/src/containers/window.rs (L403)
[2]: 9478e50d01/crates/egui_demo_lib/src/demo/table_demo.rs (L114)

* Document `Rect::size`

Other changes:

- `area.rs`: Use existing API.
- `table_demo.rs`: Remove unnecessary call.
2023-08-10 12:35:40 +02:00
hacknus
871041c4e7 Added an example to save plot to image (#2769)
* implement save_plot

* fix for check.sh

* clippy

* add save_plot to Cargo.lock

* adapted for PR #2676 (removes unsafe code)

* add some comments

* implemented the comments from emilk

* update comments in code

* rustfmt

* remove picked_path

* add more comments

* removed unused import

* use `inner.response.rect` as the plot position

* remove plot_location from MyApp members

* sort entries

* Update examples/save_plot/src/main.rs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* use env_logger instead of tracing subscriber

* use env_logger instead of tracing subscriber and combine if let

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-08-10 12:35:11 +02:00
Roshan Mehta
01b1b2da76 rotation feature to plot images (#3121) 2023-08-10 09:50:25 +02:00
jacekpoz
f2a58244c8 fix the title not being used when app_id is not set (#3107)
Co-authored-by: jacekpoz <jacekpoz@cock.li>
2023-08-10 09:50:15 +02:00
mauliu
af6419343d fix depth texture init with multisampling (#3207)
Co-authored-by: user <email@NEO.com>
2023-08-09 20:59:36 +02:00
Barugon
f9f9abf749 DragValue: update value on each key press by default (#2880)
* Use `Response::changed` to fix editing issues

* Update comment

* Make update while editing an option

* improve docstring

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-08-09 17:13:58 +02:00
Emil Ernerfeldt
abe91b00a4 Improve generate_changelog.py 2023-08-09 17:13:22 +02:00
Emil Ernerfeldt
51da2ac490 Improve documentation of Window/Area::resizable 2023-08-09 17:13:10 +02:00
Emil Ernerfeldt
92593b70fa Changelogs: document that they are updated upon release (not by users) 2023-08-09 17:12:47 +02:00
Steven Weiss
b2b6558c78 Tiny PR: Document available_width() and available_height() (#3130)
* Update ui.rs docs to clarify available_size and co

Added docs to the available_width() and available_height() methods. 

Added a quick note about the wrapping versions of the methods as well.

* fix a couple of typos, and use code-style for doc-links

* fix doclinks

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-08-09 17:06:33 +02:00
Agustín Díaz
f2769f3010 Fix dobule "for" typo (#3189) 2023-08-09 16:48:21 +02:00
Nicolas Riebesel
cbdf748a3b egui: Plot Arrows add method to specify tip_size (#3138)
Normally the tip_size will be dependent on the arrow length.
This patch adds a new method to explicitly set the arrow tip size.
2023-08-09 16:47:46 +02:00
thomaseliot
e82ec74c5c epaint: Add ColorImage::from_gray (#3166)
* epaint: Add from_gray_unmultiplied function

* Rename to just `from_gray`

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-08-09 16:46:45 +02:00
Ho Kim
35027d3ebe Fix a document: eframe::start_web (#3026)
In `0.22.0`,  `eframe::start_web` has been replaced with `eframe::WebRunner`, which also installs a nice panic hook (no need for `console_error_panic_hook`).
2023-08-09 16:24:32 +02:00
Yuan Chang
20be0847c8 Add into_inner methods. (#3110) 2023-08-09 16:20:59 +02:00
Emil Ernerfeldt
46daaa8a34 Improve PR template 2023-08-09 12:51:22 +02:00
Emil Ernerfeldt
9c15783fab CI: update list of accepted PR labels 2023-08-09 12:51:08 +02:00
Dirk Stolle
9731cfd9cf Update GitHub Actions CI (#3150)
The following updates are performed:
* update actions/checkout to v3
* replace unmaintained actions-rs/toolchain by dtolnay/rust-toolchain
* replace unmaintained actions-rs/cargo by direct invocation of cargo
2023-08-09 12:50:33 +02:00
Stephen M. Coakley
486cff8ac3 Fix panic with persistence without window (#3167)
A window may not always be available and may have already been closed by the time an eframe app is closing. An example of this is Android, where the main activity window may have been stopped or discarded because the app is no longer in the foreground, and then the user decides to close your app without resuming it using the multitasking view.

In this case, skip the window persistence step if it does not exist anymore by the time we are saving the persistence data. Currently eframe will panic with `winit window doesn't exist` instead.
2023-08-09 12:42:43 +02:00
Brian Janssen
67ba4f2811 Add comment explaining Tab button (#2872) 2023-08-09 11:48:54 +02:00
dependabot[bot]
387b075681 Bump xml-rs from 0.8.13 to 0.8.15 (#3145)
Bumps [xml-rs](https://github.com/kornelski/xml-rs) from 0.8.13 to 0.8.15.
- [Changelog](https://github.com/kornelski/xml-rs/blob/main/Changelog.md)
- [Commits](https://github.com/kornelski/xml-rs/compare/0.8.13...0.8.15)

---
updated-dependencies:
- dependency-name: xml-rs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-09 11:15:37 +02:00
Felix Wiegand
d483ac47ba Fix auto_bounds when only one axis has restricted navigation (#3171) 2023-08-09 11:08:04 +02:00
lampsitter
cd917e49f2 Separate text cursor from selection visuals (#3181) 2023-08-09 11:07:40 +02:00
Emil Ernerfeldt
0e5f93b65d Add Margin::expand_rect and shrink_rect (#3214)
* Add `Margin::expand_rect` and `shrink_rect`

* fix typo

* Use the new helpers
2023-08-08 11:50:10 +02:00