Commit graph

277 commits

Author SHA1 Message Date
Emil Ernerfeldt
c768d1d48e
Context::request_repaint will wake up the UI thread (#1366)
This adds a callback (set by `Context::set_request_repaint_callback`)
which integration can use to wake up the UI thread.

eframe (egui_web and egui_glow) will use this, replacing
`epi::Frame::request_repaint`.

Existing code calling `epi::Frame::request_repaint` should be changed
to instead call `egui::Context::request_repaint`.

This is the first callback added to the egui API, which otherwise is
completely driven by data.

The purpose of this is to remove the confusion between the two
`request_repaint` methods (by removing one). Furthermore, it makes
`epi::Frame` a lot simpler, allowing future simplifications to it
(perhaps no longer having it be `Send+Sync+Clone`).
2022-03-15 17:21:52 +01:00
Emil Ernerfeldt
6aee4997d4
Add Shape::Callback to do custom rendering inside of an egui UI (#1351)
* Add Shape::Callback to do custom rendering inside of an egui UI
* Use Rc<glow::Context> everywhere
* Remove trait WebPainter
* Add glow::Context to epi::App::setup
2022-03-14 13:25:11 +01:00
Emil Ernerfeldt
002158050b
Add Frame::canvas - bright in bright mode, dark in dark mode (#1362)
and use it in the demo app
2022-03-14 12:33:17 +01:00
Emil Ernerfeldt
50539bd31a
egui_web: always use the glow painter, and remove the old WebGL code. (#1356)
* egui_web: always use the glow painter, and remove the old WebGL code.
* Clean up the WebPainter trait
* Clarify WebGL1 warning text in color test

The glow painter became standard in egui 0.17, and I've heard no complaints! So let's simplify and go all in on glow.

Part of https://github.com/emilk/egui/issues/1198
2022-03-11 19:15:06 +01:00
mbillingr
cd555e07b8
Fix typo: Highligher -> Highlighter (#1346) 2022-03-10 08:14:06 +01:00
Emil Ernerfeldt
83225f46ad Make Bézier demo more compact 2022-02-22 19:12:21 +01:00
Emil Ernerfeldt
31d324932c
Introduce egui::FullOutput, returned from Context::run (#1292)
* Introduce `egui::FullOutput`, returned from `Context::run`
* Rename `Output` to `PlatformOutput`
2022-02-22 17:13:53 +01:00
Emil Ernerfeldt
8f887e2ebd Add Shape::visual_bounding_rect() 2022-02-21 21:46:30 +01:00
Emil Ernerfeldt
fd3fb726c1 Fix bugs in consume_key and improve Modifiers API
Improvements and fixes following https://github.com/emilk/egui/pull/1212
2022-02-21 16:53:41 +01:00
Emil Ernerfeldt
b360dffdbf Demo app: handle the case of wrong selected anchor 2022-02-21 15:29:18 +01:00
Emil Ernerfeldt
c3fc8997d6
Introduce egui_extras with RetainedImage for loading svg,png,jpeg,… (#1282) 2022-02-21 15:26:26 +01:00
Emil Ernerfeldt
10634fc344 Improve the Bézier demo: drag control points and simplify code
Follow-up to https://github.com/emilk/egui/pull/1178
2022-02-19 20:46:44 +01:00
Urho Laukkarinen
6abdde0334
Add more source code links to demos (#1260) 2022-02-17 17:08:13 +01:00
Emil Ernerfeldt
b5c8f034e7
Add web location info to egui_web/epi (#1258)
This adds all parts of the web "location" (URL) to frame.info().web_info, included a HashMap of the query parameters, percent-decoded and ready to go.

This lets you easily pass key-value pairs to your eframe web app.
2022-02-17 16:46:43 +01:00
cat-state
c1569ed0d7
Add Ui.input_mut & InputState.ignore_key (#1212) 2022-02-15 17:14:24 +01:00
Sven Niederberger
8f8eb5d4a9
Customize Plot label and cursor texts (#1235)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-02-15 17:12:29 +01:00
Juan Campa
635c65773d
Allow scroll into view without specifying an alignment (#1247)
* Allow scroll into view without specifying an alignment
* Handle case of UI being too big to fit in the scroll view
2022-02-15 16:52:29 +01:00
Alexander
62504fface
Slider: Add step parameter (#1225)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-02-13 21:55:51 +01:00
Emil Ernerfeldt
55067f54ce Demo app fix: respect native pixels_per_point on startup 2022-02-05 23:54:44 +01:00
Manuel Innerhofer
7d41551913
Fixed typos: wether -> whether (#1210)
Co-authored-by: mir <mir@wisdomtag.com>
2022-02-05 18:14:16 +01:00
Emil Ernerfeldt
9ed96155e9 Rename corner_radius to rounding
Also update changelogs and clean up other aspects of
https://github.com/emilk/egui/pull/1206
2022-02-05 18:13:46 +01:00
Emil Ernerfeldt
47038c631e Update image 0.23 -> 0.24 2022-02-04 13:31:06 +01:00
nongiach
869d556335
Plot boxed zoom with secondary mouse button (#1188) 2022-02-02 16:32:46 +01:00
Xu Desheng
1f03f53dc0
Add Bezier Shapes #1120 (#1178) 2022-01-31 20:26:31 +01:00
Sven Niederberger
4e99d8f409
Plot: Linked axis support (#1184) 2022-01-31 20:18:10 +01:00
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