I tried your change but it doesn't work see screenshot. There is still a bit to touch when the value is at its maximum. Maybe it's seriously because I'm testing it on Windows 10.
Hello, I'm back. Sorry for the waiting.
I've just tested the code on Lazarus 3.6 64-bit on Lenovo Legion Windows 10 laptop. See the screenshot below. I still couldn't reproduce the issue. I believe the the problem is in the part of the code you didn't show us. Bugs can hide in any part in the source code, we need to inspect the 'whole' source code to be able to fix the bug.
Please provide us the whole source code, or if you want, you can contact and send it personally to me. I can even install TeamViewer or Teams, etc if you want.