use of ffx.ui.GraphicsCanvas.LeftButtonMode in project ffx by mjschnie.
the class GraphicsEvents method processStimulus.
// Most of the logic for mouse interaction with the Scenegraph is here.
/**
* {@inheritDoc}
*/
public void processStimulus(Enumeration criteria) {
viewOrbitBehavior.setEnable(false);
AWTEvent[] awtEvents = null;
while (criteria.hasMoreElements()) {
WakeupCriterion wakeup = (WakeupCriterion) criteria.nextElement();
if (wakeup instanceof WakeupOnAWTEvent) {
awtEvents = ((WakeupOnAWTEvent) wakeup).getAWTEvent();
if (awtEvents == null) {
continue;
}
for (int i = 0; i < awtEvents.length; i++) {
MouseEvent mouseEvent = null;
if (awtEvents[i] instanceof MouseEvent) {
mouseEvent = (MouseEvent) awtEvents[i];
processMouseEvent(mouseEvent);
} else {
continue;
}
if (!axisSelected) {
// Wake Up System Translate Behavior
if (rightButton && buttonPress) {
systemTranslate.setMouseButton(MouseEvent.BUTTON3_DOWN_MASK);
if (systemTranslate()) {
wakeupOn(postCriterion);
return;
}
}
// Wake Up Left Button Mode
if (leftButton && buttonPress) {
LeftButtonMode leftButtonMode = graphics3D.getLeftButtonMode();
switch(leftButtonMode) {
case ROTATE:
if (systemRotate()) {
wakeupOn(postCriterion);
return;
}
break;
case TRANSLATE:
systemTranslate.setMouseButton(MouseEvent.BUTTON1_DOWN_MASK);
if (systemTranslate()) {
wakeupOn(postCriterion);
return;
}
break;
case ZOOM:
globalZoom.setMouseButton(MouseEvent.BUTTON1_DOWN_MASK);
if (globalZoom()) {
wakeupOn(postCriterion);
return;
}
}
}
// Wake up Global Zoom Behavior
if (middleButton && buttonPress) {
globalZoom.setMouseButton(MouseEvent.BUTTON2_DOWN_MASK);
if (globalZoom()) {
wakeupOn(postCriterion);
return;
}
}
} else {
viewOrbitBehavior.setEnable(true);
wakeupOn(mouseCriterion);
return;
}
}
}
}
wakeupOn(mouseCriterion);
}
Aggregations