I finally figured a little feature that I've been working on off-and-on, but just haven't gotten a firm solution figured out has been ... well ... figured out, and it was small enough that it shouldn't cause any new issues, so it's getting shoved into the 2.2 branch and is the only change for this version.
The new feature is that the font size of timers is now generated automatically, rather than being set, and will fit itself into whatever the timer window's size is. (i.e. dragging the window larger will make the timer larger) The impetus here was this image. Yes, I actually actively look for RTools being used in the wild; even something as small as that. (keep looking, you'll see it...)
I saw that image and saw a use case I hadn't thought of before, and started looking into what I'd need to change to make timers scale automatically to just fit the window dimensions. The biggest problem is actually in the positioning of the timer text itself in that window. One interesting quirk about Java in the context I use for that timer is that it isn't easy to exactly center that text.
If you think of the timer window as a grid of pixels, the line of code which actually puts the text in the window needs to know the bottom-left pixel to start drawing from. This grid is generated using the top-left pixel as (0,0), and going to the right & down incrementing in positive numbers. Seems simple, right? Well, the top-left pixel isn't the pixel in the black space, but instead is located in the title bar; if you think of the title bar as covering up more black space, the top-left pixel is where it would be if it weren't covered up. The problem here is that different Windows skins have different heights for that title bar, and it can also be changed manually in your display settings. So, the usable space for the timer needs to be guesstimated to keep it guaranteed in a visible area no matter the computer. When it comes to automatic scaling, the issue came down to adjusting this somewhat-complex setup for positioning the text, and successfully accounting for this title bar while also not falling for a myriad of other quirks in this particular portion of the language.
So, that's just an overly-long explanation of what is different about beta 2, and also a little glimpse into a bit more interesting issue.
No comments:
Post a Comment