I have several Widgets I want to move with Drag and Drop. I posted Drag and Move in the Headline because the Usual Drag and Drop is not what I want. Usually You Drag something, It remains in place and a Copy is moved with the Cursor to the destination place… However I don’t want to move a Copy, I want to move the original Widget directly.
Is this possible within the Widgets Blueprint and how? I have tested some approach where I had to use 2 Gates and in the Character Blueprint which is ugly if you ask me… Widget logic should remain in the widget.
Is there a reason why the DragVisual is bigger than the original Widget?
Thank you very much in advance!
I Solved it on my own. I didn’t use any DragVisual. I used the OnDragOver Event to set the new Position. To do so I needed some Information I only get in the OnDragDetected Function. I Save the Result of GetScreenSpaceLocation with Absolute to Local into a Custom Variable of my Widget as an Offset. Pic1
On Drag over Event in the Widget which is a layer under the Draggable Widget (In my case an ‘empty’ UserInterfaceWidget with just a Canvas). This Event and in the OnDrop Event are the same.
In my Case I don’t need the payload at all… well maybe later if i can drag more than one mini Windows (Widgets).
Thats because my UserInterfaceWidgets has a Variable/Reference to the unique Draggable which I can use.
I add it as Child to the Canvas, Cast the return Value to CanvasPanelSlot and can now set the position to whatever I want. I my case it is the position of the MouseCursor. Thats the PointerEvents Screen Space Position calculated in Absolute to local (By the MyGeometry thingy) From that substract the Offset we created earlier.
Voila, thats your Drag and Drop/Move to any location Window.
Hi, nice work!
I’ve been trying to replicate this code for the 4.7.2 version, however, on initial click the widget is set to the upper left corner of my screen. Were you able to make it work, or am I missing something?
Hi, thank you! Actually I rewrite the whole thing at the moment. Unfortunately I don’t get to that point until weekend. I’ll let you know if I found something asap…
Any chance you can show us how you re-did this Maxxomatik?
Hey Mathijsabrahams, top call!!! Is there a chance not to let the draggable content jump to the default position (center to mouse) on every click (press) ?
but when i press mouse button the widget will return the original position why?