diff options
author | ClementTsang <cjhtsang@uwaterloo.ca> | 2021-08-31 17:19:05 -0400 |
---|---|---|
committer | ClementTsang <cjhtsang@uwaterloo.ca> | 2021-09-05 19:09:11 -0400 |
commit | eddc9a16c7ac1be90144e8a247b13d6fd96238cf (patch) | |
tree | 8d197acfebf39a02cd8cc4abd0770f4508cbae6f /src/app/widgets/basic_net.rs | |
parent | 204b4dc3510b70618741f82a1e2df6c17c6dadda (diff) |
refactor: move basic mode over
Because writing your own layout system and management is just *so much
fun*. Totally.
-------------------------------------------------------------------
Moves the basic mode system over to the new drawing/widget system. In
the process, it has forced me to completely redo how we do layouts...
again. This is because basic mode has widgets that control their own
height - this means the height of the columns and rows that wrap it
are also affected by the widget's height.
The previous system, using a constraint tree and splitting draw Rects
via tui-rs' built-in constraint solver, did not support this concept
very well. It was not simple to propagate up the widths/heights
towards parents while also using tui-rs' built-in constraint solver.
In the end, it was easier to just rewrite it using another algorithm.
We now follow a process very similar to Flutter's layout system.
Relevant links to the Flutter docs are found in the code or below:
- https://flutter.dev/docs/development/ui/layout/constraints
- https://flutter.dev/docs/resources/inside-flutter#sublinear-layouts
The gist of it, however, is that we now instead a few new options for
any element in the layout tree. A node can either:
- Grow to fill remaining space
- Take up as much room as its children
- Be a specific length
Technically right now, it's not perfect, in that leaf nodes can be as
large as their children (which makes no sense), though in that case it
just treats it as an expand.
Diffstat (limited to 'src/app/widgets/basic_net.rs')
-rw-r--r-- | src/app/widgets/basic_net.rs | 0 |
1 files changed, 0 insertions, 0 deletions
diff --git a/src/app/widgets/basic_net.rs b/src/app/widgets/basic_net.rs deleted file mode 100644 index e69de29b..00000000 --- a/src/app/widgets/basic_net.rs +++ /dev/null |