PDA

View Full Version : Cross-browser Outer Window size?



Electroguard
03-30-2008, 11:27 AM
Hi, this is my first post, so please excuse if it's in the wrong area etc.

What I'm trying to do is create a re-sizable 'sized' window to display images on a 'canvas' that has a designated aspect ratio (eg:640 x 480), and provide the user with 'enlarge' and 'reduce' facilities which can do a 'window.resize' while retaining the 'canvas' aspect ratio (Note, NOT the window aspect ratio).

The problem is of course, that to resize and keep the 'CANVAS' aspect ratio means resizing the actual WINDOW to a different ratio each time, because unlike the canvas, the window has elements with thicknesses that CANNOT be resized in proportion (Title bar and side fames etc).

This wouldn't be much of a problem if I were able to obtain the windows outer dimensions, cos then I'd be able to subtract the canvas from the window to obtain the fixed window 'frame', work out the resized canvas proportions to the correct aspect ratio, then add back on the window 'frame' values, and resize the window to that.

Window.outerheight/width would have been ideal for getting the windows outer dimensions if it was cross-browser, but it isn't, so...
How can I find out the windows outer dimensions?

(The page is mainly javascript, but with some PHP as well).

Electroguard
04-03-2008, 09:50 PM
Well, I guess the lack of response means that it's not possible to get the outer window dimensions in all browsers ... which I find is pretty incredible really, and really shames the web standards policy makers!

For anyone interested, I've managed to get round the problem by resizing the window to specified dimensions and then subtracting the usuable internal 'canvas' area from it to obtain the top and side frame thicknesses, which I can then add back to any subsequently resized 'canvas' to be able to specify appropriate outer window dimensions for the resizing.

Medyman
04-04-2008, 04:07 AM
You're going to be resizing the window for each new image that a user views, and on zooming/unzooming?

I, and I'm pretty sure a great many other people, would find that incredibly annoying. You might want to rethink your approach here.

Electroguard
04-04-2008, 10:30 AM
No, the window is initially resized once to get the frame widths as mentioned.
I'm then resizing the images to fit the window while preserving their aspect ratio.
The only other resizing is if the user wishes to enlarge or reduce their viewable window area, which I achieve using zoom in/out buttons so I can preserve the image ratio within the exactly fitting frame. This entails specifying the exactly required 'resizeto' window dimensions of course, hence my original question.