Drag and Drop zones with d3?

303 views
Skip to first unread message

Jason Graves

unread,
Feb 15, 2016, 5:33:41 PM2/15/16
to d3-js


I'm hoping this is a quick question.  I've been tasked with building a rich web interface that requires a user to drag balls into a "drop zones" on the edge of the page.  I am trying to figure out if d3 can be used for the whole interface, or if there's a better approach I should be taking.  The image below represents a full-screen concept with the orange boxes being drop zones.   The balls will actually be linked to words, which I'll collect when they are dropped.  I haven't really seen any examples on d3 where shapes are being dropped into zones like this.  Any nudge in the right direction would be very helpful.  Thanks,  Jason



Drew Winget

unread,
Feb 16, 2016, 12:43:56 PM2/16/16
to d3...@googlegroups.com
This is a rather fully featured example with circular drop zones.


The basic idea is that you draw a shape like any other and them bind mouseover and mouseout event to it. If there is a mouseup event within your shape, and something is currently being dragged, then it is dropped into that area.


On Monday, 15 February 2016, Jason Graves <jasono...@gmail.com> wrote:


I'm hoping this is a quick question.  I've been tasked with building a rich web interface that requires a user to drag balls into a "drop zones" on the edge of the page.  I am trying to figure out if d3 can be used for the whole interface, or if there's a better approach I should be taking.  The image below represents a full-screen concept with the orange boxes being drop zones.   The balls will actually be linked to words, which I'll collect when they are dropped.  I haven't really seen any examples on d3 where shapes are being dropped into zones like this.  Any nudge in the right direction would be very helpful.  Thanks,  Jason



--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Drew Winget

unread,
Feb 16, 2016, 12:54:08 PM2/16/16
to d3...@googlegroups.com
Sorry, mouseup = dragend above. You'll see in the example. 


And 

Jason Graves

unread,
Feb 16, 2016, 4:51:13 PM2/16/16
to d3-js
Thanks, Drew

That helps!
Reply all
Reply to author
Forward
0 new messages