mouseDragged event problem with window scaling

I create a slider template and it works fine. I use mouseDragged event to get mouse position and change the slider x position relatively. I face a problem that when window maximize or I just manually scale up the slider template in run time when I press and hold mouse to change value, the mouse always left behind the handler. The bug effect on how much the template scale, the more scale the more offset.
Vice versa if I scale down template, this time the handle left behind the mouse icon.
In both cases I have some offset with my mouse icon and slider handle.
Slider v1.proj (10.1 KB)
what is the solution to prevent this behavior?

1 Like