Commit graph

213 commits

Author SHA1 Message Date
Jonathan Johnson
8c8dca63ba
Clarified some window builder documentation
Really the functions should be renamed -- see #155
2024-05-17 15:00:24 -07:00
Jonathan Johnson
774a846210
animate_mouse_button + more example recordings 2024-05-12 19:12:01 -07:00
Jonathan Johnson
997cc9586f
Simplifying drop shadow
Also making example regeneration automatic in CI for the guide
2024-05-12 06:57:41 -07:00
Jonathan Johnson
07f1febe9f
Removed ChosenMenuItem
Also updated the changelog
2024-05-10 12:15:33 -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
5e266f1551
Optimizing label text recaching
I had previously had similar logic in here, but I realized I couldn't
reliably detect if cosmic_text had done any wrapping or not. After a
discussion prompted me to see if recaching was happening while
scrolling, I realized I could at least allow the width to be >= the
measured text size and <= the requested layout width.

This prevents recaching while scrolling.
2024-04-07 14:33:50 -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
44759d4812
Fix when replacing an overlay
When an overlay handle dropped directly after pushing a new overlay, it
was possible for new overlays to be popped off improperly, causing a
subtraction overflow panic later.
2024-03-21 11:26:34 -07:00
Jonathan Johnson
74034760ce
OverlayLayer::dismiss_all 2024-03-20 11:40:20 -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
0e5976de10
Dynamic::try_lock
Plus other minor changes.
2024-01-26 18:13:42 -08:00
Jonathan Johnson
3f8fed65c3
Added Chinese ListStyles
This may seem like a lot of options, but here's the reasoning:

- The CSS spec offers four variations: Simplified/Traditional and
  Formal/Informal. This spec defines a character set for all for
  variations, and it also associates rules for omitting digits in the
  informal variants.
- The chinese_number crate does not implement a variant that includes
  the tens digit, as required by the cSS spec for the formal variants.

To be able to provide the enumerations that the CSS spec offers *and* to
provide the variations that the chinese_number crate supports, I've aded
8 total list styles for selecting a specific Chinese variation.

Technically nominals supports even more options, but the myriad counting
scale coveres u128::MAX and seems to be the most common counting style.
2024-01-18 15:06:54 -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
570cfc6d94
Missing docs 2024-01-13 06:10:36 -08:00
Jonathan Johnson
c2bd9911ca
Started a List widget
a la HTML's <ul> tag.
2024-01-13 06:04:41 -08:00
Jonathan Johnson
1b97b39857
Label for CowString 2024-01-13 06:02:22 -08:00
Jonathan Johnson
0c36abf28e
Remving debugs 2024-01-13 06:02:10 -08:00
Jonathan Johnson
9bd78c648b
Switcher now unmounts
This isn't quite perfect, as a Switcher shared with multiple windows
will only unmount in one window.
2024-01-13 05:55:07 -08:00
Jonathan Johnson
02e90e48c6
Image aspect scaling now requests sizes 2024-01-13 05:54:51 -08:00
Jonathan Johnson
f8cb7e7f32
Added the Delimiter widget 2024-01-12 15:44:18 -08:00
Jonathan Johnson
64ad120be6
Clipping the checkerboard pattern 2024-01-11 07:17:38 -08:00
Jonathan Johnson
d701e179ae
Fixing ComponentPicker<Alpha>'s loupe coloring
The previous fix was a fix in contrast_between. However, I then
convinced myself that the selected color was changing when it wasn't
purely because the alpha picker utilizes a checkeboard pattern, and I
was specifically testing grayscale values.

Aka, I was reproducing the "different grays" optical illusion using the
loupe outline color and driving myself crazy trying to figure out what
my code was doing, when in reality it wasn't doing anything.

The real fix? Don't ask for contrast between two similar colors.
OutlineColor and TextColor are both meant to be contrasting colors to
SurfaceColor, which is the background color. The loupe color really
should have switched between any surface-type color and any
foreground-type color, but it instead was asking for two different
foreground colors.
2024-01-11 07:10:45 -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
5556d2ea6d
FlexibleDimension now implements Zero 2024-01-08 09:07:17 -08:00
Jonathan Johnson
cda13c42a2
Guide intro + KeyEvent
Also fixed virtual window's refresh handling.
2024-01-06 14:46:48 -08:00
Jonathan Johnson
bb28f96b58
Space fix 2024-01-06 10:25:45 -08:00
Jonathan Johnson
a3e76f6472
Calling set_ime_cursor_location
Currently passing the entire input area because it's easy. Not closing
the issue because the correct thing to do would be to constrain the
location to a smaller area on the current line (or the current line).

Refs #122
2024-01-04 17:08:05 -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
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
c1d6e3f7fd
Fixed Switcher widget
This was broken in unreleased changes, hence no changelog update.
2024-01-02 08:37:10 -08:00
Jonathan Johnson
32d6fffd3b
WidgetRef::unmount_in
This should be all the locations that WidgetRef::unmount_in should be
called.
2023-12-29 13:59:28 -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
c6d66a3166
Grid remove fix, new dynamic features 2023-12-28 17:36:52 -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
f85b2f988b
Added Default components
Closes #116
2023-12-27 13:44:34 -08:00