Skip to content

Conversation

ickshonpe
Copy link
Contributor

@ickshonpe ickshonpe commented Sep 10, 2025

Objective

In core_widgets_observers the thumb should stay the active color during drags when the pointer is not hovering the slider.

Solution

  • In slider_on_change_hover, query for CoreSliderDragState and set the thumb color lighter if the slider is hovered or dragged.
  • Add a system update_thumb_color_when_drag_ends to update the thumb color when dragging ends.

Not ideal implementation, would be better with some way to observe the drag state.

…e thumb with the pointer not over the slider.
@ickshonpe ickshonpe added C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples A-UI Graphical user interfaces, styles, layouts, and widgets S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 10, 2025
@viridia
Copy link
Contributor

viridia commented Sep 10, 2025

Can we hold off on this until after the renaming goes in?

I agree with the motivation, the only reason I didn't implement this before was I was hoping for a better way to do it.

All of the feathers widgets would be greatly simplified with a real reactive framework: I have similar widgets in both thorium_ui and bevy_reactor and they are a lot less messy.

@alice-i-cecile alice-i-cecile added S-Blocked This cannot move forward until something else changes and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Sep 10, 2025
@alice-i-cecile
Copy link
Member

Blocked on #20944.

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Sep 10, 2025

Can we hold off on this until after the renaming goes in?

I agree with the motivation, the only reason I didn't implement this before was I was hoping for a better way to do it.

All of the feathers widgets would be greatly simplified with a real reactive framework: I have similar widgets in both thorium_ui and bevy_reactor and they are a lot less messy.

Yep, this is just the least worst fix I could think of so it's not broken for the 0.17 release.

My naive idea for a proper fix I was thinking about earlier would be to rework the picking events to something like:

  • When a drag starts, dispatch Out before DragStart.
  • When a drag ends, dispatch Over after DragEnd.
  • Don't dispatch Over and Out while dragging.
  • For simplicity's sake, disallow simultaneous drags with multiple buttons.

And maybe add a Dragged component similar to Hovered that is updated when an entity's drag state changes.

@viridia
Copy link
Contributor

viridia commented Sep 10, 2025

On the web, the modern way to do this kind of dragging is to call setPointerCapture(), which means that all pointer events will be routed to the capture element, bypassing the normal picking logic. I lobbied for this a couple years ago, but I lost that argument.

@ickshonpe
Copy link
Contributor Author

ickshonpe commented Sep 16, 2025

On the web, the modern way to do this kind of dragging is to call setPointerCapture(), which means that all pointer events will be routed to the capture element, bypassing the normal picking logic. I lobbied for this a couple years ago, but I lost that argument.

Yes I quite like that. I guess it's pretty similar to my solution above, just more explicit than implicit. But with setPointerCapture it would eliminate any confusion when a drag starts with the pointer hovering more than one UI node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples S-Blocked This cannot move forward until something else changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants