On Thu, 7 Mar 2002 08:52:53 -0600, Simeon H.K. Fitch <[EMAIL PROTECTED]> 
wrote:

>>
>> 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
>
>    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);
>        }
>    }


OK, this mostly fixes my problem.  However, when I enable one of the behaviors, its
"x_last" and "y_last" appear to be whatever the mouse coordinates were
when I last disabled a behavior, whichever it may have been.

Nonetheless, thank you for showing me the way -- I believe I will now
be able to track down this last bug.

Charles Whitley

===========================================================================
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".

Reply via email to