I'm desperatly searching a way of scaling objects (in fact only Box
primitives) with the mouse. The scale could be non-uniform, depending on the
move of the mouse.
I try to modify MouseTranslateBehavior this way and I always get a
BadTransformException ... non-affine transform.
Is there a problem with non-uniform scaling or the way I implement this is
completly wrong.
Any hints would be greatly appreciated ! Thanks.
Fred
if (Design3D.getToolsFrame().scaleButton.isSelected() && (id ==
MouseEvent.MOUSE_DRAGGED)
&& !((MouseEvent)event[i]).isAltDown() &&
!((MouseEvent)event[i]).isMetaDown()) {
x = ((MouseEvent)event[i]).getX();
y = ((MouseEvent)event[i]).getY();
dx = x - x_last;
dy = y - y_last;
if ((!reset) && ((Math.abs(dy) < 50) && (Math.abs(dx) < 50))){
transformGroup.getTransform(currXform);
scale.x = Math.abs(dx*xS_factor);
scale.z = Math.abs(dx*yS_factor);
currXform.setScale(scale);
transformGroup.setTransform(currXform);
transformChanged( currXform );
if (callback!=null)
callback.transformChanged( MouseBehaviorCallback.TRANSLATE,
currXform );
} else {
reset = false;
}
x_last = x;
y_last = y;
} else if (id == MouseEvent.MOUSE_PRESSED) {
x_last = ((MouseEvent)event[i]).getX();
y_last = ((MouseEvent)event[i]).getY();
}
===========================================================================
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".