Commit Graph

241 Commits

Author SHA1 Message Date
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
Dustin Carlino
31854344ec Proper loading screen for web. #21 2020-10-08 15:07:23 -07:00
Dustin Carlino
69c8ce4cbe Before the .wasm loads, display "Loading" 2020-10-07 23:02:10 -07:00
Dustin Carlino
f258c50595 Organize import blocks using https://github.com/dabreegster/organize_rust_imports 2020-10-05 20:29:22 -07:00
Dustin Carlino
27d94945c6 Manually move mod block after the use block, to match what CLion does. 2020-10-05 20:29:22 -07:00
Dustin Carlino
41ecd62e69 Support textures on the web as well 2020-10-05 19:50:52 -07:00
Dustin Carlino
6cce3b1946 Make z-order changes work on web too, restoring tooltips 2020-10-05 19:50:52 -07:00
Dustin Carlino
bb6dbb0731 Switch from stdweb to websys for #21.
When I added web support in February, it was easier to get started with
stdweb, since it has the nice cargo web tool. However, stdweb is
unmaintained, winit is deprecating support for it, and the next steps
for web (downloading maps dynamically) have better support for web-sys.

With Alvin's guidance, I got
https://github.com/dabreegster/minimal_websys_winit_glow_demo working
first. This PR cuts A/B Street over too.

I tested abst and the widgetry demo in both native and web. The only
major regression from stdweb is the canvas placement and size. I
attempted some fixes, but at this point, I'll leave it as a smaller
followup instead.
2020-10-05 19:50:52 -07:00
Michael Kirk
14cbb0f0c1
update panels and their scrollbars when window resizes (#358)
* match unfork to fork

TBH I don't know of problem currently being caused by this, but it
seemed wrong to unfork without a matching fork.

* variable rename (no behavior change)

"c" was holdover from when panels were called composites

* resize container dims when window resizes

* make panel.top_level private

* Show/Hide scrollbars as window is resized

* alignment demo

* Fix scrollbar positioning

* separate out scrollbar work so we can profile it easier

* mem::replace is more concise than mem::swap

* fixup size of MaxPercent

* restore scroll position after redrawing scroll bars
2020-10-05 17:46:50 -07:00
Dustin Carlino
e973d1e5a1 Organize abstutil io into a native and web crate 2020-10-05 14:16:29 -07:00
Dustin Carlino
533fca1f61 Upgrade winit and glutin [rebuild] 2020-10-02 21:31:56 -07:00
Dustin Carlino
9ca7ea6cc2 Improve the experiment to draw area names by fixing z-ordering. But
leave disabled; sizing is still way off.
2020-09-29 14:51:07 -07:00
Dustin Carlino
4916b10190 Small style cleanups after #346 (Import grouping, simplify Spinner logic) 2020-09-27 10:26:38 -07:00
NoSuchThingAsRandom
0921a4aae5
Pedestrian crossing time (#346)
* Fixed ui being able to select traffic light times that are shorter than the time it takes to walk across the crosswalk

* Fixing operands and renaming

* Fixed spinner out of bounds issue
Traffic light generation now, ensures that there is enough time to cross the crosswalk
And enforces the minimum time duration

* Cargo +nightly fmt

* Request fixes: https://github.com/dabreegster/abstreet/pull/346
Still need some things to clarify:
    Spinner checks on increment/decrement
    Calling enforce_minimum_crosswalk_time inside get_possible_policies, requires the removal or modification of the validation function

* Moved enforce_minimum_crosswalk_time inside get_possible_policies
Now runs stage_time_validation at the end of get_possible_policies and removes invalid policies
Could do the same with the validation function as well?

* Fixing import order

* Fixed ui being able to select traffic light times that are shorter than the time it takes to walk across the crosswalk

* Fixing operands and renaming

* Fixed spinner out of bounds issue
Traffic light generation now, ensures that there is enough time to cross the crosswalk
And enforces the minimum time duration

* Cargo +nightly fmt

* Request fixes: https://github.com/dabreegster/abstreet/pull/346
Still need some things to clarify:
    Spinner checks on increment/decrement
    Calling enforce_minimum_crosswalk_time inside get_possible_policies, requires the removal or modification of the validation function

* Moved enforce_minimum_crosswalk_time inside get_possible_policies
Now runs stage_time_validation at the end of get_possible_policies and removes invalid policies
Could do the same with the validation function as well?

* Fixing import order

* Moving stage validation inside validation function

Co-authored-by: Sam <a>
2020-09-27 10:21:30 -07:00
Michael Kirk
1079a899d6
fix doctest error (#350)
because I significantly indented the unicode diagram, doctest tried to
execute them, and exploded when parsing non-ascii "rust code"
2020-09-25 19:07:19 -07:00
Michael Kirk
f0be8dc0f0
Coalesce render flavors (#349) 2020-09-25 15:09:18 -07:00
Michael Kirk
e19bb42492
Clean up "trips" (info/person.rs) (#347)
* center pill

* padding insets

* use disclosure glyph instead of unicode arrows
2020-09-25 13:05:32 -07:00
Dustin Carlino
0f78920aeb Start overhauling th trip summary page. #331 2020-09-25 11:55:07 -07:00
Michael Kirk
241d2faad3 Apply a few more pop_up buttons
...rather than formatting text w/ unicode arrows

Addendum to 452fb06ae
2020-09-25 09:47:08 -07:00
Michael Kirk
d7e0225097 roll back lyon to fix crash in widgetry demo 2020-09-24 19:12:39 -07:00
Michael Kirk
00fb0ef8cd Cleanup dropdown - stop using unicode "down arrow"
We were drawing "pop-up" style buttons in several places, using
copy/pasted logic - which was simple enough when using a unicode glyph.

But we want to use a different glyph which isn't in our font. Further,
using an svg like this gives us finer grained control around the layout
around the button "handle" than we could get with just space characters.
2020-09-24 19:12:39 -07:00
Michael Kirk
8ad32c5cee separate widgetry assets
might be helpful for packing separate widgetry crate
2020-09-24 19:12:39 -07:00
Dustin Carlino
597ef473f2 Upgrade most dependencies 2020-09-24 09:36:26 -07:00
Dustin Carlino
6f1ffe66b5 Don't clip tooltip. #331 2020-09-23 12:02:59 -07:00
Dustin Carlino
fa0c5ee02c Multiple lane type transformations in bulk edit. #331 2020-09-23 11:55:19 -07:00
Michael Kirk
4a6ca209a5 fix tooltip z-level 2020-09-23 11:27:50 -07:00
Michael Kirk
8042ad414f
fix building overlap for isometric view (mostly) (#338) 2020-09-21 11:54:39 -07:00
Dustin Carlino
e1de43b75c Add a /map/set-edits API call 2020-09-21 10:18:02 -07:00
Dustin Carlino
a17ef9cc43 Get text rendering to work on WASM! #21
Just a few changes to make usvg not depend on Rustybuzz (which is still
in the middle of becoming a pure Rust library). It probably only works
with English fonts, but for the moment, it moves us forward.
2020-09-20 22:50:22 -07:00
Dustin Carlino
8e32314979 Style the loading screen and add tips/news. Closes #180 [rebuild] 2020-09-20 13:02:27 -07:00
Dustin Carlino
bb3342de27 Individual hitboxes for multiple signals in the sidebar. #331 2020-09-19 11:52:15 -07:00
Dustin Carlino
83ff6db16c Improve the signal demand dash with keys to change hour. And slightly
refactor styled keys in text.
2020-09-19 10:18:23 -07:00
Dustin Carlino
d9e50a7e38 Use .into() for specifying keys to widgetry more ergonomically. #253 2020-09-18 09:26:14 -07:00
Michael Kirk
2b36b9f03a
add textured theme (#335) 2020-09-18 07:43:05 -07:00
Michael Kirk
cb84b729f6
FancyColor -> Fill (#334) 2020-09-17 23:34:25 -07:00
Michael Kirk
c0e2a611a0
introduce textures to rendering pipeline (#333) 2020-09-17 18:38:55 -07:00
Dustin Carlino
7bd1d937f9 Some of Yuwen's cosmetic traffic signal editor changes 2020-09-15 09:32:46 -07:00
Dustin Carlino
fff75fa5ba Yuwen's new changelist UI (except for describing some of the changes in detail) 2020-09-14 17:40:04 -07:00
Dustin Carlino
0a3479a3d0 Implement the new file management part of Yuwen's edit mode sidebar UI.
Some bugs introduced when working with the default untitled proposal.
About to change the behavior of that in the next commit.
2020-09-14 13:58:12 -07:00
Dustin Carlino
2895d50a1e
Add tooltips to the agent meters, and stop showing both buses and passengers. Fixes #239 (#323) 2020-09-11 11:08:26 -07:00
Dustin Carlino
f1b1263ee2 Fix congestion capping impl when RESERVE_WHEN_STARTING_TRIP is enabled. It wasn't reseting the counter every hour. 2020-09-10 14:29:06 -07:00
Michael Kirk
c11cecf1ac
log cleanups (#321) 2020-09-10 14:20:35 -07:00
Dustin Carlino
5be4c2ca84 Add an API to add a new trip in the middle of the simulation. Fixes #313
[rebuild]
2020-09-06 13:53:31 -07:00
Michael Kirk
95b01c5f9e
macos fix: flip h-scroll to conventional direction (#310) 2020-09-06 13:10:37 -07:00
Dustin Carlino
70d2d1115e Store polygon indices as u16, not u64. Maps from 743MB total down to
620MB!
2020-09-04 13:12:06 -07:00
Michael Kirk
db5b1622ad
preserve whitespace (#304)
* maintain  whitespace in text (except trailing)

Note, until https://github.com/RazrFalcon/resvg/issues/317 is addressed,
trailing space does not affect the size of the text bounding box.

* remove space-holders now that spacing is preserved
2020-08-28 16:26:00 -07:00
Dustin Carlino
75610e2109 Split managed.rs into widgets/mod.rs and widgets/panel.rs (#253) 2020-08-27 12:23:43 -07:00
Dustin Carlino
de6a12e472 After much deliberation, rename Composite -> Panel (#253) 2020-08-27 12:12:44 -07:00
Dustin Carlino
2935d2379b Mechanical rename of ezgui -> widgetry, a much better name to enchant the Rust community. #253 [rebuild] 2020-08-27 10:37:04 -07:00