Commit Graph

1104 Commits

Author SHA1 Message Date
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
Emil Ernerfeldt 9624de6c41
Fix dead-lock when alt-tabbing while also showing a tooltip (#1618)
Closes https://github.com/emilk/egui/issues/1609
2022-05-11 20:56:57 +02:00
4JX c47e20c733
Allow manually painting the CollapsingState icon (#1592)
* Allow manually painting the CollapsingState icon

* Update egui/src/containers/collapsing_header.rs

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

* Oops

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-05-11 19:02:37 +02:00
Luke Newcomb e44c9b8e54
Fix image button padding on hover (#1595) 2022-05-11 11:58:15 +02:00
Emil Ernerfeldt 7b18fab7a4
Optimize tessellation of filled circles (#1616)
When painting a scatter plot we sometimes want to paint hundreds of thousands of points (filled circles) on screen every frame.

In this PR the font texture atlas is pre-populated with some filled circled of various radii. These are then used when painting (small) filled circled, which means A LOT less triangles and vertices are generated for them.

In a new benchmark we can see a 10x speedup in circle tessellation, but the the real benefit comes in the painting of these circles: since we generate a lot less vertices, the backend painter has less to do.

In a real-life scenario with a lot of things being painted (including around 100k points) I saw tessellation go from 35ms -> 7ms and painting go from 45ms -> 1ms. This means the total frame time went from 80ms to 8ms, or a 10x speedup.
2022-05-10 19:31:19 +02:00
Nigecat 87ca29173d
Fix typo in ui.rs (waker -> weaker) (#1586) 2022-05-06 10:36:49 +02:00
Alejandro Perea fe6e1ce28f
Add *_released & *_clicked PointerState methods (#1582) 2022-05-05 23:26:15 +02:00
Reilly Moore 1dd014cbed
mark the response of a toggle_value as changed on click (#1573) 2022-05-04 21:45:14 +02:00
Emil Ernerfeldt 32b4781da2
Improve web demo for mobile (#1556)
`egui_demo_app/lib`: add "About egui" window, and improve mobile layout

This makes the app responsive, removing the side bars on mobile and turning them into drop-down menus instead.
2022-05-02 13:13:35 +02:00
Emil Ernerfeldt b30224471c
Release 0.18.1 of egui & epaint - Change `Shape::Callback` to `&mut dyn Any` (#1552) 2022-05-01 11:35:29 +02:00
Emil Ernerfeldt dc26890a80 Release 0.18.0 - Shape::Callback, Table, and better text contrast 2022-04-30 20:27:27 +02:00
Emil Ernerfeldt b41fb585fe Add doclinks to egui_extras::RetainedImage 2022-04-30 18:36:24 +02:00
Emil Ernerfeldt 11e8ffa079 Reduce Plot::show code bloat by adding Plot::show_dyn 2022-04-30 17:51:07 +02:00
Emil Ernerfeldt 003dc4aac9 egui_demo_app: add link to my twitter 2022-04-30 17:50:39 +02:00
Emil Ernerfeldt b137f16472 Make members of `Response` public, but hide documentation
Discourage their direct use, but allow it
2022-04-30 15:49:50 +02:00
Emil Ernerfeldt bb421c7e8a
Remove `egui_web` and `epi` (#1545)
* Remove integration name (it is always eframe)

* Remove egui_web crate

* Move egui_web/CHANGELOG.md into eframe/CHANGELOG.md

* Remove all mentions of egui_web

* Remove epi crate and absorb into eframe

* egui_glow: only use puffin on native

* Remove WASM doc from CI (we don't generate it anyways!)

* Remove eframe::epi and improve eframe docs
2022-04-30 10:44:35 +02:00
Emil Ernerfeldt ed002acc68
Refactor: move things into eframe (#1542)
* Move all epi-related code from egui_glow into eframe

* Move epi stuff from egui-winit into eframe

* Remove mention of epi in egui

* Remove mention of epi in egui_glium

* Remove trait epi::NativeTexture

* Remove confusing mentions of epi

* Refactor egui_web: break up into smaller files

* Clean up feature flags further, and update changelogs

* Clean up check.sh

* Small cleanup of egui_web/Cargo.toml

* Fix dependencies for pure_glow example

* Fix clippy false positive
2022-04-29 08:17:49 +02:00