Commit Graph

241 Commits

Author SHA1 Message Date
Dustin Carlino
9c2c8bbd8f Change some uses of Into<String> to AsRef<str>, to avoid allocations. #253
I manually audited all uses. I kept Into<String> when we really do wind
up storing a String.
2021-03-11 11:29:18 -08:00
Dustin Carlino
f5eca6ff02
Seemingly fix squished loading screens at startup by always using inner_size. (#561) 2021-03-11 09:48:39 -08:00
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
Dustin Carlino
b0bcdb2115
Replace Widget::draw_batch with batch.into_widget, for consistency. #253 (#554) 2021-03-09 08:55:12 -08:00
Dustin Carlino
42bd63e79b Lift URL and viewport code from game to map_gui. Also use it for OSM viewer and the 15min tool. 2021-03-04 13:22:09 -08:00
Dustin Carlino
4d048d83bd A few misc fixes after the grand button/color refactor:
- Always draw traffic signal stage numbers as white, even in day mode
- Always draw loading screen text as white, in any theme
- Double the scrollbar thickness from 4px to 8px (still way thinner than
  the original design)

[rebuild] [release]
2021-02-28 10:31:00 -08:00
Michael Kirk
09c98b99c7
better contrast for primary button when disabled (#548) 2021-02-27 21:11:03 -08:00
Michael Kirk
86799e2832 Remove StyledButtons - instead implement everything on the individual
ButtonStyle
2021-02-27 21:08:26 -08:00
Michael Kirk
703ab1a0e8 inline dark style since we were assigning most of the props via overrides anyway 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
6b35060dbb inline more functionality into ButtonStyle 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
7fe0e521ee Use btn_destructive.* methods instead of btn_destructive_* 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
088e434a0a Revert "Fix too-thin outline of Spinner"
This reverts commit 9dc2b365c8.
2021-02-27 15:29:03 -08:00
Michael Kirk
27b20c45c8 make EdgeInset f64, like other layout
Remove unnecessary casts to f64
2021-02-27 13:14:37 -08:00
Michael Kirk
9dc2b365c8 Fix too-thin outline of Spinner 2021-02-27 13:13:41 -08:00
Michael Kirk
1e75352ce0 Theme section bg
`Widget::outline` takes OutlineStyle
2021-02-27 13:13:41 -08:00
Michael Kirk
73280bc114 consolidate OutlineStyle
We had a lot of constants sprinkled around. This consolidates the
constants and packages the outline thickness and color into a tuple,
making for a (usually) cleaner callsite.
2021-02-27 13:13:41 -08:00
Michael Kirk
300172282b disabled outline/plain buttons should not gain a background 2021-02-27 13:13:41 -08:00
Michael Kirk
2378da9731 theme signal editor bg 2021-02-27 10:30:41 -08:00
Michael Kirk
5f3c914e28 Pad SliderArea so it doesn't overlap neighboring elements
and shrink it down just a bit to be more in scale with other UI
2021-02-26 18:59:19 -08:00
Michael Kirk
bee4989a5d make area slider wider than scrollbars 2021-02-26 18:59:19 -08:00
Michael Kirk
cae7f55ba4 theme slider/scrollbars 2021-02-26 18:59:19 -08:00
Michael Kirk
cf69dd0370 slightly better approach to get the cut-scene looking better 2021-02-26 16:30:14 -08:00
Michael Kirk
bcba72cddf enable new day theme, but retain legacy theme for pregame 2021-02-26 16:30:14 -08:00
Michael Kirk
4b2f3888ed replace btn_solid w/ primary/outline as appropriate 2021-02-26 14:05:19 -08:00
Michael Kirk
6156311576 add btn_primary style 2021-02-26 14:05:19 -08:00
Michael Kirk
143fdc3fd5 label_underlined_text for "link" buttons 2021-02-26 14:05:19 -08:00
Michael Kirk
7e3d8bded9 per design: outline style for dropdowns 2021-02-26 14:05:19 -08:00
Michael Kirk
f5b52073fc shade dropdown/text-fields in night mode
Consistent with other themes, fields in night mode should be distinct
from the panel color, a shade darker.
2021-02-26 14:05:19 -08:00
Michael Kirk
3019a6fff1
Introduce Image component to handle themed icons (#537) 2021-02-25 18:06:19 -08:00
Michael Kirk
46593b01ed theme text field (and fixup layout) 2021-02-25 17:42:04 -08:00
Michael Kirk
6b8211c3ba theme dividers 2021-02-25 17:42:04 -08:00
Dustin Carlino
357ba15afe Add back the zcool font so the Taipei map renders names. But this time, asynchronously load the font instead of bundling it in system assets and increasing the .wasm size. #535
Temporarily take on some technical debt with the new RawFileLoader...
2021-02-25 15:25:47 -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
5d7875d5be theme spinner 2021-02-24 20:17:18 -08:00
Michael Kirk
fc4a4d1071 Fix loading screen legibility
long-term we should probably get all the colors from Style, but until
then just hardcode White text since all other colors are hardcoded.
2021-02-24 20:17:18 -08:00
Michael Kirk
ac30774b06 theme dropdowns and menus 2021-02-24 18:10:06 -08:00
Michael Kirk
c6d361c4b0 remove take_menu 2021-02-24 18:10:06 -08:00
Michael Kirk
9533c10137 Theme switches
The main button API only allows re-writing one color of the image.

Since we need to rewrite multiple colors for the switch, I introduced a
`image_batch` for buttons which lets you do all kinds of manual
fanciness, and pass the result into the button API.
2021-02-24 14:59:47 -08:00
Michael Kirk
f34f6ab315 theme checkbox 2021-02-24 14:59:47 -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
Michael Kirk
1387a8c11f
Text gets default color from Style (#526) 2021-02-23 19:30:50 -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
316dcd7d06
themed buttons (#524)
* cargo fmt

* rename ButtonStyle to ButtonTheme to avoid ambiguity

widgetry::styles::button:ButtonStyle -> ButtonTheme is a collection of
colors

vs. widgetry::widgets::button::ButtonStyle which is a per-state styling
(hover vs. disabled etc.)

* 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.

* rethink rename... keep Style.ButtonStyle, rename button::ButtonStyle->ButtonStateStyle

* btn_solid_panel is the same as btn_solid
2021-02-23 11:49:28 -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