Answered

How to get drag and drop event to get coordinates

  • 28 April 2020
  • 3 replies
  • 3055 views

Userlevel 1

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

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"})

 

View original

3 replies

Userlevel 3
Badge +7

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

….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