I'm having trouble adjusting the view. I wish to draw a single scene
graph within my Canvas3D such that it is always entirely visable, no
matter what the dimensions of my Canvas3D are. (Ie, if I position the
viewer in a place so that he can see the entire thing, I'd like him to
continue seeing the whole thing even if the window size changes.) As a
result, the scale should be min(canvasWidth, canvasHeight) / 2.0, rather
than the default canvasWidth / 2.0.
I've tried doing this by putting a component listener on the Canvas3d to
detect when it resizes, and then execute the following:
if (view != null)
{
Dimension d = mainCanvas.getSize();
if (d.width < d.height)
view.setScreenScale(1.0);
else
view.setScreenScale((double)d.height / (double)d.width);
}
Unfortunately, this does nothing. I've also tried setting the scale
explicity from a text control:
String s = text_size.getText();
double d;
try { d = Double.parseDouble(s); }
catch (Exception e) { d = 1.0; }
view.setScreenScalePolicy(View.SCALE_EXPLICIT);
view.setScreenScale(d);
mainCanvas.repaint();
I've noticed that when setScreenScale() is passed anything above about
.0625 then the view acts as if it was View.SCALE_SCREEN_SIZE, and below
this number, nothing is rendered at all.
Any help on how to set the scale would be greatly appreciated.
Mark McKay
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".