Answered

How to get drag and drop event to get coordinates

  • 28 April 2020
  • 3 replies
  • 3244 views

Userlevel 1
Badge +2

I’m making an app where dropping a card on top of a shape object needs some functions to be called, so I want to catch when cards are moved, I tried using “WIDGETS_TRANSFORMATION_UPDATED”  but it doesn’t give coordinates, I’ve tried getting the common ‘dragend’ on document and it did no go well either, any suggestions would be greatly appreciated.

icon

Best answer by Falk Kühnel 28 April 2020, 22:38

View original

3 replies

Userlevel 2
Badge +2

After the event

event.data

you have to get the drop information for each item afterwards by id:

await miro.board.widgets.get({id: "3074457347524474470"})

 

Userlevel 1
Badge +2

….That makes so much sense, I’m kinda embarrassed I didn’t think of that, thank you!

Badge +1

Saifis

 

I need to do something similar but I am a complete noob when it comes to miro development, would you mind sharing some of the code you used to do this Id love to take a look!

Reply