Re: Java3D bug using JDK11
Posted by Don on Oct 02, 2019; 4:59pm
URL: https://forum.jogamp.org/Java3D-bug-using-JDK11-tp4039952p4040080.html
Thanks Phil for looking into this. I am not a professional programmer -- just dabble every now and then with Java, I havenn't had time to set up your code below for my system, but may be able to do so one of these days. In the meantime, I wanted to give you more info about my current code situation. See below:
Platform: Windows 10
Development environment: Netbeans 11
Mouse: 3 button. Middle button can be depressed and also scrolls (it is really a wheel).
a. JDK 1.8: Scrolling (rotating) with middle button does nothing, but one can depress the middle button and then translate it to get the desired zooming behavior. The portion of the code below that successfully performed this functionality is currently commented out below but shown for awareness – to show what was successful with JDK1.8. This is the functionality that I wanted.
b. JDK11 : Using the code exactly as shown below, depressing middle button causes same functionality as use of left button (and also right button has same functionality). I really didn’t want all 3 buttons performing the same function. But by scrolling the middle button, instead of depressing it, I can get desired zoom behavior, but not as smoothly.
CODE FOLLOWS:
private void setupMouseBehavior()
{
//we want these mouse actions to work over the following
//100km bounding sphere:
BoundingSphere bs = new BoundingSphere(new Point3d(),
(float)StarChart3Dpanel.MAX_DIST);
//Set up the RA panning behavior around TG1.
MouseRotate mouseRot = new MouseRotate();
mouseRot.setTransformGroup(tg1);
mouseRot.setSchedulingBounds(bs);
tg1.addChild(mouseRot);
mouseRot.setFactor(0.003,0.0); //turns off vertical motion of button
//Set up the DEC panning behavior around TG2.
MouseRotate mouseRot2 = new MouseRotate();
mouseRot2.setTransformGroup(tg2);
mouseRot2.setSchedulingBounds(bs);
tg2.addChild(mouseRot2);
mouseRot2.setFactor(0.00,0.003); //turns off horizontal motion of button
/* Don't allow this. We want to use the right mouse button for popups
MouseTranslate mouseTrn = new MouseTranslate();
mouseTrn.setTransformGroup(tg1);
mouseTrn.setSchedulingBounds(bs);
tg1.addChild(mouseTrn);
mouseTrn.setFactor(0.02); //default is 0.02 THIS IS THE RIGHT BUTTON
*/
// -------------------------------------------------------------
/**
// NOTE: this works with Java 1.8 and earlier, but not Java 11.
//Set up ZOOMing behavior around TG3.
MouseZoom mouseZoom = new MouseZoom(); //CENTER BUTTON (or ALT-leftButton)
mouseZoom.setTransformGroup(tg3);
mouseZoom.setSchedulingBounds(bs);
tg3.addChild(mouseZoom);
mouseZoom.setFactor(0.001);
//System.out.println("mouseZoom");
* */
// The following works with Java 11:, but is not as easy to use as above.
//Ease of use can be fixed by changing 0.001 to a different value.
MouseWheelZoom mwz = new MouseWheelZoom();
mwz.setTransformGroup(tg3);
mwz.setSchedulingBounds(bs);
tg3.addChild(mwz);
mwz.setFactor(0.01);
// --------------------------------------------------------------
}