2

I'm working on Drag and Drop. I'm dragging some buttons from a VBox to another VBox. What I'm seeing now is that the OnDragEntered event is fire only when the mouse cursor enters in the border of the target.

My question is: how can I have a Drag Event ( or another event ) fired when the source button border overlaps the target list border?

thank you very much

Pich
  • 61
  • 9

1 Answers1

1

drag-and-drop doesn't support that by itself. You can't just drag shapes and receive onDragEvent when they collide with others.

You need to implement bounds collision during drag by yourself, there is a good example here: Checking Collision of Shapes with JavaFX

Sergey Grinev
  • 34,078
  • 10
  • 128
  • 141
  • Thank you very much for your answer. I will try this. Anyway I searched on the internet any example of this kind of implementation, but all Drag and Drop examples I have found uses the mouse cursor to fire any event. So my question is: if no one uses it for drag and drop, is there a reason? – Pich Dec 12 '19 at 13:54
  • @Pich, yep. And the reason is: drag and drop doesn't support that :) – Sergey Grinev Dec 12 '19 at 14:19