Skip to content

v0.27.2

Choose a tag to compare

@W-Mai W-Mai released this 07 Jun 17:11
· 42 commits to main since this release
9697e66

Slider gets a business-event channel: on ValueChanged { ... },
on DragStarted { ... }, on DragEnded { ... } route through the new
SliderHandler instead of GestureHandler. A user-attached
GestureHandler on the same Slider entity no longer replaces the
slider's internal drag/tap behaviour, thanks to a dual-channel
bubble_dispatch.

Added

  • View::with_internal_gesture(fn) — register a component-internal gesture handler. bubble_dispatch_at walks each entity through the View-registered internal channel first, then the user GestureHandler. Internal handlers that return true consume the event; false lets the user handler on the same entity also see it.
  • SliderEvent enumValueChanged { new, old }, DragStarted, DragEnded. Bound to the SliderHandler component.
  • SliderHandler { on_event: fn(&mut World, Entity, &SliderEvent) -> bool } — user-attached component that receives slider business events.
  • ui! { Slider (...) on ValueChanged { ... } {} } — handler bodies see new and old auto-destructured from the variant. on Slider::ValueChanged qualified form is also accepted.
  • gallery/examples/slider_value_changed_demo.rs — typed-widget Slider with all three business events wired to a label that reports the live value, change count, and drag transitions.

Changed

  • Slider no longer attaches a GestureHandlerslider_handler lives on the View's internal gesture channel. A user that previously attached a GestureHandler on a Slider entity to override the drag behaviour will see both run now (internal first; user handler only fires if internal returns false). The slider_attach fn is kept as a placeholder for future motion seeding.
  • mirui-macros widget+EventKind tableFIRST_PARTY_BUSINESS_EVENTS registers (widget, event) pairs that route on EventKind clauses to a business handler. Slider's three events populate the table; the dispatch fn synthesis splits handlers across the gesture channel and the business channel.