VisualElement Drag and Drop during runtime.

Okay, I have found a some what working solution. It is very cumbersome and not easy to do.

I followed the texture dragging example from the unite video/posted on github to get dragging working.

I made an extension method to get the root VisualElement.
I then get all the VisualElements from that root that has picking mode set to position.

At that point I use the MouseMoveEvent to iterate over all the VisualElements and check the world bounds for overlapping. I then simulate the drag events according to what phase it is. I made a custom element that accepts drops which is mostly for visual effect, but also allows for drop to be disabled. Got that setup to work some what in UIBuilder.

I need to figure out how to get the inspector to list a few values without it adding it to the element itself. The example [mention|0lDOuugxWKeU3CelW13Kjw==] posted here works fine for the editor, but also added the elements to the scene at runtime.

One other problem I have is, I am moving the dragged element to the root and putting it in front of everything. When I do this it puts the element in the top left corner if the mouse doesn’t move(the left and top are 0 from the last parent). Once I move it brings it to the right location with the mouse. How do I get it to stay in the same position when I change the parent?