Fix issue #112, NPE in RocketFigure3d mouseDragged()

The component can pick up a mouse drag event without a mouse press event
if the mous is clicked and dragged while a modal dialog is open. The
running simulations progress bar dialog is an example. To fix, do not
process a mouse drag if a mouse press has not been recorded.
This commit is contained in:
bkuker 2013-09-02 18:29:30 -04:00
parent 265fdfe05e
commit 0bc139fd05

View File

@ -234,6 +234,10 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
@Override
public void mouseDragged(final MouseEvent e) {
//You can get a drag without a press while a modal dialog is shown
if (pressEvent == null)
return;
int dx = lastX - e.getX();
int dy = lastY - e.getY();
lastX = e.getX();