I think I’m experimenting this same issue.
I have a 3D scene with some clickable objects. To move the camera I also need to use the mouse so I though on putting a transparent panel in the whole screen listening to mouse events and moving the camera when clicking + moving (consuming the release event if moved).
However, it seems to be that if that panel listens to mouse button events these aren’t propagating (just if they were consumed). It seems to be intended looking at the code and it is what I assume it is said in the supplied link.
So I wanted to confirm if this is the intended behavior and if so, which would be a great workaround to this without involving mixing another mouse listener system?
A simple test-case is:
public class LemurMouseButtonIssue extends SimpleApplication {
public static void main(String[] args) {
new LemurMouseButtonIssue().start();
}
@Override
public void simpleInitApp() {
GuiGlobals.initialize(this);
BaseStyles.loadGlassStyle();
GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");
Container container = new Container(new SpringGridLayout());
container.setBackground(new QuadBackgroundComponent(ColorRGBA.BlackNoAlpha));
container.setPreferredSize(new Vector3f(cam.getWidth(), cam.getHeight(), 1));
container.setLocalTranslation(0, cam.getHeight(), 0);
container.setName("Outer container");
Panel panel = container.addChild(new Panel());
panel.setInsets(new Insets3f(300, 300, 300, 300));
panel.setName("Inner panel");
MouseListener mouseListener = new DefaultMouseListener() {
@Override
public void mouseButtonEvent(MouseButtonEvent event, Spatial target, Spatial capture) {
if(event.isReleased()) {
System.out.println(target.getName() + ": mouse released. Consumed: " + event.isConsumed());
}
}
// This one works
// @Override
// public void mouseMoved(MouseMotionEvent event, Spatial target, Spatial capture) {
// System.out.println(target.getName() + ": mouse moved");
// }
};
MouseEventControl.addListenersToSpatial(panel, mouseListener);
MouseEventControl.addListenersToSpatial(container, mouseListener);
guiNode.attachChild(container);
}
}