Draggable Window in Lemur

I want to create a draggable window akin to those featured in graphical OSes like Windows, Linux and so on. There is a bar at the upper edge of the window that allows moving the window around with the help of the mouse. I have not found any mention of implementing this in Lemur.

Am I missing something and it is somehow available in the library? Or do I have to implement it myself, and if so, what would be the recommended approach to be more Lemur-idiomatic?

I thought this was already in the demo. If you add the default drag handler to the window then it will let you drag it anywhere you click. You can also add it to just the title bar and have it drag the parent around instead.

This is the built in DragHandler:

It’s not hard to modify it to do the second thing, I guess.

1 Like

Ok, I’ve created a TargetedDragHandler which translates the drag to some other spatial (target) than the one being captured by the mouse.

When working on this I’ve noticed something that looks like a bug in the original DragHandler. There basePotition = capture.getWorldTranslation().clone() in startDrag() should probably instead be basePosition = capture.getLocalTranslation().clone() because everywhere else the handler is working with the local translation and getting the world translation here introduces an abnormal initial offset on drag start if the spatial is a child of some other spatial and its relative location is not 0, 0, 0. Please check this?

And also, I have noticed that the version of Lemur in the repo is somewhat really ahead of the last released one: like, the demos from there, including the DragHandler one, don’t work with the latest release, failing with many compilation errors. So in order to have everything working and according to the demos, I had to rely on the source version, which in turn, makes me to ask you to not forget and consider updating the release version since there’s pretty much update accumulated already :smiley: Idk when you feel it to be the appropriate moment though, mabye there’s some milestone in the plan…

I do plan a release soon. They just take time.

If you file a bug/issue/problem report/whatever, I’ll try to look at the translation issue before I cut the next release. (Partly why they take time. :))

Great! Looking forward to it!

Formulated the issue: DragHandler erroneous starting offset · Issue #64 · jMonkeyEngine-Contributions/Lemur · GitHub, thanks!