a-b-street / a-b-street/abstreet

widgetry cleanups

未關閉
#253 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
widgetry
主要語言
Rust
星號
8.2k
分支
380
PR 合併指標
30 天內沒有已合併 PR

描述

It'd be useful to clean up and separately publish crates for `geom` and `ezgui` (and rename it `widgetry`). A running list of some of the things that need to be fixed:

- [X] DPI scaling. `get_scale_factor` should be an internal detail; client code shouldn't care.
- [x] The dependency on `abstutil`. This has become a mess of different stuff; I don't think separate crates should depend on it at all, as a way to start paring it down. The biggest thing is probably `Timer`, because of the `ctx.loading_screen` magic.
- [x] Figure out how library users should supply font files. Do we keep baking them in? Since they're separate files, and part of the promise of the framework is easy WASM, should part of `abstutil` (the bit that reads from the normal filesystem, does `include_dir` for wasm, or maybe in the future actually manages to do xmlhttprequests) be included?
- [x] Pull in `State` and `Transition` from `game`. This abstraction is generally useful for anyone. (But should it stay optional, build your own layers?)
- [x] Rename `Composite`? What do normal UI frameworks call this? Maybe `Panel`?
- [ ] Rethink `Outcome`. Maybe parameterize on an enum sometimes. Maybe also have cases to indicate a checkbox or dropdown or something else changed.
- [ ] Lock down the APIs of `EventCtx`, `GfxCtx`, `Prerender`, etc.
- [X] Some better way of making `Btn::custom`s, that would allow for making the entire trip panel header clickable. Use current `Widget` layouting controls to describe a bunch of geometry, then turn the whole thing into one `GeomBatch`.
- [ ] Nested `Composites`? `PersistentSplit`, `Spinner`, and `Autocomplete` are manually doing layouting.

A backlog of stuff to deal with later:

- [ ] Make `Canvas` just another widget. This unlocks vague ideas like split-screen A/B testing.
- [ ] Make inner widgets scrollable, not just the outermost Composite
- [ ] There are some half-baked tools like `Lasso` in `game` that should be fixed up and made into general tools included
- [ ] Possibly tease apart pieces of the library into separately usable layers. For example, all of the geometry and drawing is pretty independent of screen-space widgets, Composites, etc.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。