How can I improve the tracking when using LAF on a slider?
-
@VirtualVirgin I'm not 100% sure what you're asking but I think adjusting the mouse sensitivity of the knob might be the answer.
-
I've never gotten the scaleFactor or mouseSensitivity to do anything.
The tracking I am talking about here is the difference in space between the actual slider width and the LAF represented width. The distance traveled from min to max value on the LAF graphic is less than that of the actual slider, given that the knob has to have a margin to fit inside the slider graphic area (otherwise it will get cut off at min and max):
So that means the mouse is traveling a larger span than the knob is, so at min value the mouse cursor has to be all the way to the left of the knob, and at the max all the way to the right.
It's actually not a big deal when the sliders are small, but it is one of those details that will bug me.
-
@VirtualVirgin said in How can I improve the tracking when using LAF on a slider?:
actual slider width and the LAF represented width
Can you share your LAF?
-
@d-healey said in How can I improve the tracking when using LAF on a slider?:
@VirtualVirgin said in How can I improve the tracking when using LAF on a slider?:
actual slider width and the LAF represented width
Can you share your LAF?
// Local LAF for horizontal sliders const var horizontalSlider = Content.createLocalLookAndFeel(); // LAF horizontal slider horizontalSlider.registerFunction("drawLinearSlider", function(g, obj) { var a = obj.area; var thickness = a[3] * 2/20; var knobSize = a[3] * 5/10; g.setColour(obj.bgColour); g.fillRoundedRectangle([knobSize/2, a[3]/2 - thickness/2, a[2]-knobSize, thickness], 2); g.setColour(obj.itemColour2); g.fillRoundedRectangle([knobSize/2, a[3]/2 - thickness/2, (a[2]-knobSize) * obj.valueNormalized, thickness], 2); g.setColour(obj.itemColour1); g.fillEllipse( [(a[2] - knobSize) * obj.valueNormalized, a[3] /2 - knobSize/2, knobSize, knobSize]); });
-
@VirtualVirgin Looks like the circle goes all the way to the edge, so I don't see anything wrong with it.
-
@d-healey it's wrong in the way that the potential movement is restricted to
width - ellipse's radius
which create that mouse tracking issue.
So yes, mouse sensitivity is the way to go
Another option would be to draw in a panel and use a shorter slider on the top, but that would be two components... -
Forgot to mention that
mouseSensitivity
is working only for rotary sliders, so just change that and the LAF function and it'll work -
@ustk said in How can I improve the tracking when using LAF on a slider?:
Forgot to mention that mouseSensitivity is working only for rotary sliders
Aha that's the secret sauce!
-
@VirtualVirgin @d-healey Another secret, the mouse sensitivity is calculated on a basis of 250px, so a little trick allows us to automatically predict the sensitivity based on the potential mouvement we need:
HiseSnippet 2389.3ocyY07aaibEensoyJkrKR.1BzBTDLPGBn201RhxwIowNwN1VaD1XG0HGuYQPfwXxQRSLEGVxQ1VYQNVf9+Qu2y6+IEn21yEEnG5odnsu2PRQJKE+01lFGDINy6qeyady68FJ9IJtuK2c+HeQP.WQHFS2LT5vihjgDih6NHfSLtgYqA9ptazkI7IM1jX7qLasyVuZ+s.oC8YdaxTrcYG3wiHOYP.KJh6RLLl9aP1MJLCQ+2e+wOg4w7c3YSQH6IEN7mI5ITYy1bsuU34Um4x2UzKG2KsVCGo+FROYe.ZSaVgDvbNj0guCCYaJSxSYQcIFekYk6tLmeuZsccY0p4t7xK+f6+fkdPUV6JKwNn5xOXI6ktm88uWahwra4JTxvVJlB.uwLOQ5NnUW4w9wFXOQj.VV3fpjVfkimttzyEWh3rjM5J7bG5yh.O3L47fSG6A+RysEthgym4Iuol.MSh7NPioFEdSOB7plGdUxAuI.IibPZlXHcKyVNgh.UFEDOW2rgOro1lA6S4gRLujorm0bCIvguZwdrC40CgACkvZ4JUlmBeL2CKVD1qhTziXgzu0WdPU5pzTA6vUaH6EH8gAVkzTKARLp.1mo.1iKPsyTfZn.vekKSelzg4Qe150oskgztxPw6.wfoh7Dt7vnb5MiXKMsblvIjCaJZc8Lo7v08cqy4dVfUzKnEi3pwHdZ0kvr8kg4ZWTl0KUXQN1Br3oYdwPdGQDrGVuuuiRH8sJ4FxN9EREKbPLKklm1NkXm4oxCd6bE+ghEPeDCbJv3EYfC4gwSo5JbNzGBp.RrWW6MzuhZW1tRB0CgUQKw63YDua4pHwBEKzAWcwGwsPkdPm3Av5An0FxK7BYeLg0K3NJleGOt0qS0WY640JrrMcgLHDOq8aVHks4yn8l4o1yMYCKT7dwCs+4YaqQL9bvpEU+QLu97cjg8XdvrtWVLUMCSa44IBh3VfDEds1X.BNWygbq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jUJm28PH+G.1whlvB
-
@ustk said in How can I improve the tracking when using LAF on a slider?:
Forgot to mention that
mouseSensitivity
is working only for rotary sliders, so just change that and the LAF function and it'll workThanks :)
I changed the LAF and the component over to rotary/knob and now the mouseSensitivity does work.
Setting it to 0.35 seems to do the job.