Commit Graph

55 Commits

Author SHA1 Message Date
Dustin Carlino
65d7bc5c8e Rename {Text,TextSpan}::draw to into_widget, for consistency. #253 2021-03-09 09:59:30 -08:00
Dustin Carlino
a4a20ce1e5 draw_text renamed to text_widget, for consistency. #253 2021-03-09 09:56:41 -08:00
Michael Kirk
86799e2832 Remove StyledButtons - instead implement everything on the individual
ButtonStyle
2021-02-27 21:08:26 -08:00
Michael Kirk
11a904a4da WIP: separate style for plain 2021-02-27 21:08:26 -08:00
Michael Kirk
c3985ffdd1 btn_solid -> btn_tab and replace inappropriate uses 2021-02-27 21:08:26 -08:00
Michael Kirk
cee0e5dbbd Use btn_primary.* methods instead of btn_primary_* 2021-02-27 21:08:26 -08:00
Michael Kirk
87a1a3f027 fix outline for spinner (without crashing!) and cache drawable 2021-02-27 15:29:03 -08:00
Michael Kirk
1e75352ce0 Theme section bg
`Widget::outline` takes OutlineStyle
2021-02-27 13:13:41 -08:00
Michael Kirk
4b2f3888ed replace btn_solid w/ primary/outline as appropriate 2021-02-26 14:05:19 -08:00
Dustin Carlino
6bfa569923
Support changing fonts in the middle of a line. Use this to draw numeric (#533)
IDs in the status bar as bold, not red.
2021-02-25 08:57:42 -08:00
Michael Kirk
d774aeae44 rename toggle/checkbox 2021-02-24 14:59:47 -08:00
Michael Kirk
3ab7fc4361
Fix tooltips and hotkey for day-theme (#528) 2021-02-24 10:52:57 -08:00
Dustin Carlino
0344e51170
Merge pull request #525 from a-b-street/prefetch
Make a web loader that can 'prefetch' abst in the background. cyipt/a…
2021-02-23 13:34:55 -08:00
Dustin Carlino
4c97687a5b Make a web loader that can 'prefetch' abst in the background. cyipt/actdev-ui#15 2021-02-23 11:45:39 -08:00
Michael Kirk
e6ed2e67de Collapse button styles to be theme specified (no visible changes).
Button colors are now determined by the color scheme, but for now all
schemes are hardcoded to use the same "night" button colors. Read on for
rationale...

Previously, which button colors to use (dark/light) was specified inline
while building the UI.

Eventually we want to live in a world where color scheme determines:
- panel colors
- button colors
- text colors

The theme could already choose panel colors easily enough, but because
the buttons and text were not determined by theme, choosing anything
other than a black or dark grey panel color makes the buttons and text
unreadable.

This PR tackled the themeable "button colors" portion, but all themes
continue to use the "night" colors for now, because using the actual
"day" colors would still make the text unreadable.

next up: themeable text!

The one intentional regression is within the pregame tutorial,
which has always been styled differently from the rest of the app. An
expeditious hack has caused the prev/next/continue buttons to lose their
visible hover state. I'll restore this upon completing the day theme
work.
2021-02-23 09:52:33 -08:00
Dustin Carlino
3f23a3c57c Remove hotkey buttons entirely, to get closer to Yuwen's button spec. 2021-02-15 13:02:29 -08:00
Michael Kirk
3449d49b6d
WebGL 1.0 support, with automatic fallback for Safari/iOS (#504)
#506
2021-02-06 19:04:43 -08:00
Michael Kirk
3a5e63aaff
More helpful loading screen (#496) 2021-02-04 10:35:31 -08:00
Dustin Carlino
73e405e382 Upgrade most dependencies 2021-02-03 18:13:06 -08:00
Michael Kirk
38dc60fbea
Add method to GeomBatch to prefer cached flavor of loading svg. (#493)
It was my intention when introducing the cached vs uncached flavors that
we'd prefer the cached flavor for anything referencing bytes from a
file, like icons and UI glyphs, and that we'd only use the uncached
flavor for dynamic things like "face" generation.
2021-02-01 16:24:56 -08:00
Michael Kirk
07738d2cef
popup and persistent split to spec (#480)
* introduce "pill" to be explicit about fully rounded, vs a "None" radius

* no-op transition to CornerRadii

* popup button to spec

* restore "fully rounded" layout behavior

* use plain light to better show highlight

* persistent split to spec (for day theme anyway)

* remove night-theme colors for speed panel

* fixup docs for pill

* CR: remove unnecessary `row`

* CR: remove outdated doc

* import order
2021-01-24 15:32:28 -08:00
Michael Kirk
f71176578f stroke for non-colored checkboxes 2021-01-24 10:32:41 -08:00
Michael Kirk
1a3d1b4cdb
reconcile new button styles w/ dark theme (#475) 2021-01-22 21:21:38 -08:00
Michael Kirk
1990642dee More conventional button names
This was all done by search/replace, and should not affect
functionality.

Goals:

- be consistent with the figma terminology.
- consistently order:
  "btn_{solid|outline|plain}_{dark|light}_{text|image|dropdown|back|etc}"
2021-01-22 13:11:42 -06:00
Michael Kirk
1325c115a1 cache SVG's when reasonable. Clarify when they aren't cached. 2021-01-22 09:54:50 -06:00
Michael Kirk
7bc9145ce9 bake-in widgetry assets: image_path -> image_source::{Path, Bytes} 2021-01-22 09:54:50 -06:00
Michael Kirk
f9fdce9637 replace arrow text with arrow image 2021-01-21 15:25:46 -08:00
Michael Kirk
4989887117 remove final references to Btn 2021-01-21 15:25:46 -08:00
Michael Kirk
0a612601ca icon buttons should be same height as text buttons 2021-01-21 09:08:41 -08:00
Michael Kirk
52880c68d8 replace Btn::custom in switch and checkboxes
(also add SVG checkboxes!)
2021-01-21 09:08:41 -08:00
Michael Kirk
5b6c88d3b4
more button progress and fixups (#465)
* replace Btn::txt with new ButtonBuilder styles

* fixup! replace Btn::text_bg1 with ButtonBuilder (btn_primary_light)
2021-01-20 14:11:28 -08:00
Michael Kirk
d7445d889e
button revamp groundwork (#459) 2021-01-19 10:10:18 -08:00
Dustin Carlino
cd7dca87d7 Fix web build after rand upgrade. Unfortunately I think this has to happen in all of the binary crates individually: https://docs.rs/getrandom/0.2.1/getrandom/#indirect-dependencies 2021-01-05 11:12:03 -08:00
Dustin Carlino
bfa208ce6a Parameterize widgetry on a way to read SVG files. This is one of the last steps to remove the dependency on abstio. #253 2021-01-04 09:53:24 -08:00
Dustin Carlino
d529ae2e5c Upgrade usvg and rand 2021-01-04 09:19:54 -08:00
Dustin Carlino
2945913fb3 Upgrade rand 2021-01-03 19:48:03 -08:00
Dustin Carlino
16392a461f Refactor: GeomBatch::load_svg directly takes EventCtx or GfxCtx. The prerender struct should ultimately not be exposed outside of widgetry. 2020-12-15 11:44:58 -08:00
Dustin Carlino
02dd3613cd Refactor: Rename txt.render_to_batch to txt.render_autocropped, and make
it take EventCtx or GfxCtx
2020-12-15 11:35:40 -08:00
Dustin Carlino
58b6c66c2b Consolidate console_log setup into abstutil, now that there are multiple binaries that should all have the behavior. 2020-11-26 14:40:05 -08:00
Dustin Carlino
abf3dbc859 Don't specify a widgetry backend by default; force every user to set the feature explicitly. 2020-11-22 18:35:03 -08:00
Dustin Carlino
aa966d7533 Upgrade a bunch of dependencies 2020-11-11 12:02:53 -08:00
Dustin Carlino
e3b9c42506 Refactor: panel.replace() will set the same name on the new element 2020-11-10 11:49:55 -08:00
Dustin Carlino
5862835196 Fix content type on the html web runner page. Without this, initially
loading jumped to >30s with a warning in the console. Back to the usual
few seconds with this fix.
2020-10-31 18:37:46 -07:00
Michael Kirk
b1f4ca0b1b
loading screen (#373)
fancy loading screen
2020-10-29 18:39:51 -07:00
Dustin Carlino
3ed7e73aa8 Use a u64 RNG seed, not a u8 2020-10-29 09:25:07 -07:00
Dustin Carlino
3b838c1225 Finish formatting distance/duration/speed units nicely. And remove the
number of lanes from trip info; it's misleading and not useful. #331
2020-10-28 11:33:48 -07:00
Dustin Carlino
c2b6c917ae Generalize the State/Transition GUI structure, moving it into widgetry.
Nothing about it is specific to A/B Street, and other apps built with
widgetry could organize themselves as a stack of states. This is also a
first step towards sharing more common code between A/B Street and a
future OSM viewer.

Mostly mechanical change. Some more cleanup / documentation coming up
next.
2020-10-22 17:34:59 -07:00
Dustin Carlino
035b8ee96f Fix alpha colors on the web by making the background canvas black instead of white. https://webglfundamentals.org/webgl/lessons/webgl-and-alpha.html has other workarounds, but I can't figure out how to control the webgl context parameters.
Also improve the loading message that appears before wasm has taken
over.
2020-10-21 10:50:40 -07:00
Dustin Carlino
af70904377 Document as much of geom as I can before my battery dies. And a mechanical API changes, Angle::new_degs -> Angle::degrees 2020-10-19 19:55:05 -05:00
Dustin Carlino
64bc4ee318
On the web, load different maps by making asynchronous HTTP calls. #21 (#364)
* On the web, load different maps by making asynchronous HTTP calls. #21

This is a very strange, specializd approach; it's unclear how it'll
generalize to reading scenarios and prebaked results. Ideally we could
call abstutil::read_binary as we currently do and somehow hide this async
trickery underneath, but I'm not sure how yet. In the meantime, this
moves us forward with the hack well-contained.

Next steps for web: stop bundling in all of data/system in the .wasm,
now that we can load from HTTP.
2020-10-08 10:51:13 -07:00