Commit graph

170 commits

Author SHA1 Message Date
Jonathan Johnson
7bd79b0662
Switched to released easing-function
Also added new easings example.
2024-08-18 10:58:44 -07:00
Jonathan Johnson
18d14a0275
Fixing example test compilation issues 2024-08-18 08:01:00 -07:00
Jonathan Johnson
df748a991d
Extracting easing functions + Clippy 2024-08-17 17:44:12 -07:00
Jonathan Johnson
6726855ed0
Cleaning up figures usage in examples 2024-07-26 10:34:30 -07:00
Jonathan Johnson
ba3a4b9b02
Added Zoom factor
Closes #146
2024-07-25 11:31:38 -07:00
Jonathan Johnson
fbabbdbd99
Reverting example change
Was an unrelated test, oops.
2024-07-08 17:07:00 -07:00
Jonathan Johnson
60c7ef8859
Honoring Window::inner_size's initial value
Refs #160
2024-07-08 16:50:50 -07:00
Jonathan Johnson
24291772de
Added Window::on_close_requested
Closes #161
2024-07-08 16:06:45 -07:00
Jonathan Johnson
774a846210
animate_mouse_button + more example recordings 2024-05-12 19:12:01 -07:00
Jonathan Johnson
568f2ca327
Added plotters example capture + animate_keypress 2024-05-12 14:23:29 -07:00
Jonathan Johnson
15b8b3e452
Moved example generation into cushy
Undocumented and unsupported, but this allows generating example images.

This push is testing that the image makes it through CI.

Refs #125
2024-05-12 07:58:09 -07:00
Jonathan Johnson
b57188f80f
Added optional tokio integration
Closes #147
2024-05-11 21:25:54 -07:00
Jonathan Johnson
c5f1832b3e
Disabled menu item support 2024-05-10 10:16:47 -07:00
Jonathan Johnson
b8410cd4ba
Separators in menus 2024-05-10 09:51:02 -07:00
Jonathan Johnson
38cdea9816
Submenu support in context menus 2024-05-10 09:10:39 -07:00
Jonathan Johnson
8b96966031
Basic context menus
Missing a ton of functionality (separators, keyboard accessibility,
submenus), but the basic concept is working.
2024-05-09 08:16:34 -07:00
Jonathan Johnson
1c8d4e0176
ButtonClick + Overlays at locations
The overlay example now supports right-clicking to open overlays at the
clicked location, showing how a context menu widget can begin being
built.
2024-05-08 08:38:26 -07:00
Jonathan Johnson
46c4eb9ed8
winit 0.30 2024-05-01 12:49:03 -07:00
Jonathan Johnson
20ae2b7c72
map_each deadlock prevention
map_each previously was written such that if a chain of mappings fed
each other, a deadlock could occur because while the first one was
mapped, the second callback gets invoked and tries to update the first
value while it's still being held.

This refactor switches from std Mutex to parking_lot, allowing me to
remove a workaround for needing to run drop callbacks in a separate
thread during the drop of a DynamicGuard.

In addition to that change, the lower level `map_generational` calls now
take a DynamicGuard as their parameter. This allows these functions to
drop ownership of the referenced data during the callback.

The map_each implementation takes advantage of this by ensuring that the
guard is dropped before set is invoked, minimizing potential lock overlaps.

With this refactor, some old code of mine with complex validations now works
again.
2024-04-05 16:14:26 -07:00
Jonathan Johnson
3762bc6dc1
Dynamic font loading
Closes #145
2024-03-06 16:53:36 -08:00
Jonathan Johnson
0e02a513bb
Updating dependencies
This makes the lockfile build against the new release of wgpu.
2024-03-06 09:21:43 -08:00
Jonathan Johnson
e2e5085b1f
Added List widget 2024-01-18 13:29:50 -08:00
Jonathan Johnson
76a42e2788
Updated to wgpu 0.19.0
Most of the changes were figures-related. Go figure.
2024-01-18 06:37:29 -08:00
Jonathan Johnson
cc207fbf8c
Added optional plotters integration
Closes #133

The real work was done in Kludgine.
2024-01-11 20:52:40 -08:00
Jonathan Johnson
55b43cb4aa
Renamed example
Also fixed a comment I missed updating
2024-01-11 09:49:27 -08:00
Jonathan Johnson
956e4109f9
Added InvalidationBatch 2024-01-11 09:47:51 -08:00
Jonathan Johnson
8a274df730
Added more color pickers
This set of changes is making me think of adding Rgb/Rgba types and
having our own color enum.
2024-01-10 13:27:12 -08:00
Jonathan Johnson
246352fed2
Added HslPicker 2024-01-10 08:17:09 -08:00
Jonathan Johnson
6ad6cca32d
Children renamed to WidgetList
Plus more work on the user's guide, which inspired the rename.
2024-01-09 13:26:14 -08:00
Jonathan Johnson
d7fde0815f
Trying to make Mac CI fail gracefully
This message may be repeated multiple times as I work on the CI
configuration.

Refs #129
2024-01-08 09:17:03 -08:00
Jonathan Johnson
a197bb5e81
Unit-tested, auto-generated screenshots
This commit adds my first take at creating a harness for a user's guide
using the new capture functionality. The example has tests that ensure
the align widget creates the expected results.
2024-01-04 13:56:45 -08:00
Jonathan Johnson
eb20133116
Reinstating weak_clone and non-weak callbacks
Somehow I missed that my changes for weak callbacks broke the theme
editor. I thought I had it working with the try_get changes, but I
discovered several flaws in this approach.

In the end, ownership has been transferred to the CallbackHandle, and a
CallbackHandle can relinquish its reference to create weak graphs. This
is how weak_clone now works.
2024-01-04 13:56:26 -08:00
Jonathan Johnson
36b80e8f34
Moved frame mapping to its own thread
This ensures frames render consistently.

This change only affects the animation recorder. The regular virtual
recorder interface blocks when refresh is called.
2024-01-03 20:15:00 -08:00
Jonathan Johnson
bc52be440f
Added animation recording + event wiring
Not great, but it technically exists.
2024-01-03 17:45:11 -08:00
Jonathan Johnson
be0399279c
Initial implementation of offscreen rendering 2024-01-03 11:35:43 -08:00
Jonathan Johnson
244797110e
Added to_ variants for into_ functions 2024-01-02 15:07:06 -08:00
Jonathan Johnson
83e44912ee
ReadOnly<T>, Owned<T>, IntoSource<T>, more
Closes #98

This finishes my initial refactoring of the dynamic system to add
support for several dataflows including:

- Pure data sources that can be implemented using an `Owned<T>` at the
  root of a graph of `Dynamic<U>`/`DynamicReader<U>`s.
- Read-only data sinks. I thought this would be more useful across other
  widgets, but in general, Progress and Label seem like the only types
  that this applies to currently.
- The ability to mix/match Dynamic/DynamicReader in tuple-based
  for_each/map_each.
2024-01-02 14:36:53 -08:00
Jonathan Johnson
e70e92726c
Source<T> + Destination<T> (breaking)
Refs #98

This refactor overhauls the reactive system to move all the reactive
methods to traits. The side effect of this change is that now
DynamicReader's API is the same as Dynamic's API, but because it only
implements Source<T>, DynamicReader does not offer any mutation
functions.

While it's unfortunate to have more traits to include to use Cushy, this
seems like the best option, and it offers a path to try to integrate
this into the tuple ForEach/MapEach traits. Unfortunately, my attempt at
doing those in this set of changes led to issues specifying generic
associated lifetimes for the DynamicGuard. But, I was also in the middle
of this larger refactoring, so it might be that a fresh attempt will
succeed.
2024-01-02 09:00:29 -08:00
Jonathan Johnson
9e4e079bf5
WindowLocal + Custom Observers
This cascaded into a lot more work than expected. However, in general,
if one clones a `WidgetInstance` and shares it between two windows, it
should now work. Widget authors must ensure that when they cache
information, they do so with either a `WidgetCacheKey` or use a
`WindowLocal<T>` if per-window state is desired.

This is demonstrated in the debug-window example, where the counter of
open windows is next to a clone of the same button from the main window
that opens a new window.
2023-12-29 13:21:39 -08:00
Jonathan Johnson
3fc49d2424
Initial DebugContext implementation 2023-12-28 21:30:25 -08:00
Jonathan Johnson
285c92f82b
Root tab order fix, Spacebar widget activiation
Closes #99

Disclose now accepts focus and responds to spacebar as a result of this.
2023-12-28 15:48:34 -08:00
Jonathan Johnson
a0478e266a
Added Disclose widget 2023-12-28 14:12:26 -08:00
Jonathan Johnson
2fe28729df
Directly depending on figures
While this was a workaround for a docs.rs issue (Px/Lp are not
linked), I decided having the shorter import path would look better in
the examples.

It probably wasn't necessary to update all of the references in the
internal code, but I decided it was worth the consistency.
2023-12-28 09:35:24 -08:00
Jonathan Johnson
df479e983e
Renaming crate to Cushy
Refs #117
2023-12-27 19:02:59 -08:00
Jonathan Johnson
a9dcee38a6
Validation callbacks are now cleaned up
Closes #105
2023-12-27 14:25:14 -08:00
Jonathan Johnson
8a9fb24fe0
Added PendingWindow
Closes #107

This answers the question of how a window can close itself.
2023-12-27 09:47:58 -08:00
Jonathan Johnson
4379565e3d
Label/Input caches invalidate across windows
When combined with changes in Kludgine, this should round out support
for sharing content between multiple windows.

Closes #110
2023-12-26 13:57:23 -08:00
Jonathan Johnson
564b9e5a96
Added comments to multi-window
Also made it open a second window before startup
2023-12-21 15:41:34 -08:00
Jonathan Johnson
f1a2a711ff
Multi-window support
Closes #91

There's some details to still figure out, which are in new issues:

- #109: When opening a window, no handle is returned that gives access to the
  window from the opener. Technically this can all be wired up manually,
  with exception of requeesting the window close.
- #107: How can a window close itself? Once we have a handle type, we still
  need a mechanism to allow a button on a window request that the window
  closes gracefully. The examples that currently close the window
  call exit instad.
2023-12-21 14:57:29 -08:00
Jonathan Johnson
4e145d7f35
Removed UnwindSafe bounds
appit wasn't supposed to pass along this requirement
2023-12-20 11:35:19 -08:00