Commit graph

1120 commits

Author SHA1 Message Date
Emil Ernerfeldt
cb0d5a58ab Fix incorrect documentation for Response::context_menu
Closes https://github.com/emilk/egui/issues/1882
2022-08-03 08:26:42 +02:00
Nicolas Musset
e288ca86fd
Remove dependency on AsRef trait for TextBuffer (#1824) 2022-08-02 20:35:37 +02:00
Emil Ernerfeldt
06adb09fa3 Make stick_to_bottom take a bool argument 2022-08-02 20:34:50 +02:00
Emil Ernerfeldt
10788ccc92
More newlines for improved readability (#1880)
* Add blank lines above all `fn`, `impl`, `struct`, etc
* Even newlines between docstringed struct and enum fields
* Improve some documentation
2022-08-02 17:26:33 +02:00
Emil Ernerfeldt
2500a60062 Code cleanup and improved docs 2022-07-30 18:40:49 +02:00
Kubik
5fb4efa768
Improve documentation about panel order (#1869) 2022-07-30 17:11:56 +02:00
Emil Ernerfeldt
d659e5d24f Add Shape::hline and Shape::vline 2022-07-30 15:34:24 +02:00
Emil Ernerfeldt
c62f3409bd Fix misnamed variable (content_is_too_small -> content_is_too_large)
See https://github.com/emilk/egui/issues/1376
2022-07-30 15:33:08 +02:00
quietvoid
8997519eb2
Fix valign typo (#1870) 2022-07-30 14:55:34 +02:00
Emil Ernerfeldt
4e8a6e3370 misc code cleanup 2022-07-29 16:07:26 +02:00
Emil Ernerfeldt
2612dd1064 Add Visuals::error_fg_color and Visuals::warn_fg_color 2022-07-29 15:32:32 +02:00
Emil Ernerfeldt
51052c08e9 code cleanup: Pos2::new -> pos2, Vec2::new -> vec2 2022-07-29 14:34:26 +02:00
Matt Campbell
c6c6d2dc5d
Track the global focus state of the UI (#1859)
* Track the global focus state of the UI

* Fix changelog entries

* Document the new difference between `Response::has_focus` and `Memory::has_focus`
2022-07-29 13:15:26 +02:00
zapp88
36a49ffba9
Add dry run feature for anchor calculation. (#1) (#1856)
* Add dry run feature for anchor calculation. (#1)

This PR resolves issue: emilk#1852
We introduce dry_run flag which makes component invisible until we do second pass of rendering - which allows us to properly calculate position for anchor. (This removes rapid flicker when new window is drawn for the first time).

* Change naming convention and add description
2022-07-29 13:14:28 +02:00
Emil Ernerfeldt
278db1c94b
Fix plot auto bounds (#1865)
* Better estimate the plot bounds for generator functions

Avoid infinities, and sample more densely

* Optimize and improve plot auto-bounds logic

* Fix cropping out of the top/bottom of plots during auto-bounds
2022-07-29 12:32:47 +02:00
Matt Campbell
b3ab31953e
Fix focus behavior when pressing Tab with no focus (#1861) 2022-07-29 10:42:09 +02:00
Matt Campbell
7a46a23db5
Update MSRV to Rust 1.61.0 (#1846) 2022-07-26 16:50:53 +02:00
Emil Ernerfeldt
8e2de26e4e Enable more clippy lints 2022-07-26 11:18:21 +02:00
Adam Gąsior
36cdae98df
Add methods for custom number formatting in DragValue and Slider (#1851) 2022-07-25 22:38:24 +02:00
Nolan Darilek
0913c77f3d
Make sliders correctly generate events on change. (#1854) 2022-07-25 22:05:05 +02:00
Sven Niederberger
0bf9fc9428
Improve plot item UX (#1816)
* initial work

* changelog entry

* fix CI

* Update egui/src/widgets/plot/items/values.rs

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

* Update egui/src/widgets/plot/items/values.rs

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

* derive 'FromIterator'

* remove `bytemuck` dependency again and remove borrowing plot points for now

* update doctest

* update documentation

* remove unnecessary numeric cast

* cargo fmt

* Update egui/src/widgets/plot/items/values.rs

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

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-07-24 17:13:12 +02:00
Emil Ernerfeldt
41f31116ce Layout::left_to_right/right_to_left now takes the valign as argument
Previous default was `Align::Center`.

Closes https://github.com/emilk/egui/issues/1040
Closes https://github.com/emilk/egui/issues/1836
Closes https://github.com/emilk/egui/pull/1837
2022-07-22 11:02:26 +02:00
Emil Ernerfeldt
9f1f0a9038 Add documentation for Layout
Related to https://github.com/emilk/egui/issues/1836
2022-07-22 10:41:14 +02:00
Emil Ernerfeldt
77b4bacdf4 Make widget_text module public
Closes https://github.com/emilk/egui/issues/1756
2022-07-21 20:52:50 +02:00
Sahil Singh
48d48096eb
Add support for ctrl+h as backspace (#1812) 2022-07-21 19:23:24 +02:00
Emil Ernerfeldt
898f4804b7 Enable and fix a bunch more lints 2022-07-11 23:08:48 +02:00
Emil Ernerfeldt
c062bca6ee faster builds: remove tracing-attributes feature from tracing 2022-07-04 00:11:08 +02:00
Barugon
433719717a
Don't call scroll if TextEdit is fully in view (#1779)
* Don't call scroll if TextEdit is fully in view

* Explain why the new logic was added

* cargo fmt

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-07-03 15:43:22 +02:00
Thomas Hansen
cb9bc8698d
Browser Hotkey Conflicts (#1697)
* code hotkey to N, move superscript hotkey to Y

ctrl A S D F G H are all taken, CTRL Q is traditionally to remove formatting and should be reserved for that. CTRL W E R T are also all taken. CTRL Z X C V are taken so all of the first 4/5 keys of each row except Q are inaccessible.

* strike through conflict, update text

* fixed underline command

* added ALTSHIFT, browser documentation

* underline ALTSHIFT Q

it leaves the Q character which is considered a bug but before this pull underline was not working entirely so this is progress

* update text

* ALTSHIFT is treated as a command

* added eighth command, ALTSHIFT+W adds two spaces

* CTRL+Y to toggle case on text_edit demo

* better code

* Revised Menu

* fix dead link

* Update lib.rs

* Update easy_mark_editor.rs

* Update egui/src/data/input.rs

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

* update

* reverted variables used for debugging

* fixed labels hotkey conflict

* comments

* fmt

* cargo fmt

* Nice hotkey menu

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-07-03 15:25:35 +02:00
Yuan Chang
14ae4b24a7
Support rich text convert from cow-string. (#1774) 2022-07-03 15:16:05 +02:00
Sahil Singh
5f364795cc
Add doc example for hint_text persistence (#1776) 2022-07-03 15:15:55 +02:00
Zeenobit
0c65a9df41
Add body_unindented to HeaderResponse (#1731) 2022-07-03 14:57:42 +02:00
Red Artist
935913b1ec
Add Context::request_repaint_after (#1694) 2022-06-22 13:19:13 +02:00
Emil Ernerfeldt
8c7c4c764b
Don't load fonts in doctests (#1711)
I was hoping this would speed up the doctests, but it doesn't really
2022-06-10 14:33:16 +02:00
Emil Ernerfeldt
29973e5d02 Make document-features an opt-in dependency 2022-06-09 17:41:37 +02:00
Cisco
8446665b02
Fix on-hover typo in plot module (#1714) 2022-06-09 15:28:18 +02:00
Emil Ernerfeldt
3169ce62d5
Document feature flags using crate document-features (#1725) 2022-06-09 15:27:22 +02:00
sy1ntexx
f5cca2a288
Added support for 20 fn keys (#1665) 2022-05-23 17:49:48 +02:00
Emil Ernerfeldt
f2dcdfc22c Fix some broken doc links 2022-05-23 17:25:31 +02:00
Emil Ernerfeldt
a29154233b Add support for texture filters in WGPU backend 2022-05-22 17:40:56 +02:00
Zicklag
1a9a0d7ec8
Add the Ability to Specify Egui Texture Filters (#1636)
Only works for egui_glow
2022-05-22 16:56:51 +02:00
Emil Ernerfeldt
f3e305a646 Replace TODO: with TODO(emilk): and update code guidelines 2022-05-21 16:53:25 +02:00
Emil Ernerfeldt
d6fd5dec3b
Add single-threaded deadlock detection to RwMutex (#1619) 2022-05-21 14:08:19 +02:00
Emil Ernerfeldt
810b609a80 clippy fixes 2022-05-21 13:04:58 +02:00
Erlend Walstad
f27f67b76b
Make color-hex optional (#1632) 2022-05-16 16:38:14 +02:00
Stanislav
b008b147e5
Fix Plot auto_bounds when LinkedAxisGroup one axis (#1599)
Co-authored-by: Stanislav <enomado@users.noreply.github.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-05-15 19:27:30 +02:00
Luke Newcomb
d2decfa338
Add ability to convert from a hex string to Color32 using macros (#1596) 2022-05-15 17:07:30 +02:00
Emil Ernerfeldt
2e4138d050
Add InputState::stable_dt (#1625)
This provides a better estimate of a typical frametime in reactive mode.

From the docstring of `stable_dt`:

Time since last frame (in seconds), but gracefully handles the first frame after sleeping in reactive mode.

In reactive mode (available in e.g. `eframe`), `egui` only updates when there is new input or something animating.
This can lead to large gaps of time (sleep), leading to large [`Self::unstable_dt`].

If `egui` requested a repaint the previous frame, then `egui` will use
`stable_dt = unstable_dt;`, but if `egui` did not not request a repaint last frame,
then `egui` will assume `unstable_dt` is too large, and will use
`stable_dt = predicted_dt;`.

This means that for the first frame after a sleep,
`stable_dt` will be a prediction of the delta-time until the next frame,
and in all other situations this will be an accurate measurement of time passed
since the previous frame.

Note that a frame can still stall for various reasons, so `stable_dt` can
still be unusually large in some situations.

When animating something, it is recommended that you use something like
`stable_dt.min(0.1)` - this will give you smooth animations when the framerate is good
(even in reactive mode), but will avoid large jumps when framerate is bad,
and will effectively slow down the animation when FPS drops below 10.
2022-05-12 11:23:53 +02:00
4JX
3d52cc8867
Fix docstring in area.rs (#1620) 2022-05-11 22:44:29 +02:00
sy1ntexx
d850b47f9e
Added Extra1 & Extra2 pointer buttons (#1603)
Extra1 is usually extra back button on most mice & Extra2 is usually extra forward button.
2022-05-11 22:44:00 +02:00