jMonkeyEngine-Contributions / Lemur

Lemur is a jMonkeyEngine-based UI toolkit.
http://jmonkeyengine-contributions.github.io/Lemur/
BSD 3-Clause "New" or "Revised" License
116 stars 33 forks source link

Movement of camera ignored during click and drag events #106

Open richardTingle opened 2 years ago

richardTingle commented 2 years ago

Summary

If the camera moves during a click and drag event on a 3d gui the camera movement is ignored; it behaves as if the mouse hasn't moved at all (which from one perspective it hasn't, but the gui has moved from under it so its pointing at a different point).

Steps to reproduce

1) Set up a 3d lemur UI as follows

public class Main extends SimpleApplication{

    public static void main(String[] args) {
        AppSettings settings = new AppSettings(true);

        Main app = new Main();
        app.setLostFocusBehavior(LostFocusBehavior.Disabled);
        app.setSettings(settings);
        app.setShowSettings(false);
        app.start();

    }

    @Override
    public void simpleInitApp(){

        GuiGlobals.initialize(this);
        BaseStyles.loadGlassStyle();
        GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");

        Container myWindow = new Container();
        myWindow.setLocalScale(0.1f);
        Label label = new Label("Hello, World.");

        myWindow.addChild(label);

        VersionedList<String> dropDownExamples = new VersionedList<>(List.of("Alpha","Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa"));
        myWindow.addChild(new ListBox<>(dropDownExamples));

    }

}

2) Start the app

3) Click and hold the scroll bar of the ListBox

4) While holding click the keyboard down arrow to move the camera

Expected result:

The scroll bar moves with the effective position of the mouse

Actual results:

Nothing happens

Why I care

I realise this may seem a tad pedantic, the reason I care is that I'm moving Tamarin from using its own pick lines and handling click events itself to creating a synthetic viewport and camera at the position of the hand and dispatching mouse events (always claiming the mouse is in the dead centre of the synthetic-viewport). This has immediately solved a bunch of problems and works much better (I guess closer to how Lemur is supposed to work)

So when the hand is clicking and dragging that occurs by the synthetic hand-camera changing its position, but as the steps to reproduce show that kind of gui-moving-under-the-mouse type movement doesn't translate into a click and drag