diff options
author | Sven Gothel <[email protected]> | 2023-09-30 01:46:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-09-30 01:46:36 +0200 |
commit | 05a344b98277a19858cd5c4a22e93620ec05a8d5 (patch) | |
tree | 99fc577ed5c0b7ce8dc350e141596a81f3603fc5 /src/graphui/classes/com | |
parent | b38890a32ff35e364d5c433a0afa6c9fdda2c90a (diff) |
Bug 1467 - GraphUI: Don't de-activate a Shape if became active via 'mouseOver' (mouseDragged)
When using a mouse, Scene activates a Shape if mouse is over it (mouseOver).
Hence don't de-activate such Shape via mouse-button clicked or released.
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Scene.java | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/Scene.java index 22eb653de..15ea27b14 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Scene.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Scene.java @@ -1008,11 +1008,15 @@ public final class Scene implements Container, GLEventListener { winToShapeCoord(shape, glWinX, glWinY, pmv, objPos, () -> { shape.dispatchMouseEvent(e, glWinX, glWinY, objPos); }); } - private class SBCMouseListener implements MouseListener { - int lx=-1, ly=-1, lId=-1; + private final class SBCMouseListener implements MouseListener { + private int lx, ly, lId; + private boolean mouseOver; - void clear() { - lx = -1; ly = -1; lId = -1; + private SBCMouseListener() { + clear(); + } + private final void clear() { + lx = -1; ly = -1; lId = -1; mouseOver = false; } @Override @@ -1034,10 +1038,12 @@ public final class Scene implements Container, GLEventListener { final int glWinX = e.getX(); final int glWinY = getHeight() - e.getY() - 1; dispatchMouseEvent(e, glWinX, glWinY); - if( 1 == e.getPointerCount() ) { - // Release active shape: last pointer has been lifted! - releaseActiveShape(); - clear(); + if( !mouseOver ) { + if( 1 == e.getPointerCount() ) { + // Release active shape: last pointer has been lifted! + releaseActiveShape(); + clear(); + } } } @@ -1046,11 +1052,15 @@ public final class Scene implements Container, GLEventListener { // flip to GL window coordinates final int glWinX = e.getX(); final int glWinY = getHeight() - e.getY() - 1; - // activeId should have been released by mouseRelease() already! - dispatchMouseEventPickShape(e, glWinX, glWinY); - // Release active shape: last pointer has been lifted! - releaseActiveShape(); - clear(); + if( mouseOver ) { + dispatchMouseEvent(e, glWinX, glWinY); + } else { + // activeId should have been released by mouseRelease() already! + dispatchMouseEventPickShape(e, glWinX, glWinY); + // Release active shape: last pointer has been lifted! + releaseActiveShape(); + clear(); + } } @Override @@ -1085,8 +1095,7 @@ public final class Scene implements Container, GLEventListener { } final int glWinX = lx; final int glWinY = getHeight() - ly - 1; - // dispatchMouseEvent(e, glWinX, glWinY); - dispatchMouseEventPickShape(e, glWinX, glWinY); + mouseOver = dispatchMouseEventPickShape(e, glWinX, glWinY); } @Override public void mouseEntered(final MouseEvent e) { } |