Commit graph

22 commits

Author SHA1 Message Date
Wayne Warren
2d6ca4265f egui_extras: minor indexing fix, address PR feedback 2022-04-03 20:51:27 -06:00
Wayne Warren
b82fc89462 egui_extras: rename TableBody::delta to TableBody::y_progress 2022-04-03 20:26:50 -06:00
Wayne Warren
51a98d586b egui_extras: fix row indexing 2022-04-03 20:03:11 -06:00
Wayne Warren
7706a91974 egui_extras: add heterogeneous_rows example 2022-04-03 12:11:12 -06:00
Wayne Warren
2f22f41185 egui_extras: cleanup TableBody.heterogeneous_rows a little
* use f64 when accumulating virtual height above and below visible
  region
* break the big loop iterating over heights into three loops, one for
  each non-visible region, and one for the visible region
* retain each row's stripe color using an enumeration over the given
  heights iterator
* use a VIRTUAL_EXTENSION constant to extend the "visible" region of the
  table above and below the actual visible region to provide the
  illusion of rows sliding into and out of sight
2022-04-03 12:00:27 -06:00
Wayne Warren
c2df572dd1 egui_extras: add comments to new TableBody methods 2022-04-03 11:25:38 -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
c029f25c13 Table: don't allow resize of last column if it is Size::Remainder 2022-04-01 14:44:25 +02:00
Emil Ernerfeldt
51cc9c9a9a Table: fix bug with item spacing 2022-04-01 14:43:43 +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
41b178b6ec
Use atomic_refcell instead of parking_lot for wasm32 targets (#1404)
Closes https://github.com/emilk/egui/issues/1401
2022-03-22 15:34:21 +01:00
Emil Ernerfeldt
15254f8235
Remove the single_threaded/multi_threaded feature flags (#1390)
Always use parking_lot for mutexes, i.e. always be multi-threaded.

Closes #1379
2022-03-21 22:20:37 +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
510cef02ca Run a formatter on all toml files 2022-03-10 14:25:33 +01:00
Colin Terry
d4bbea3967
egui_extras README grammar fixes (#1313) 2022-03-07 10:14:00 +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
c5a9421dbd
Run wasm-bindgen in CI and update parking_lot (#1293)
* Run wasm-bindgen in CI
* Update parking_lot 0.11 -> 0.12
2022-02-22 16:30:42 +01:00
Emil Ernerfeldt
c3fc8997d6
Introduce egui_extras with RetainedImage for loading svg,png,jpeg,… (#1282) 2022-02-21 15:26:26 +01:00