Difficulty in making a slider using LAF
-
So I have a slider going with custom look and feel:
To draw the circle properly, the rounded rectangles must be smaller that the object area:
But I have a quandary here over making the values fit the area I want on the slider.
The circle, when pulled back to 0 value gets cut off by the object area:
Or at full value (127):
So I want the 0 value of the slider to start here:
But I don’t see a way to change the scale of the slider value area to the area of the component object.
It seems the min value is located at the absolute x = 0 position of the object.
Is there any way to scale the slider range inward from object area itself?Or are they completely bound in this situation?
-
@VirtualVirgin can you share a snippet of the laf?
-
@VirtualVirgin said in Difficulty in making a slider using LAF:
Or are they completely bound in this situation?
You have to use a bit of maths to calculate the x position based on the value.
Here's my horizontal slider code, perhaps the solution is in there - https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/includes/LookAndFeel.js#L315
This part looks likely - https://codeberg.org/LibreWave/RhapsodyBoilerplate/src/branch/main/includes/LookAndFeel.js#L371
-
@ulrik said in Difficulty in making a slider using LAF:
@VirtualVirgin can you share a snippet of the laf?
HiseSnippet 2668.3ocsY07aabbEeojWGy0NINHI.sGJvBhhBJUEpkjq9fwwwTeZqDJKBQZ0DHHXLZ2gjS7xcH1co9vFBnG5ghBzC8XOza9lOzh9OP6w9mSNFfbP8MyreLK+PhjHlPPjy6Mu2798du4Mya25dTKruO0SIiVyK6gUx7.0FW5FzYqNHhqxdaqj4yUah61yAEf0qswt5m1OHf5pr4k8P99XakLYl+orolI6cT3e9wmrIxA4ZgSHonbDkXgqQ5RBRnVu52Rbb1EYiaR5JMayp6YQc2h5P6Cl07pFJ8PVuB0F+bDaZyop7LjeGkLKpZYYVAudqRqYTpBdEaySKUz.UxnRk0vnULrNsBFUp0oVFJYt6N1j.pWi..F9JYtylT6KazgdtqXANh3SN0AyFTToArxBx6RcrYPjQUYqNDG65Q9KeEPK0S7dyK7del59DaRL8Du3C4LzSjP1AlYtzl27oLuhxlmgj4MBSJijIcGgI8IpMr7H8BR3vrm6qtma.1qEBhSxlhXtJy8Otu5VTXFtAE5hdEdWOXPrD4KZXXrj9pFFK7HMsk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wNMhfZNS+hckWYl6gt+fSXjsjLfi0iNG27ZmTEl.2d3oY.o.RHCsC8uXC2+To3BtsXZ+dSliyLANBELeM3X5Shdh6AAAvjrbBNmaie+qy6ePvjSMSz8HrVwfyU2iGD1FJL7of2Ev4to0jyLllHIxkMxlLPapfDKbK7kprhQ1IUYkLknPruRdleRqGyitdbLBvIQ7CTm28HirWkwZ1.evkF1Y99itU2yvpSqg0lVCWaZMb8o0vMlVC2bZMbq+eCMOQemAZYXx0FD5nVGDObvw4.AFp.iqVQ+KXgXLx
-
@ulrik said in Difficulty in making a slider using LAF:
@VirtualVirgin something like this?
HiseSnippet 1185.3ocsVssaabCDkqs2fX0l1Zf9ArvOIaH6nK9JBJp7M0HTaG0HmfBDXXPsjqDq4RJvkx1JEAveL9KneA42I8o9ddvc3dwKkrbahPx9zNmgCmyLb3LrkR5SihjJjSgSF1mhb9V21CE5d60CyDnl6ibVv8PlfhUs4LBUcHN.s6v93nHJA43L6uXVly7ygh+9medWLGK7o4PHzqkLe5grPlNGsU8ekw4MvD5IrPqUuV8l9RwdRtb.PoYcKi5i8OG2kdL1rrYbQOGG0C4rrKtVMRvFar01D+0Vux1A3MI9cps85TR00pQ2lRHaVizIH.47nCHLsT0Vi0zHjyb6JICa2SdoHwAulEw5voFgJn1fmSfaH4DSHZPQ60iwIsxxUQHXWZkm4lMIy8itGwHr6vyyf+PrBubKrSfNyLJ8lcD5Uwldksn2DnjiEklKgRK311Ww5qy0X3y231Tnop.LbNYSkj0hlYk4b2SBqPnWMDeNsgBDtyhh0JWtjW0xkW5YEJ.mUQZuKvJO9n0Hd+jW1V3qnPjcnzGyOTJOeGAoAkxKZLeLiVUQ6xh.+zXfvWyjhhKRT3KsK+VrjWPlxtk7jc9ikJ7mEl2v.L3SPdUL3umk.ICBhnZ.eqTfyExNsYukBP32T6T.sv7cWEVSREWQi8c5lH.DDzE.kouTNP.0Buj5qwhtbZw2jrwkRcvSqVB1tpmtRh3xwh0xDOsj2FKMQOwzzvDwpedNqnwadq3k4uk7VNNzu.yGPOVpBwbHHIe1znRNMNfyY8i.uOtufeyxhO8gcLThjsp7+Ncx9WSuRamxAsMfZG3vmFfGv0vYdkxIpLkC6vYcETxIfUEuy26DYjK48Ektk7VzGpfUTxhf6e2nE71UkVU6cMgVXeofZhfQJcA6skMw48tUL1MBiKS+xJ68jhikZ5KDEiq7K7tBdiqJHXh5LTTI4bpZhpMMhU+WFVTLHrCUUxKN8c2BglMi1Ay8g6fY2f0OIiYsPonofoeQep3gZ6hRSyltcorBVpNtW22k1qKI4gXDCjcBGEy66l0b8qpidUy8wZb1tAaL3r9TklYhCm8oW.StR5jNu69zny0x9wqM8.F473De+jr9rXAkm5ZKjJnqrGHNzV3RFQ26Nf2qp2ix51yZTIqd9ET.8Qe3C+MMFOu6gAVJksLviPuu+SM0jyuqaVOmeW+a0izC4wOK34RE6sPVByQgLBgSaIiXlJD6o5P269l6N1OIHDmu6u+r5iFvP3Md.u1XA7G+3s2Zvy6SXPAfXzr10Frat4l+xf0GlAHzV4gwNMhfZNS+hckWYl6gt+fSXjsjLfi0iNG27ZmTEl.2d3oY.o.RHCsC8uXC2+To3BtsXZ+dSliyLANBELeM3X5Shdh6AAAvjrbBNmaie+qy6ePvjSMSz8HrVwfyU2iGD1FJL7of2Ev4to0jyLllHIxkMxlLPapfDKbK7kprhQ1IUYkLknPruRdleRqGyitdbLBvIQ7CTm28HirWkwZ1.evkF1Y99itU2yvpSqg0lVCWaZMb8o0vMlVC2bZMbq+eCMOQemAZYXx0FD5nVGDObvw4.AFp.iqVQ+KXgXLx
Ooh! This looks great. Excited to try it out later.
-
@ulrik
Worked great! I like the that the text value follows the slider. I was considering adding that in :)