question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DragHandler erroneous starting offset

See original GitHub issue

There is a bug in the DragHandler class. The

basePotition = capture.getWorldTranslation().clone()

line 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.

It is easy to demonstrate this behavior by modifying the com.simsilica.lemur.demo.BasicDemo class: replace the line

guiNode.attachChild( testPanel );

in simpleInitApp() with

Node node = new Node();
node.attachChild(testPanel);
node.setLocalTranslation(200, 200, 0);
guiNode.attachChild(node);

and try to drag the testPanel.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pspeed42commented, Nov 19, 2018

Fix committed and confirmed it works in the demo. Closing this issue.

1reaction
pspeed42commented, Nov 18, 2018

I don’t think it requires all that. I haven’t tested it or anything but I believe it’s as simple as: -continue calculating dragging in world space as before -instead of calling spatial.setLocalTranslation() with the world space coordinate, convert that world space coordinate to local space with spatial.getParent().worldToLocal()

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery draggable shows helper in wrong place after page ...
I'm using jQuery 1.6.0 and jQuery UI 1.8.12. I'm sure there's a offset function I need to add but I don't know where...
Read more >
Draggable Window in Lemur - gui - jMonkeyEngine Hub
Great! Looking forward to it! Formulated the issue: DragHandler erroneous starting offset · Issue #64 · jMonkeyEngine-Contributions/Lemur · GitHub, thanks!
Read more >
HTMLElement: drag event - Web APIs | MDN
The drag event is fired every few hundred milliseconds as an element or text selection is being dragged by the user.
Read more >
Problem with dragging - Unity Forum
I have been trying to learn how to use the IDragHandler interface to drag some UI elements around on the canvas. However, I...
Read more >
Gesture options - @use-gesture documentation
The initial position offset should start from. threshold, all, The handler will fire only when the gesture displacement is greater than the threshold....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found