Multiple mousebehaviors ? Do you folks encounter a jump in your
geometry while doing the following:

1. Enable behavior 1 and manipulate the geometry under it.
2. Disable behavior 1, enable behavior 2 and manipulate the
   geometry under it.
3. Disable behavior 2, enable behavior 1.

Now, upon the very first mouse click, the geometry under behavior 1
may probably show a sudden jump. I was not sure whether this had
anything to do with the various other stuff that I had introduced to
enhance the behaviors, but I was suspicious of the usage of the boolean
flag "reset". Had a post on this last month, if I remember right.
Haven't had a chance to dig deeper, since I have now shifted to using
OrbitBehavior.

Raj




>On Thu, 7 Mar 2002 11:30:58 -0700, Charles Whitley <[EMAIL PROTECTED]> wrote:

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

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