Commit graph

336 commits

Author SHA1 Message Date
Wayne Warren
91d78fa2e9 egui_extras: clean up virtual scroll table demo settings a little 2022-04-03 20:02:50 -06:00
Wayne Warren
1c5f93322d egui_extras: restore TableBody::row example 2022-04-03 12:16:23 -06:00
Wayne Warren
44bd8c1cc4 egui_extras: follow closure-based conventions for TableBody.heterogeneous_rows 2022-04-03 11:18:18 -06:00
Wayne Warren
ab4930fde7 egui_extras: make number of rows in table demo configurable 2022-04-03 10:59:10 -06:00
Wayne Warren
e81a92d32d egui_extras: enable virtual scroll for heterogenous rows
Introduce `TableBody.heterogenous_rows` and `TableRowBuilder`, the former of which takes as an argument the latter. `TableRowBuilder` provides two methods that enable virtual scrolling for rows with non-uniform heights. Those methods are:

* `TableRowBuilder.row_heights` which returns an iterator over `f32` to allow incremental virtual scroll buffer calculation.
* `TableRowBuilder.populate_row` which `TableBody.heterogenous_rows` uses to allow `TableRowBuilder` implementations to, you guessed it, populate rows that are visible.

One thought that occurs to me while writing this description is that
`TableBody.heterogenous_rows` could look more like the following:

```
    pub fn heterogenous_rows(
        mut self,
        row_heights: impl Iterator<Item = f32> + '_,
        mut row: impl FnMut(usize, TableRow<'_, '_>),
    )
```

This could potentially be easier to use, considering all the trouble I had coming up with and implementing the trait. Happy to make this change if the maintainers prefer.
2022-04-03 00:18:17 -06:00
Emil Ernerfeldt
5dff1e42c6
More table improvements (#1440)
* Clip by default
* Fix some spacing bugs
* datepicker: look nicer in light mode
* datepicker: show month names
* Table: don't allow resize of last column if it is Size::Remainder
2022-04-01 15:27:42 +02:00
Emil Ernerfeldt
21c32a18d8
Table resize (#1438)
* Let 1D strips fill up parent width/height
* Add Strip + Table + DatePicker to egui_extras changelog
* Expose some dragging- and pointer related context/memory methods
* Make tables resizable
2022-04-01 12:01:00 +02:00
René Rössler
1d32670cf3
Dynamic sized strips, tables, and date picker (#963) 2022-03-31 21:13:25 +02:00
Emil Ernerfeldt
8f178fa4e0
Add glow::Context to epi::Frame (#1425)
This can be used, for instance, to:

* Render things to offscreen buffers.
* Read the pixel buffer from the previous frame (glow::Context::read_pixels).
* Render things behind the egui windows.
2022-03-27 15:20:45 +02:00
Emil Ernerfeldt
b7ebe16cfb
Storage and frame refactor (#1418)
The purpose of this is to expose `frame.storage()` and `frame.storage_mut()` so users can save/load app state from the `App::update` function, without having to add another parameter to that function.

Changes:
* Added `Frame::storage()` and `Frame::storage_mut()`
* `App::update` now takes a `&mut Frame` rather than just `&Frame`
* `Frame` is no longer `Clone` or `Sync` (doesn't have to be since https://github.com/emilk/egui/pull/1366)
2022-03-25 21:19:31 +01:00
Emil Ernerfeldt
bcddafb505 Add a some fine lines to the color test to test anti-aliasing 2022-03-23 13:31:38 +01:00
Emil Ernerfeldt
1387d6e9d6
Refactor TessellationOptions to expose slider for feathering size (#1408)
The epaint tessellator uses "feathering" to accomplish anti-aliasing. This PS allows you to control the feathering size, i.e. how blurry the edges of epaint shapes are.

This changes the interface of Tessellator slightly, and renames some options in TessellationOptions.
2022-03-23 11:41:38 +01:00
Emil Ernerfeldt
5c68edbb15 Clippy fixes 2022-03-21 22:14:25 +01:00
Emil Ernerfeldt
339b28b470 Add Frame::outer_margin, and rename Frame::margin to Frame::inner_margin 2022-03-21 21:44:52 +01:00
Emil Ernerfeldt
fda8189cba
Move lints list to .carg/config.toml (#1394)
That way they apply to all crates equally.

See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why.
2022-03-21 16:54:29 +01:00
Emil Ernerfeldt
ccbddcfe95 Add example of how to move text cursor in a TextEdit 2022-03-20 23:08:19 +01:00
jean-airoldie
734d4c57ad
Expose more epaint tessellator methods (#1384)
* Expose more tessellator method

* Make public the Tessellator methods to tessellate a circle, a
    mesh, a rectangle, a line, a path, a quadratic and cubic
    bezier curve.
* Add doc to tessellate_text.
* Add Mesh::append_ref method.

* Make tessellate_text take a reference

* Fix breaking change in benchmark
2022-03-20 20:38:48 +01:00
Emil Ernerfeldt
465c96122c
egui_web: by default, use full web browser size (#1378)
* egui_web: by default, use full web browser size

Closes https://github.com/emilk/egui/issues/1377

* Remove max_size_points from demo app
2022-03-19 13:47:30 +01:00
Emil Ernerfeldt
c8f6cae362
eframe app creation refactor (#1363)
* Change how eframe apps are created
* eframe: re-export epi::* so users don't need to care about what epi is
2022-03-16 15:39:48 +01:00
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
Emil Ernerfeldt
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
mbillingr
cd555e07b8
Fix typo: Highligher -> Highlighter (#1346) 2022-03-10 08:14:06 +01:00
Emil Ernerfeldt
a05520b9d3 Release 0.17.0 - Improved font selection and image handling 2022-02-22 19:32:30 +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
476a3057b0 egui_demo_lib: make egui_extras an optional dependency 2022-02-21 16:10:16 +01:00
Emil Ernerfeldt
ddf914b517
Update crates (#1283)
* Update rfd 0.8 -> 0.8

* Update webbrowser 0.5 -> 0.6

* Update unicode_names2 0.4 -> 0.5

* cargo update

    Updating crates.io index
      Adding arrayvec v0.7.2
    Updating async-lock v2.4.0 -> v2.5.0
    Updating autocfg v1.0.1 -> v1.1.0
    Updating cc v1.0.72 -> v1.0.73
    Updating cfg-expr v0.9.1 -> v0.10.1
    Updating core-foundation v0.9.2 -> v0.9.3
    Updating crc32fast v1.3.1 -> v1.3.2
    Updating crossbeam-epoch v0.9.6 -> v0.9.7
    Updating crossbeam-utils v0.8.6 -> v0.8.7
    Updating deflate v0.9.1 -> v1.0.0
    Removing encoding v0.2.33
    Removing encoding-index-japanese v1.20141219.5
    Removing encoding-index-korean v1.20141219.5
    Removing encoding-index-simpchinese v1.20141219.5
    Removing encoding-index-singlebyte v1.20141219.5
    Removing encoding-index-tradchinese v1.20141219.5
    Removing encoding_index_tests v0.1.4
    Updating enum-map v2.0.1 -> v2.0.2
    Updating futures-core v0.3.19 -> v0.3.21
    Updating futures-io v0.3.19 -> v0.3.21
    Updating futures-sink v0.3.19 -> v0.3.21
    Updating futures-task v0.3.19 -> v0.3.21
    Updating futures-util v0.3.19 -> v0.3.21
    Updating gio-sys v0.15.4 -> v0.15.6
    Updating glib-sys v0.15.4 -> v0.15.6
    Updating gobject-sys v0.15.1 -> v0.15.5
    Updating image v0.24.0 -> v0.24.1
    Updating kurbo v0.8.0 -> v0.8.3
    Updating libc v0.2.117 -> v0.2.119
    Updating memmap2 v0.5.2 -> v0.5.3
      Adding miniz_oxide v0.5.1
      Adding ndk-context v0.1.0
    Removing ndk-glue v0.5.0
    Removing ndk-glue v0.6.0
      Adding ndk-glue v0.5.1
      Adding ndk-glue v0.6.1
    Updating ntapi v0.3.6 -> v0.3.7
    Updating png v0.17.2 -> v0.17.3
    Updating proc-macro-crate v1.1.0 -> v1.1.2
    Updating rand v0.8.4 -> v0.8.5
    Removing rand_hc v0.3.1
    Updating rustls v0.20.2 -> v0.20.4
    Updating semver v1.0.4 -> v1.0.5
    Updating serde_json v1.0.78 -> v1.0.79
    Updating system-deps v6.0.1 -> v6.0.2
    Updating tracing v0.1.30 -> v0.1.31
    Updating tracing-subscriber v0.3.7 -> v0.3.9
    Updating tts v0.20.2 -> v0.20.3
    Removing windows v0.30.0
    Removing windows_aarch64_msvc v0.30.0
    Removing windows_i686_gnu v0.30.0
    Removing windows_i686_msvc v0.30.0
    Removing windows_x86_64_gnu v0.30.0
    Removing windows_x86_64_msvc v0.30.0
2022-02-21 15:40:25 +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
0fa4bb9c64 Clean up all Cargo.toml: put features higher, and document them better 2022-02-05 11:11:15 +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