🕸💡📝Fergus Duniho wrote on Sat, Mar 2, 2013 03:28 AM UTC:
I have begun to make Game Courier maximize the board size on mobile devices. Using window dimensions provided by cookies set with JavaScript, it automatically sets a scaling factor for grid-based boards rendered as images. This scaling factor is set to allow the board to be as large as it can on a mobile screen, and it overrides the value normally set for Scale. The device should be turned to the orientation (landscape or portrait) that best fits the board. It will usually be too big for one orientation but fit well in the other. Until cookies are set, it will sometimes be necessary to refresh the page until board size changes to fit the screen.
If you don't want to use this feature, you can render a board as a table or as CSS, or you can change the user agent for your browser so that it doesn't get recognized as a mobile device.
Here are technical details. Two cookies are kept, one for the landscape dimensions, and one for the portrait dimensions. Only one cookie will be set at a time, that being the one matching your tablet's orientation. For boards that are wider than they are tall, such as for Shogi, Crazyhouse, and 10x8 boards, the landscape dimensions will be used to find the best fit for the board. For boards that are taller than they are wide, such as Chinese Chess, the portrait dimensions will be used. When the appropriate dimensions are not available, it will make do with dimensions for the other orientation, switching the width and height. When no cookies are available, it will not resize the board, and it will allow zooming by touch. Otherwise, so that it can resize the board appropriately, it will disable zooming by touch.
Ideally, I would like to set the zooming factor, so that it works for any board rendering. But it gets complicated, because I don't have all the information on board size until after the zooming factor gets set in the meta tag, but what I've tried hasn't worked. So, instead, it makes use of Game Courier's ability to resize boards rendered as images. Alternately, I would like to use CSS to resize the board, but the CSS that resizes an image does not resize the AREA MAP that covers it. Maybe I could use CSS to resize a CSS rendered board, but then I would have to resize the pieces too. If I did that, I suppose I could use CSS to change the sizes of pieces on table boards too. It's something to look into down the line.