> > I have a scene with a TransformGroup that has a MouseRotate > behavior attached to it. Under that TransformGroup is another > TransformGroup, which has its own MouseRotate behavior attached > to it. I enable either the inner or the outer behavior when > the canvas sees a "mouse press" by checking whether the <shift> > key is being pressed. Both behaviors are disabled upon a > "mouse release".
I believe this is similar to a bug I ran into with the current implementations of the Mouse behaviors. After a lot of tracing through the source code I figured out a fix that seems to get around this problem (again, I'm interpreting your problem to be the same as mine). It has to do with the proper reinitialization of the internal state variables (which were thankfully protected, not private) after calls to setEnable(). Source below. I hope it helps. Simeon /** * @author Simeon H.K. Fitch * @organization Mustard Seed Software * @web http://www.mustardseedsoftware.com * @email [EMAIL PROTECTED] * @voice 210.867.1616 * @fax 309.424.4982 */ /** * Container for classes in the Java3D library that have changes applied * to them due to bugs in the current implementation (version 1.2). * * @author <A HREF="mailto:[EMAIL PROTECTED]">Simeon H.K. Fitch</A> * @version $Revision: 1.1 $ */ public abstract class BugFixed { public static class MouseRotate extends com.sun.j3d.utils.behaviors.mouse.MouseRotate { /** * Overriden to fix a bug that doesn't initialize the class correctly * after it is reenabled via setEnable(); */ public void processMouseEvent(MouseEvent evt) { if(evt.getID() == MouseEvent.MOUSE_DRAGGED && !buttonPress) { buttonPress = true; x_last = evt.getX(); y_last = evt.getY(); } super.processMouseEvent(evt); } } public static class MouseZoom extends com.sun.j3d.utils.behaviors.mouse.MouseZoom { /** * Overriden to fix a bug that doesn't initialize the class correctly * after it is reenabled via setEnable(); */ public void processMouseEvent(MouseEvent evt) { if(evt.getID() == MouseEvent.MOUSE_DRAGGED && !buttonPress) { buttonPress = true; x_last = evt.getX(); y_last = evt.getY(); } super.processMouseEvent(evt); } } public static class MouseTranslate extends com.sun.j3d.utils.behaviors.mouse.MouseTranslate { /** * Overriden to fix a bug that doesn't initialize the class correctly * after it is reenabled via setEnable(); */ public void processMouseEvent(MouseEvent evt) { if(evt.getID() == MouseEvent.MOUSE_DRAGGED && !buttonPress) { buttonPress = true; x_last = evt.getX(); y_last = evt.getY(); } super.processMouseEvent(evt); } } } =========================================================================== 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".
