Commit graph

252 commits

Author SHA1 Message Date
Emil Ernerfeldt
b618636425
Add ui.data(), ctx.data(), ctx.options() and ctx.tessellation_options() (#1175)
Helpful access deeper into Memory
2022-01-29 17:53:41 +01:00
Emil Ernerfeldt
3333d63b91
Return more info from ScrollArea::show (#1166) 2022-01-26 22:19:32 +01:00
Emil Ernerfeldt
1134258441 Documentation improvements 2022-01-26 22:09:19 +01:00
Emil Ernerfeldt
1e4d8ae943 Remove warm-up of demo app
Since https://github.com/emilk/egui/pull/1149 we only update the
region of the font atlas that has changes, so loading new glyphs is much
cheaper. This means warm-up is much less needed.

There is now a small delay when opening the font book,
but not when opening anything else.
2022-01-25 01:08:10 +01:00
Jan Haller
366f544655
Formatter for plot axis labels (#1130)
* Fix Orientation not exposed, although there are public fields with its type

* Implement formatters for X/Y axis labels

* Use array instead of separate X/Y formatters

* Swap axis formatters if charts are horizontal

* Review suggestions
2022-01-24 22:34:00 +01:00
Emil Ernerfeldt
fa43d16c41
Choose your own font and size (#1154)
* Refactor text layout: don't need &Fonts in all functions
* Replace indexing in Fonts with member function
* Wrap Fonts in a Mutex
* Remove mutex for Font::glyph_info_cache
* Remove RwLock around Font::characters
* Put FontsImpl and GalleyCache behind the same Mutex
* Round font sizes to whole pixels before deduplicating them
* Make TextStyle !Copy
* Implement user-named TextStyle:s
* round font size earlier
* Cache fonts based on family and size
* Move TextStyle into egui and Style
* Remove body_text_style
* Query graphics about max texture size and use that as font atlas size
* Recreate texture atlas when it is getting full
2022-01-24 14:32:36 +01:00
Emil Ernerfeldt
462f181db3
Partial font texture update (#1149) 2022-01-22 11:23:12 +01:00
Emil Ernerfeldt
76ac41f9b5 WidgetGallery: hide spinner widget to save CPU in reactive mode 2022-01-17 19:57:32 +01:00
Emil Ernerfeldt
39dd6d7644 clippy fixes 2022-01-17 19:57:32 +01:00
Max Wase
5bedf73566
Add a link to the source code of a fractal_clock example (#1029) 2022-01-17 14:30:57 +01:00
Emil Ernerfeldt
b2c8cd0867 Simplify http demo and add new download_image eframe demo 2022-01-15 20:34:03 +01:00
Emil Ernerfeldt
66d80e2519
Texture loading in egui (#1110)
* Move texture allocation into epaint/egui proper
* Add TextureHandle
* egui_glow: cast using bytemuck instead of unsafe code
* Optimize glium painter
* Optimize WebGL
* Add example of loading an image from file
2022-01-15 13:59:52 +01:00
Emil Ernerfeldt
d5673412dd
Put everything in Context behind the same Mutex (#1050)
* Move all interior mutability from Context to CtxRef and make it a handle
* Rename `CtxRef` to `Context`
* The old `Context` is now `ContextImpl` and is non-pub
* Add benchmark Painter::rect

Co-authored-by: Daniel Keller <dklr433@gmail.com>
2022-01-10 23:13:10 +01:00
Emil Ernerfeldt
7863f44111 Add demo of advanced TextEdit usage 2022-01-06 11:53:23 +01:00
LordMZTE
8da592c6ab
Add Spinner widget (#1013)
* add spinner widget

* implement requested changes to spinner

- removed enabled field
- cleaned up math
- improved docs

* improve spinner docs & make spinner in demo always active
2021-12-31 14:32:48 +01:00
Emil Ernerfeldt
84399cde83 Small tweaks to documentation and demo 2021-12-29 10:49:22 +01:00
Emil Ernerfeldt
190c85a40f Rename Texture to FontImage 2021-12-28 21:19:24 +01:00
Emil Ernerfeldt
b7441eeee7
Make epi::Frame cloneable so you can allocate textures in other threads (#999)
Closes https://github.com/emilk/egui/issues/673

Also adds `epi::Image`
2021-12-26 21:21:28 +01:00
Emil Ernerfeldt
d5efa4bbca 1.56 fix: missing_crate_level_docs -> rusdoc::missing_crate_level_docs 2021-12-26 09:56:14 +01:00
Jan Haller
1088d950e9
Add bar charts and box plots (#863)
Changes:
* New `BarChart` and `BoxPlot` diagrams
* New `FloatOrd` trait for total ordering of float types
* Refactoring of existing plot items

Co-authored-by: niladic <git@nil.choron.cc>
2021-11-29 18:39:58 +01:00
Sven Niederberger
9d56bce592
Improved plot interaction methods (#892)
ctx plot_bounds plot_hovered screen_from_plot plot_from_screen etc
2021-11-27 23:59:32 +01:00
Emil Ernerfeldt
8896243146 Fix egui_web integration link in demo app 2021-11-13 13:14:39 +01:00
Emil Ernerfeldt
4d4c75c6f1 Fix vertical slider up/down keys and add a line in the changelog
Follow-up to https://github.com/emilk/egui/pull/875
2021-11-13 12:30:13 +01:00
Bruce Reif (Buswolley)
491739b580
implement vertical slider orientation (#875) 2021-11-13 12:03:10 +01:00
Sven Niederberger
0bad1d0c99
Plot interaction methods (#766)
* move to a basic plot builder with callback
* add some interaction methods
* move interaction demo to its own panel
2021-11-13 11:56:22 +01:00
Emil Ernerfeldt
951ee4e142
Improve color picker cache (#886)
* colorpicker: try to maintain hue even when saturation goes to zero
* More consistent arguments to color types
* implement `Hash` for `Rgba`.
2021-11-07 21:11:42 +01:00
Emil Ernerfeldt
49e43885ff
Replace Context::begin_frame/end_frame with fn run taking a closure (#872)
* Replace Context begin_frame/end_frame with `fn run` taking a closure
* Create `egui::__run_test_ui` to replace `Ui::__test`
* Add helper `egui::__run_test_ctx` for doctests
2021-11-03 20:11:25 +01:00
Emil Ernerfeldt
eda1d91654 Add culling of the painting for most widgets
This is a good early-out for widgets in `ScrollAreas`, but
also prepares for speeding up the first pass of a possible two-pass
version of egui: https://github.com/emilk/egui/issues/843
2021-11-01 22:08:23 +01:00
Emil Ernerfeldt
09b8269326
Rich text for all widgets (#855)
Introduce `RichText` and `WidgetText`
2021-11-01 21:30:10 +01:00
Emil Ernerfeldt
9378cd5c6e ScrollArea: add methods to control horizontal scroll offset
Closes https://github.com/emilk/egui/issues/864
2021-11-01 19:43:27 +01:00
Linus Behrbohm
b9368aba13
Fix Response::context_menu return type (#857) 2021-11-01 19:27:51 +01:00
Emil Ernerfeldt
3819ec6fc7 Update "password" demo (storing widget state) after #836 refactor
https://github.com/emilk/egui/pull/836
2021-10-27 16:40:21 +02:00
Emil Ernerfeldt
c7638ca7f5
Add read/write of TextEdit cursor state (#848)
* Rename `CursorPair` to `CursorRange`
* Easymark editor: add keyboard shortcuts to toggle bold, italics etc
* Split up TextEdit into separate files
* Add TextEdit::show that returns a rich TextEditOutput object with response, galley and cursor
* Rename text_edit::State to TextEditState
2021-10-27 16:30:14 +02:00
Emil Ernerfeldt
8e4fd942a9
Refactor memory data (#836)
This refactors the widget state storage introduced by @optozorax in https://github.com/emilk/egui/pull/257

* Unify the four buckets (`data`, `data_temp`, `id_data` and `id_data_temp`) into a single `data`.
  * Less complexity, and also less chance of error (storing in one bucket, reading from another).
* Store data by `Id` and `TypeId`.
  * Users can thus reuse the same `Id` to store many types.
  * Uses a simple xor of id and typeid, which is fast and good since both id and typeid are already high-entropy hashes.
* Use different suffixes on the functions to pick if you want the data persisted or not (`get_temp`, `insert_persisted`, etc).
  * Writing with one suffix and reading with the other works.
* To store state not bound to a specific `Id` (i.e. only based on type), use the new `Id::null` as the key.
2021-10-27 08:51:34 +02:00
Emil Ernerfeldt
41f77ba7d7 Clean up some of the new context menus
Follow-up to https://github.com/emilk/egui/pull/543

* Add entry to CHANGELOG.md
* Add entry to contributors in README.md
* Improve documentation
* Simplify demo
2021-10-26 20:16:46 +02:00
Linus Behrbohm
46fb9ff09b
Context menus (#543)
Main usage: `response.context_menu(…)` and `ui.menu_button`
2021-10-26 19:55:42 +02:00
Emil Ernerfeldt
c335c56de1 dancing_string demo: handle large input.time
casting time to f32 is a bad idea if the time is seconds since epoch
as it is on some integrations.
2021-10-24 18:38:44 +02:00
Emil Ernerfeldt
17f0ae22c9 Code example demo: remove extra ScrollArea 2021-10-23 15:36:25 +02:00
Emil Ernerfeldt
39c6c7e5c9 Small code cleanup 2021-10-23 06:03:45 +02:00
Emil Ernerfeldt
6185ee8ce4 Demo: add button to reset the demo 2021-10-23 05:50:42 +02:00
Emil Ernerfeldt
d97a369c44 End statements with semicolon (clippy::semicolon_if_nothing_returned) 2021-10-20 16:46:57 +02:00
Emil Ernerfeldt
ab3be8aca3 Use for-loop instead of Iterator::for_each 2021-10-20 16:46:57 +02:00
Emil Ernerfeldt
40445c450c use map_or and map_or_else 2021-10-20 16:46:57 +02:00
Emil Ernerfeldt
a0cd41755e Add more clippy lints 2021-10-20 16:30:39 +02:00
Emil Ernerfeldt
dd5d41d04e Improve backend panel in demo 2021-10-20 13:54:56 +02:00
Emil Ernerfeldt
f025513998
Code example demo (#823) 2021-10-20 12:34:27 +02:00
Emil Ernerfeldt
8178d23d19
Deduplicate code found in both egui_glium and egui_glow (#819)
* Move window building to egui-winit

* Move icon loading to egui-winit

* `use glow::HasContext;` -> `use glow::HasContext as _;`

* Move FileStorage into epi behind a feature flag

* De-duplicate screen_size_in_pixels and native_pixels_per_point

* Move creation of FileStorage to epi

* Handle epi app output (window size changes etc) in egui-winit

* Move app and memory persistence and autosave logic to egui-winit

* fix check.sh

* Make the epi backend opt-in for egui_glium and egui_glow

* Fix persistence

* Add integration name to epi::IntegrationInfo and the demo

* Clean up Cargo.toml files and fix making egui_glium optional

* fix typo

* Make egui_glium compile without the `epi` feature
2021-10-19 21:40:55 +02:00
Emil Ernerfeldt
844dd9d7a4 Remove "seconds_since_midnight" from epi/eframe. Use chrono instead
chrono works both natively and on web.

Related: https://github.com/emilk/egui/issues/212
2021-10-19 15:37:20 +02:00
Emil Ernerfeldt
cdd4dccf5f
Add egui_glow as an opt-in backend to eframe (#817)
* Make egui_glow and opt-in backend for eframe

* Add egui_glow to Cargo.toml and to CI

* Reference egui_glow where egui_glium is mentioned

* Remove path-patches from root Cargo.toml

* Add instructions on how to enable the glow backend of eframe
2021-10-19 15:32:23 +02:00
Emil Ernerfeldt
ebd2c859ac Make multi-touch demo a bit nicer looking 2021-10-18 21:00:25 +02:00