#474
feat(canvas): slider source ranges, vertical flush button groups, and app input hooks
Summary
- App input hooks for app-built controls.
on_bluris a widget handler for keyboard focus leaving it. A click on another control resolves the blur against the previous tree before the click reaches its target in the rebuilt tree, so an editor can commit and the clicked control still activates.on_widget_pointerandon_widget_keyboardsee canvas events before normal routing and consume them when they return a Msg.on_widget_pointer_observesees unclaimed pointer events without consuming them.on_widget_context_pressclaims secondary presses before theon_holdfallback.CanvasWidgetContextPressEventcarries the surface-local press point.
SliderRange.Widget.slider_rangeholds min, max, step, orientation, direction, and an optional reset value, set throughUi'sslider_*options. The retained value stays the normalized fraction.- Pointer, keyboard, accessibility steps, and change dispatch all convert through one source/fraction pair, so
on_changedelivers source values snapped to the step. - Arrow keys follow orientation and direction, Shift moves ten steps, Home and End reach the ends, and a double-click restores the reset value.
on_commitfires once on release, after the final sample'son_change. Cancellation never commits.- Vertical sliders get vertical geometry.
- Accessibility snapshots carry range, step, orientation, and direction, and AppKit exposes min, max, and orientation.
- Sliders without a range behave as before.
- Pointer, keyboard, accessibility steps, and change dispatch all convert through one source/fraction pair, so
- Vertical flush button groups.
WidgetLayoutStyle.verticalstacks abutton_group(steppers, a+over a-). Both render walks stamp the axis beside the segment, so the first segment keeps its top corners and the last its bottom ones, and the shared seam drops the top border band.
Notes for review
- The retained
Widgetfootprint goes from 776 to 808 bytes (slider_range).group_verticalfits in the padding that leaves.
Verification
zig build teston macOS with Zig 0.16.0: passed.scripts/gate.sh fast: every step passed exceptexamples-mobile, which needs the Android NDK. The NDK isn't installed here, and upstreammainfails the same way.- New tests:
a slider source range maps, snaps, reverses, and steps in source space,a vertical flush group caps top and bottom corners and drops the top seam, andui app delivers blur before the click that moves focus, and pointer hooks observe or claim.
Activity
5vercel[bot]reviewed1mo ago
@rdev is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.