Commit aef8403d authored by Eli Kahn's avatar Eli Kahn

In java code, handle situation when wheel rotation value is zero.

This commit makes sure no zooming occurs in the Java panels mouse
wheel handlers when getWheelRotation() returns a value of zero, which
is possible for some high resolution mouse wheels.

Change-Id: I16d5c008f6c14fd797e68e567800800e9d2ea00e
parent 14902f4c
......@@ -299,11 +299,14 @@ public class vtkInteractorForwarder implements MouseListener, MouseMotionListene
lastY = e.getY();
ctrlPressed = (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK ? 1 : 0;
shiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK ? 1 : 0;
component.getRenderWindowInteractor().SetEventInformationFlipY(lastX, lastY, ctrlPressed, shiftPressed, '0', 0, "0");
if (e.getWheelRotation() > 0)
if (e.getWheelRotation() > 0) {
component.getRenderWindowInteractor().SetEventInformationFlipY(lastX, lastY, ctrlPressed, shiftPressed, '0', 0, "0");
component.getRenderWindowInteractor().MouseWheelBackwardEvent();
else
}
else if (e.getWheelRotation() < 0) {
component.getRenderWindowInteractor().SetEventInformationFlipY(lastX, lastY, ctrlPressed, shiftPressed, '0', 0, "0");
component.getRenderWindowInteractor().MouseWheelForwardEvent();
}
} catch (InterruptedException interupt) {
// Nothing to do
} finally {
......
......@@ -243,13 +243,15 @@ public class vtkCanvas extends vtkPanel implements MouseListener, MouseMotionLis
ctrlPressed = (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK ? 1 : 0;
shiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK ? 1 : 0;
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
Lock();
if (e.getWheelRotation() > 0)
if (e.getWheelRotation() > 0) {
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
iren.MouseWheelBackwardEvent();
else
}
else if (e.getWheelRotation() < 0) {
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
iren.MouseWheelForwardEvent();
}
UnLock();
UpdateLight();
......
......@@ -336,7 +336,7 @@ public class vtkPanel extends Canvas implements MouseListener, MouseMotionListen
}
public void mouseWheelMoved(MouseWheelEvent e) {
if (ren.VisibleActorCount() == 0)
if (ren.VisibleActorCount() == 0 || e.getWheelRotation() == 0)
return;
int exponent;
exponent = -10 * e.getWheelRotation() / Math.abs(e.getWheelRotation());
......
......@@ -90,13 +90,15 @@ public class vtkRenderWindowPanel extends vtkCanvas {
ctrlPressed = (e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK ? 1 : 0;
shiftPressed = (e.getModifiers() & InputEvent.SHIFT_MASK) == InputEvent.SHIFT_MASK ? 1 : 0;
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
Lock();
if (e.getWheelRotation() > 0)
if (e.getWheelRotation() > 0) {
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
iren.MouseWheelBackwardEvent();
else
}
else if (e.getWheelRotation() < 0) {
iren.SetEventInformationFlipY(e.getX(), e.getY(), ctrlPressed, shiftPressed, '0', 0, "0");
iren.MouseWheelForwardEvent();
}
UnLock();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment