You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for a great little lib. I think the drag is a bit coarse on the AudioKnob, e.g. when the knob is say 32px, then the drag is just divided into 32 steps
I have tried this with some success, simply introducing a scale factor so the user can drag N times the diameter (So you'd use 3 or 4). E.g.:
// self.drag_length: f32; a scale for how many diameters need to be dragged to cover the knob range
new_value += delta *(self.range.end() - self.range.start()) / (self.diameter*self.drag_length);
There are obviously other ways off accomplishing the same thing (E.g. using Some(100.0) as an optional fixed override might be better because it gives the user a way to provide the same drag-length for all knob sizes if they vary across the UI). E.g.:
// self.drag_length: Option<f32> an override to indicate how long to drag.
new_value += delta *(self.range.end() - self.range.start()) / self.drag_length.unwrap_or(self.diameter);
I just use fixed 32px knobs so my use case was fine with a simple multiplier. I can submit a PR for this but I thought you might have some input on the api first.
Btw is there an issue with the shift-drag snapping for the AudioKnob? I can't quite get that working.
The text was updated successfully, but these errors were encountered:
I'd reference how I do this in my code. My version also has the ability to fine-tune controls by scrolling the mouse wheel and/or holding down shift while dragging.
In fact, you can even use this logic for sliders to have fine-tune controls for those as well.
This is a concept called a "virtual slider" where every control has the same input behavior. The only difference between controls is how they are drawn.
Thanks for a great little lib. I think the drag is a bit coarse on the AudioKnob, e.g. when the knob is say 32px, then the drag is just divided into 32 steps
Existing impl:
egui_extras_xt/egui_extras_xt/src/knobs/audio_knob.rs
Line 145 in d166b9a
I have tried this with some success, simply introducing a scale factor so the user can drag N times the diameter (So you'd use 3 or 4). E.g.:
There are obviously other ways off accomplishing the same thing (E.g. using Some(100.0) as an optional fixed override might be better because it gives the user a way to provide the same drag-length for all knob sizes if they vary across the UI). E.g.:
I just use fixed 32px knobs so my use case was fine with a simple multiplier. I can submit a PR for this but I thought you might have some input on the api first.
Btw is there an issue with the shift-drag snapping for the AudioKnob? I can't quite get that working.
The text was updated successfully, but these errors were encountered: