Add extra data to common components (Button, Slider)
-
Hey I am working on a project where I am using one base knob and have a couple of variations. For example I have one knob where I want to show a label, others where I want to hide the arc around it. Basically these are all the same Slider Knobs but just with some slight variations.
Currently what I am doing is to copy the LAF and create a variation like
LAF_knobNoLabel
orLAF_knobNoArc
and assign that to the respected knob. Is there a way that I can assign extra data for a common component like{ arc: false, label: true }
This would allow for a lot less code duplication in general.
-
You don't need to duplicate your code. Put the code that the three functions share into a separate inline function and call that from the laf functions. Then you just add the part that's different to the laf functions.