xTibor / egui_extras_xt

MIT License
82 stars 9 forks source link

New widget: EncoderKnob #17

Open cgoehl opened 1 year ago

cgoehl commented 1 year ago

Thanks for the lib. leaned quite a bit while reading the code.

I wanted to represent a rotary encoder. The AudioKnob is not endless. AngleKnob still has a position and the interaction is not optimal. (moving upwards should increase the value regardless of side).

Find the prototypical implementation here: https://github.com/cgoehl/egui_extras_xt/blob/master/egui_extras_xt/src/knobs/encoder_knob.rs . Feel free to adopt into your repo.

I did not model ticks / detents, as I have no need for that. (The actual HW uses endless potentiometers, not an encoder.)

xTibor commented 1 year ago

Yes, encoders would be nice to have. However I would rather avoid adding a new standalone knob-like widget because things are heading into unmaintainable direction.

I'd like to consolidate all the knob widgets by having some kind of abstract knob module implementing a unified knob style and common knob behaviors, then deriving all these custom knobs from that. I don't know how yet, gonna need some brainstorming.

knob

Knob styles above are for illustrative purposes only. They gonna need a style that doesn't clash with the built-in egui widgets.

Also move everything into a new egui_knobs_xt crate, so I could stabilize things and publish them on crates.io. May take a while, recently I did not have much energy to work on this library.