Page 1 of 1

Slider Rounding Errors?

Posted: Mon Jun 04, 2012 5:47 am
by Code
I've been trying out different sliders and noticed that when moving the thumb around the width of the left and right get miscalculated. The bar can grow and shrink or the thumb can overlap the sides incorrectly as well. It even sometimes depends on the positioning of the sliders themselves in the window!

I don't know if this can be fixed, but it's something to look out for. You can even see this bug happen in the tutorial level's preferences page. I've compiled a screenshot that shows the two bugs I'm talking about.

The first is just the bars without extra explanation, the second image is stripped down to just the slider bars and has white lines I've added in to showcase measuring discrepancies. Bar #1 is measured correctly at the native width of 192 pixels while bar #2 has the thumb moved slightly and it throws off the measurements yielding a width of 191 pixels. Bar #3 has the thumb in the right place with the left and right bars cut off at the correct widths but bar #4 has the thumb nudged 1 pixel to the left where the left and right bars are incorrectly still registering the same widths as bar #3.

I hope that makes sense, and if not I hope the images convey the problem. My speculation is a rounding error but I can't be sure what it is.
Compare.png
Screenshot of the sliders.
Compare.png (16.64 KiB) Viewed 1062 times
Compare_detail.png
Detail of the sliders with measurements.
Compare_detail.png (9.05 KiB) Viewed 1062 times

Re: Slider Rounding Errors?

Posted: Mon Jun 04, 2012 10:08 am
by PyTom
I will look into this.

Re: Slider Rounding Errors?

Posted: Mon Jun 04, 2012 10:01 pm
by Code
Oh, and this is in Ren'Py 6.13.12.1728 (the latest?) in case that matters.

Thanks for looking into it! :D

Re: Slider Rounding Errors?

Posted: Mon Jun 11, 2012 10:07 pm
by SleepKirby
I've also observed this bar issue in both of the games I'm working on. In one case, I just made the slider "slot" (the dark blue line, in the Tutorial's case) part of another element instead of part of the bar itself. So I guess that would be the workaround until there is a fix.