The line in this method that checks the for AltDown and MetaDown should have the Bangs changed so that they match what you change the ones in the mouse behaviors to. If you look at this line in the picking behavior and compare it to the one in the mouse behavior, you will see that the Bang ("!") symbols are in the same areas.
I hope this helps.
Date: Mon, 26 Jun 2000 16:42:38 -0400
To: Ben Arbel <[EMAIL PROTECTED]>
From: Eric Reiss <[EMAIL PROTECTED]>
Subject: Re: [JAVA3D] PickMouseBehavior
Each pick behavior maps to a corresponding mouse behavior, so you actually change the masking of the mouse buttons in the mouse behavior class.
Look for the following lines in the processStimulus method within the mouse classes:
if ((id == MouseEvent.MOUSE_DRAGGED) && ((MouseEvent)event[i]).isMetaDown() &&
!((MouseEvent)event[i]).isAltDown())
In the above example I have remapped the mouserotate behavior so that the right mouse button is the one that has to be pressed. The right mouse button uses the MetaDown check and the middle button uses the AltDown check.
So for the above case it says, is the mouse dragged, is the meta button (right) clicked and is the alt button (middle) NOT clicked (notice the bang in front of the last check)
So the checks for the desired button would be as follows:
Left mouse button:
if ((id == MouseEvent.MOUSE_DRAGGED) && !((MouseEvent)event[i]).isMetaDown() &&
!((MouseEvent)event[i]).isAltDown())
Middle button
if ((id == MouseEvent.MOUSE_DRAGGED) && !((MouseEvent)event[i]).isMetaDown() &&
((MouseEvent)event[i]).isAltDown())
Right button
if ((id == MouseEvent.MOUSE_DRAGGED) && ((MouseEvent)event[i]).isMetaDown() &&
!((MouseEvent)event[i]).isAltDown())
Another combination would be to hold two buttons or the equivalent shift key.
What I mean is that clicking the left button while holding the Alt key on the keyboard is the same as just clicking the middle button. Unfortunately there is no Meta key on a PC running as Windows OS so be warned.
So to use a combination with both modifier keys, I would suggest using this condition check:
if ((id == MouseEvent.MOUSE_DRAGGED) && ((MouseEvent)event[i]).isMetaDown() &&
((MouseEvent)event[i]).isAltDown())
And to get it, hold the Alt Key on the Keyboard while holding the right mouse button. this would be equivalent to holding the middle and right buttons.
I have done this because I use the left button for something completely different. I use middle button for mouse translate (move), right button for mouse rotate and Alt Key and right mouse button for Zoom.
It made it easier to remember. Mibble = move, Right = rotate, and then Zoom is the oddball one where you have to use both modifiers.
This question comes up over and over again on this forum and i think that Sun will eventually modify the classes so that you get to map the buttons without having to edit the classes.
On final tip would be to not edit the Java3D behaviors but to copy their code into your workspace and configure the packages as your own so that you won't ever have to worry about someone running your code on an un-modified Java3D install (one without your remapped buttons).
At 03:17 PM 06/26/2000 -0400, you wrote:
HI
Can anyone please tell me how can i change the mouse mask being used in java3D mouse classes,
for example lets say i want to enable right mouse clicking using the PickMouseBehavior class
or for example the MouseRotate class
thanks
ben
***********************************************************************
Eric Reiss -
http://www.sigda.acm.org/Eric/
Email: [EMAIL PROTECTED]
SIGDA Internet Server Manager -
http://www.sigda.acm.org/
Assistant Systems Manager - School of Engineering
University of Pittsburgh
***********************************************************************
