iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
23.06k stars 1.06k forks source link

Additional functionality for sliders #900

Open sourcebox opened 3 years ago

sourcebox commented 3 years ago

I'm working on an application which mainly consists for sliders for parameter control. For better user experience, it would be nice to offer two features: reset to default and fine control.

On VST plugins this is normally done via double-clicks and/or modifier keys. E.g. double-clicking resets the slider to a default (mostly 0), alternatively Ctrl-/Cmd-Klick also does it. For fine control, often Shift-dragging is used. Fine control is useful in cases where the slider covers a large value range with only little screen space.

Is there a way to add such functionality with the existing code via traits or would that require an update to the widgets?

13r0ck commented 3 years ago

An event would have to be added to the widget. The text_input widget is a good one to see example of how to implement more complex event detection.

Without making a modification to iced, you MAY be able to get the same result by putting the slider inside a button and then watch for double clicks as a custom widget

13r0ck commented 3 years ago

An event would have to be added to the widget. The text_input widget is a good one to see example of how to implement more complex event detection.

Without making a modification to iced, you MAY be able to get the same result by putting the slider inside a button and then watch for double clicks as a custom widget

JL710 commented 3 weeks ago

Is this issue just forgotten or is there something that was not added in #2100?