Blank
Stereo GigaPan test page  by John Toeppen
crossed stereo pair



RIGHT
LEFT

This page is an example of how crossed viewing allows full color 3D viewing without using special glasses.  Another method called parallel viewing is also accomodated on the right hand side of the page.

Viewing these in stereo requires that the same subject is shown at the same size and postion in both the right and left windows.  Your mouse wheel or the + and - keys control image size. The arrow keys allow you to move the images left and right and up and down.



3
down voteaccepted

I don't have a specific answer to your question, but I have often found that the way to avoid the "infinite loop of resizing" you talk about is to defer your call to resize the window:

boolean correctAspectRatio = ...; // check to see if new size meets aspect ratio requirements

if (!correctAspectRatio) {
 
final Frame _frame = this;
 
final int _width = ...; // calculated width
 
final int _height = ...; // calculated height

 
SwingUtilities.invokeLater(new Runnable(){
   
public void run() {
      _frame
.setSize(_width, _height);
   
}
 
});
}

Does anyone have a script, or know of a way to maintain the aspect ratio of the window when a user resizes it?
Reply With Quote
  #2  
Old 05-04-2005, 04:21 PM
JavaScript Geek
 
Join Date: May 2005
Posts: 84
Sure, first figure out the ratio (this should be done onload):

Code:
//look for browser-specific measurements
var iWidth = (typeof self.innerWidth == "number" ? self.innerWidth : document.body.clientWidth);
var iHeight = (typeof self.innerHeight == "number" ? self.innerHeight : document.body.clientHeight);

//get ratio
var fRatio = iWidth/iHeight;
Then onresize, determine if you want the width or the height to control the new dimensions. If it's width, do this:

Code:
var iNewWidth = (typeof self.innerWidth == "number" ? self.innerWidth : document.body.clientWidth);

var iNewHeight = Math.round(iNewWidth * (1/fRatio));
window.resizeTo(iNewWidth, iNewHeight);
__________________
Nicholas C. Zakas
Author, Professional Ajax
Author, Professional JavaScript for Web Developers
Homepage: http://www.nczonline.net/


 
Gus Richter
Guest
Posts: n/a
 
      05-19-2009
Helpful person wrote:
> On May 19, 3:41 pm, Helpful person <rrl...@yahoo.com> wrote:
>> I have created a link. This leads to a page that has only an image.
>> Is there a way I can set the window size to be equal to the image
>> without using javascript?
>>
>> Thanks

> 
> I forgot to mention that I know the size of the image, so the width
> and height can be hard coded.



Instead of thinking to set the window size to the size of the image, 
which I think is impossible for all conditions IMHO, try to set the 
image to the window size.

<img src="image.png" style="width: 100%;">

-- 
Gus

<img src="image.png" style="width: 100%;">