Commit Graph

298 Commits

Author SHA1 Message Date
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
Michael Kirk
657887e90f stray mut 2021-02-23 11:32:20 -08:00
Dustin Carlino
8bee003808 Fix a few stray warnings from rustc, and improve a panic error message when data/system gets unexpected directory names 2021-02-23 11:16:43 -08:00
Michael Kirk
62a433ed8d btn_solid_panel is the same as btn_solid 2021-02-23 10:17:49 -08:00
Michael Kirk
dde3ca9f67 rethink rename... keep Style.ButtonStyle, rename button::ButtonStyle->ButtonStateStyle 2021-02-23 09:56:58 -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
Michael Kirk
cfaf441b89 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.)
2021-02-23 07:24:48 -08:00
Dustin Carlino
ecf7c0c836
On HiDPI screens with low resolution, allow widgetry applications to (#521)
* On HiDPI screens with low resolution, allow widgetry applications to
override the default scale factor in order to achieve a minimum width.
2021-02-22 15:59:57 -08:00
Dustin Carlino
b11cd48fb3 On the web, constantly update the --cam param in the URL with the current viewport. 2021-02-20 11:10:14 -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
Dustin Carlino
0f1c30a889 Exclude collisions.bin from KML viewer; it's not KML anymore.
And fix a crash on the challenges screen by not considering the actions
of inactive buttons to count as duplicates.
2021-02-13 17:06:06 -08:00
Dustin Carlino
6e7a91ada1 Upgrade to Rust 1.50. Use the new f64 clamp instead of our own. [rebuild] 2021-02-11 10:32:13 -08:00
Michael Kirk
4b665c871d
update geo related deps. (#508)
geo-types to 0.7
geo to 0.17 which removes redundant old geo used by polylabel
geojson to 0.22
2021-02-08 16:34:56 -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
Dustin Carlino
3a7f39a6da Downsample points on a line-series plot for drawing. Otherwise, the arrivals plot on a border intersection in downtown winds up with more than 2^16 points. 2021-02-04 11:27:57 -08:00
Dustin Carlino
fd423439b8 Upgrade tokio, hyper, and lru 2021-02-03 18:33:06 -08:00
Dustin Carlino
73e405e382 Upgrade most dependencies 2021-02-03 18:13:06 -08:00
Dustin Carlino
eebe7a098a Start a UI with some sliders for tuning existing params of route cost functions. No effect yet. #494 2021-02-02 14:39:39 -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
Dustin Carlino
3e40686a6b Fix a bunch of links after the repository renaming. 2021-01-31 15:50:48 -08:00
Dustin Carlino
8f0c027bb0 Fix critical bug causing a crash only in the .zip releases, where widgetry icons aren't present relative to the data/ directory. 2021-01-30 14:20:28 -08:00
Dustin Carlino
16124f3f3b Include the vertical scrollbar when calculating panel size for horizontal alignment. Fixes #484 2021-01-28 10:31:47 -08:00
Dustin Carlino
e306a48994 Fix prev/next buttons on the trip table; the keybindings got inverted during the refactor. 2021-01-27 08:57:47 -08:00
Dustin Carlino
cbf0763327 Move 3 SVGs into widgetry icons, bundling them into the build. Discovered these missing by updating https://github.com/dabreegster/streetcad 2021-01-26 14:18:41 -08:00
Dustin Carlino
56101addcf Remove the zcool font and Xi'an import. #377
The Xi'an map isn't being regularly used, and it has some issues
(boundary is too large, OSM is missing buildings in most of the area).

The zcool font enables Chinese characters to render, but costs 6MB in
the binary files, slowing down wasm loading time. Eventually, we can
support async loading fonts and passing them to widgetry when loading a
map requiring them. For now, cutting down wasm size is a bigger
priority.

game wasm from 18MB to 12MB. Not bad!
2021-01-24 20:30:20 -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
Dustin Carlino
ab801b8ae1 Vertically line up the header for layer panels. 2021-01-24 13:23:30 -08:00
Dustin Carlino
7d8c818eea Remove the last traces of the old orange hovering color. 2021-01-24 13:09:37 -08:00
Michael Kirk
f71176578f stroke for non-colored checkboxes 2021-01-24 10:32:41 -08:00
Michael Kirk
8211329c6f more contrast in hotkey color 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
Dustin Carlino
4446d99fad Merge branch 'mkirk/btn-fix' of https://github.com/michaelkirk/abstreet into michaelkirk-mkirk/btn-fix 2021-01-22 21:13:13 -08:00
Michael Kirk
3855f284b8 Fix hotkey conflict
Even though we *usually* want these hotkeys for next/prev, sometimes we
don't, and the damage of forgetting to add them to a new pager is less
than the damage done if we forget to remove them and clobber something
important like the speedup/slowdown controls.
2021-01-22 15:31:33 -06: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
8579add567 better docs 2021-01-22 10:23:50 -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
202aec77cf cleanup with include_labeled_bytes! 2021-01-22 09:54:50 -06:00
Michael Kirk
4e48de6185 compile in asset bytes for widgetry assets 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
Dustin Carlino
dc19d11f64 Make the file management menu in edit mode occupy the center of the screen. 2021-01-21 15:36:21 -08:00
Michael Kirk
79b9d9f961 fix checkbox color for Info > Traffic > "Show before {}" 2021-01-21 15:25:46 -08:00
Michael Kirk
882de86661 Maybe fix weird toggle background 2021-01-21 15:25:46 -08:00
Michael Kirk
e10a8bd2a3 proper its 2021-01-21 15:25:46 -08:00
Michael Kirk
f9fdce9637 replace arrow text with arrow image 2021-01-21 15:25:46 -08:00
Michael Kirk
f218d72390 docs 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
de527bc9d8 remove unused imports 2021-01-21 15:25:46 -08:00
Michael Kirk
1f75145a8a introduce btn_next/btn_prev, parameterize disabled to simplify common usage 2021-01-21 15:25:46 -08:00
Michael Kirk
bfb190a730 manually update remaining Btn::text_bg2 2021-01-21 15:25:46 -08:00
Michael Kirk
a5b6dca62a replace Btn::text_bg2 w/ regex
In case I have to revisit, here's the regex I used:
    Btn::text_bg2\(([^)]*)\)*.build_def\(ctx, ([^()]*)\)
    ctx.style().btn_primary_dark_text($1).hotkey($2).build_def(ctx)

And something like this for the "no hotkey" case
    Btn::text_bg2\(([^)]*)\)*.build_def\(ctx, None\)
    ctx.style().btn_primary_dark_text($1).build_def(ctx)
2021-01-21 15:25:46 -08:00
Michael Kirk
652c35b220 replace Btn::text_bg 2021-01-21 15:25:46 -08:00
Michael Kirk
54e937408a remove remaining Btn::plaintext 2021-01-21 15:25:46 -08:00
Michael Kirk
3febbf2f81 destructive primary for destructive action 2021-01-21 15:25:46 -08:00
Michael Kirk
0f476b6a36 pagination uses icon button 2021-01-21 15:25:46 -08:00
Michael Kirk
fc6c18e608 replace Btn::SVG 2021-01-21 15:25:46 -08:00
Michael Kirk
69e31029ac replace Btn::svg_def 2021-01-21 15:25:46 -08:00
Michael Kirk
ea39fecf03 replace Btn::pop_up 2021-01-21 15:25:46 -08:00
Michael Kirk
4e5443683b CR: remove unused method 2021-01-21 09:08:41 -08:00
Michael Kirk
0a612601ca icon buttons should be same height as text buttons 2021-01-21 09:08:41 -08:00
Michael Kirk
c013c8d342 replace remaining Btn::custom 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
11ffef5716 replace Btn::text_bg1 with ButtonBuilder (btn_primary_light) 2021-01-19 17:40:35 -08:00
Michael Kirk
e1ec69f9f7 Replace Btn::plaintext_custom with new ButtonBuilder 2021-01-19 17:40:35 -08:00
Michael Kirk
def3644eca add "destructive" (red) button styles 2021-01-19 17:40:35 -08:00
Michael Kirk
743b74510d
replace Btn::close with new style (#463) 2021-01-19 16:17:11 -08:00
Michael Kirk
d7445d889e
button revamp groundwork (#459) 2021-01-19 10:10:18 -08:00
Michael Kirk
356a64ec87 rename INVISIBLE -> CLEAR
easier to type name
2021-01-16 21:16:14 -08:00
Michael Kirk
bbe94537ef impl Debug for GeomBatch 2021-01-16 21:16:14 -08:00
Michael Kirk
a8cbda24e3 Copy/Clone/Debug/PartialEq for EdgeInsets
At the moment I just needed Debug, but these others seem likely.
2021-01-16 21:16:14 -08:00
Dustin Carlino
92423ef932 Fix previous change -- forgot to move a draw call into the conditional. For some reason, the problem is only reproducible in release mode on S3, not when serving locally.
Ahhh typo in the URL -- it happens when specifying a bad map name.
2021-01-11 16:02:50 -08:00
Dustin Carlino
556a8345bf Sometimes loading a map on the web tries to draw the previous state when the stack only has one. Not totally sure why, but avoid crashing. 2021-01-11 15:21:27 -08:00
Dustin Carlino
fea3ebbe5b Change the city picker UI to show cities on the left. After clicking one, open up the overview for that city. 2021-01-08 15:51:22 -08:00
Dustin Carlino
82c1495cc4 Seemingly fix the first screenshot of some maps by double drawing the first tile. Not sure what the problem is or why this appears to fix it. 2021-01-07 20:22:27 -08:00
Dustin Carlino
65b2b581fa Attempt to take many screenshots of one map at different zoom levels for Leaflet. Various bugs, but progress. #440 2021-01-06 16:33:53 -08:00
Dustin Carlino
5b4a689125 Initial steps to internally refactor buttons. Name action/label/tooltip
consistently.
2021-01-06 11:07:24 -08:00
Dustin Carlino
92be9c57ed Optionally tile screenshots at smaller dimensions than the window. #440 2021-01-06 10:52:22 -08:00
Dustin Carlino
4cf133cc32 Make the new screencaps preserve alpha properly by switching to
premultiplied alpha. See option 1 of
https://stackoverflow.com/a/24380226

Upload the "new" screenshots (and lakeslice map)!
2021-01-05 18:28:30 -08:00
Dustin Carlino
7f0cdace5a Use OpenGL to take screenshots instead of scrot. Benefits:
- Simple -- one OpenGL call and feeding to the awesome image crate
- Faster -- seemingly don't need the sleep() for whatever vsync problems
- Portable -- doesn't use the Linux scrot tool
- I can switch windows and wiggle the cursor with impunity while this runs

One disadvantage: screencaps in S3 are now slightly larger PNGs, because
for some reason, the image/gif feature is super slow, even in release
mode.

For now, this makes the process of screenshot diffing map changes
easier. But it also might help with producing raster tiles for Leaflet. #440

Also, had to regenerate lakeslice because of the previous change --
it had an old adaptive signal baked in.
2021-01-05 14:58:31 -08:00
Dustin Carlino
dedb041bdb Move CameraState to map_gui. Now widgetry has no dependency on abstio! #253 2021-01-04 10:39:15 -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
965d999199 Upgrade misc other dependencies 2021-01-03 20:01:27 -08:00
Dustin Carlino
5c04923dff Split abstio crate out from abstutil. #253
widgetry, geom, and abstutil may wind up on crates.io in some form to
let other projects use widgetry. abstio has A/B Street-specific tricks
for reading data on native/web. Note widgetry still depends on abstio,
will figure out how to clean that up next.
2021-01-02 10:28:00 -08:00
Dustin Carlino
795c6bebb1 When producing GeoJSON, represent Polygons that arent Rings (like from SVGs) as a MultiPolygon of every pre-calculated triangle. #440 2021-01-01 15:33:11 -08:00
Dustin Carlino
b7d025b6a6 Simplify DrawRoad a bit (center line and label in the same batch). Include it in GeoJSON export. #440 2021-01-01 15:18:01 -08:00
Dustin Carlino
302ec94e3d Try exporting the zoomed-in rendering of a map to geojson. #440
This approach has some manual effort and it's not capturing everything
yet, but it's a start.
2021-01-01 12:46:25 -08:00
Dustin Carlino
cd43d94196 Fix uber turn viewer -- the panel in the SimpleState wasn't being
displayed
2020-12-28 15:37:05 -08:00
Dustin Carlino
001aa836d2 Organize assets that're baked into widgetry. They don't belong in the
data/ directory, because they're statically bundled; they're not
actually read from the filesystem. #253

Two SVGs get duplicated between widgetry and abst assets -- dont_walk
and arrow_drop_down.
2020-12-28 10:40:55 -08:00
Dustin Carlino
fdfa2dbe8c Bundle some of the widgetry SVG assets in directly, so other users don't need to copy part of the data/ directory. [rebuild] [release] 2020-12-26 21:31:51 -08:00
Dustin Carlino
af5811c33c Lift Cached to widgetry 2020-12-26 14:38:43 -08:00
Dustin Carlino
c1de1678b7 Record the path a player takes, and display that afterward 2020-12-20 12:58:11 -08:00
Dustin Carlino
34c45e562b Use the table widget to improve 15 min amenity details. #393 2020-12-19 16:43:55 -08:00
Dustin Carlino
0bcf130b80 Lift the generic table to widgetry 2020-12-19 16:06:30 -08:00
Dustin Carlino
631b164cf8 Add a warning when low on time or blood sugar 2020-12-17 15:50:29 -08:00
Dustin Carlino
d917008f2e Lift SimpleState to widgetry, since it doesn't depend on any details of
the App at all. Use it in the experiment a bit.
2020-12-17 12:23:57 -08:00
Dustin Carlino
524f42ab61 Make the title screen more legible, add full credits. [rebuild] 2020-12-15 13:43:33 -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
524ea30faa Fix inactive button style, by applying layouting hints in isolation and
then drawing the resulting batch. Before, the layouting hints caused the
inactive "buttons" to stretch out horizontally.
2020-12-15 11:08:00 -08:00
Dustin Carlino
f6db70b0e5 Nicer panel for picking a vehicle before a level 2020-12-14 16:02:18 -08:00
Dustin Carlino
7ffa7f73f8 - Tune sprite size
- Fix duplicate unlocked vehicles
- Tune the zoom in-game
- Distinguish goal for each level, vs max possible score
- New time left panel
2020-12-13 12:44:43 -08:00
Dustin Carlino
3b9246860a Upgrade winit and glutin. No noticeable changes. [rebuild] 2020-12-11 20:47:00 -08:00
Dustin Carlino
87b4d1bb93 Performance optimization: don't update panels unnecessarily, and don't
do expensive updates unless time is passing. Before this, you could
introduce serious by wiggling the mouse!
2020-12-08 09:56:59 -08:00
Dustin Carlino
e03f356a0e Depend on upstream usvg and fontdb, now with pure-Rust rustybuzz support
in web!
2020-12-07 10:30:50 -08:00
Dustin Carlino
b1811c21ab Add a progress bar for the initial .wasm loading. #377
It's now easier to understand the possibly slow downloading of the 80MB
.wasm.
2020-12-05 20:55:07 -08:00
Dustin Carlino
12d0294692 Minimap tracker and new meters 2020-12-03 15:09:54 -08:00
Dustin Carlino
08d6f6987f Figure out when we pass a building along a road 2020-12-02 18:00:51 -08:00
Dustin Carlino
69b14e444f Simpler abstutil APIs: return string errors immediately, don't make callers transform. We don't need to distinguish different error types anywhere. 2020-12-02 08:44:07 -08:00
Michael Kirk
dab38e36ac fixup! map_err -> or_else 2020-12-01 17:49:41 -08:00
Michael Kirk
9ebd939b3f map_err -> or_else 2020-12-01 17:49:41 -08:00
Michael Kirk
4a9cfab935 fallback for shader versions 2020-12-01 17:49:41 -08:00
Michael Kirk
4f2cf1a714 context builder fallbacks 2020-12-01 17:49:41 -08:00
Dustin Carlino
b6ebee0dd8 Tiny refactor: Drawable::empty(ctx) 2020-11-25 11:19:26 -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
f656468580 widgetry refactor: store all keys currently held down, let anyone query 2020-11-22 13:24:08 -08:00
Michael Kirk
9afbe6031f speed up texture loading minimize vector alloc
It's still kind of slow in --debug wasm builds, but seemingly much
faster in release or non-wasm.
2020-11-18 22:49:49 -08:00
Dustin Carlino
5ea3c2ba6f Remove support for remote trips, and stop plumbing off-map locations. A
remote trip goes between two locations off-map, specified just by a GPS
coordinate. The trips aren't simulated at all. They were originally
added to support Orestis's pandemic model, to handle transmission
off-map in shared buildings. This work has died off, there are no other
anticipated use cases for remote trips, and they complicate bigger
refactorings. #258

This also has the nice side effect of substantially reducing scenario
size -- huge_seattle from 177MB to 147MB. That unused metadata was
expensive!
2020-11-17 10:14:23 -08:00
Dustin Carlino
d3aa81d2d2 new tool to record a scenario consisting of all traffic around some intersections, to help with producing a better test case for #382 2020-11-15 16:57:33 -08:00
Michael Kirk
65897d8fe2 FIX #379: web client resizes with window 2020-11-12 16:51:05 -08:00
Dustin Carlino
3583d068a6 Fix a bug introduced in e3b9c42506 on the proposal saver, and allow blocking-the-box on another Ballard intersection 2020-11-11 13:20:56 -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
1b4e25e12f Get the downloader UI to actually fetch stuff. #326 2020-11-07 18:39:15 -08:00
Dustin Carlino
67530bec07 Future-proof file organization by changing map_name from a string to a
struct. Whatever choices we make next about naming cities hierarchially
or not can be managed in just one place. #326

This is a pretty huge change, but the compiler gives reasonable
confidence it's correct. More bugs are likely to crop up in the next
step, when filenames start being namespaced by the city too.
2020-11-04 17:26:32 -08:00
Dustin Carlino
57bb97ced0 On web, don't actually quit when the last state is popped. The app just awkwardly hangs if you do that. 2020-10-29 16:25:05 -07:00
Dustin Carlino
bb081bbd28 Don't assume an autocomplete widget will be consumed after a value is chosen. In particular, if the user types nonsense into the city picker and presses enter, don't crash. 2020-10-29 15:18:15 -07:00
Dustin Carlino
304e723d77 Fix scrollbar dragging, which was broken because the Slider gets
recreated while we drag.

But there's still something wrong, because in the OSM viewer with a huge
list of buttons, scrolling is incredibly laggy while dragging, but not
when using the scroll wheel.
2020-10-28 13:56:08 -07:00
Dustin Carlino
0167b4be31 A tiny start to the great UI button refactor: make the "X" button
consistent. #331
2020-10-28 12:04:36 -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
fd1afbad02 Speed up the OSM viewer's business search panel. It was constantly recalculating the entire thng 2020-10-27 12:52:26 -07:00
Dustin Carlino
ae62bf082e Consolidate Slider and AreaSlider. They share most logic, just look different. 2020-10-27 12:13:20 -07:00
Dustin Carlino
6a8e01d4cd Remove an unnecessary slider from the polygon debugger, and lock down set_percent, which is causing some scrollabr dragging bugs. 2020-10-27 11:31:37 -07:00
Dustin Carlino
1a630c6361 Highlight categories of businesses in the osm viewer 2020-10-24 15:19:51 -07:00
Dustin Carlino
ad23da1f6c Workaround widgetry panel bug in the osm viewer, where scrollbars aren't
recomputed when panel contents change size.
2020-10-24 13:41:06 -07:00
Dustin Carlino
e55dfd68dd Document the state/transition system. #253 2020-10-22 18:27:25 -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
d98c5bc6bc Better error message when the GPU doesn't support the requested mode. #103 2020-10-21 12:19:06 -07:00
Dustin Carlino
ead7960112 Collapse one case of possible nested loading screens. Slightly simpler
code, but this doesn't solve the bug of a second squished loading screen
for scenarios.
2020-10-20 18:24:37 -07:00
Dustin Carlino
d8910ad04f Build a quadtree of unzoomed agents while drawing, to later speedup mouseover. This seems to make performance fine in debug mode, so get rid of the flag guarding of this feature! [rebuild] 2020-10-20 11:38:38 -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
422882c03b Ditch cpuprofiler in favor of cargo flamegraph. Add a tool that just
runs a scenario headlessly, since that's easier than sending a few curl
commands to the API. #368
2020-10-15 17:12:38 -05:00
Dustin Carlino
e38858129b Cleanups after https://github.com/dabreegster/abstreet/pull/363:
- cargo +nightly fmt
- upload new prebaked data
2020-10-10 12:24:42 -07:00
Sam
4c5a858238
Delay highlighting (#363)
* Initial storing of intersection delays

* Initial highlighting of delays on route

* Added label of delay

* Info overlay works

* Added supoprt for pedestrian delays (only intersection delay currently)
Bike also works, but is treated as a car, so the avg speed is flagged as very slow (Needs fix)

* Capitalised describe trip phase
Now uses min of (speed limit and vehicle max speed) for the maximum speed check
Added trip blocked time query
Lots of work on tool tips
Icons are broke

* Nearly complete, just fmting and a crash to fix
Color assertion?

* Fixed text font colour crash
Added new custom TextSpan size function

* Cargo +nightly fmt

* Cargo +nightly fmt

* Clion auto import formatting
Doesn't quite match the existing "changes"

* Fixing merge issues

* Fixing icon placement issues

* Requested changes (Part 1)

* Requested changes (Part 2)

Co-authored-by: Sam <a>
Co-authored-by: Dustin Carlino <dabreegster@gmail.com>
2020-10-10 12:23:02 -07:00