Announcement

Collapse
No announcement yet.

[UMG] Drag & Drop detection not working

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [UMG] Drag & Drop detection not working

    Hello, I'm testing drag & drop capabilities for my game prototype, I'm quite in advanced stage of development and now I figured out that drag detection isn't working in UE4. I really don't want to make my own drag and drop detection using mouse events, also I really don't want to throw that project away. So what's the problem?

    Although finding some kind of minimalitic information about how to make drag detection withing UMG is quite impossible, I've downloaded some project to see how it's done there - cannot reproduce it. So what do I do?

    I create one parent widget which takes whole screen and serves as a container for my draggable widget.

    Inside my draggable widget, I add image- to have some kind of "collision box", so I set it's visibility to visible. I create overrides for these events: MouserMove, DragDetected. For mouse move, I call DetectDragIfPressed and it's result send to output. Of course I connect PointerEvent node as I should.

    Now when I create override for DragDetected, it get's never called. Detect drag if pressed is set to drag key - left mouse button. Widget is accepting mouse events as it should since the mouse move event gets fired correctly.

    I'm lost, really don't know what am I missing.

    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	298.0 KB
ID:	1215978Click image for larger version

Name:	Untitled2.png
Views:	1
Size:	276.8 KB
ID:	1215979

    #2
    You're constantly recreating the drag detection state. Every time the mouse moves, it's sending 'hey - prepare to detect drag', which will reset the drag detection state, while it waits for a certain amount of pixels to be dragged.

    You should move your logic to OnMouseButtonDown, and only do it when left is pressed.

    Comment


      #3

      i have the same problem with OnMouseButtonDown function. I don't know whats the problem, it works perfectly with right mouse button but it doesn't work on left mouse button

      Comment

      Working...
      X