desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 386 forks source link

How to drag in a svg circle container #102

Closed haroondilshad closed 8 years ago

haroondilshad commented 9 years ago

Hey, I'm trying to drag a marker in a svg circle, here's the demo, http://play.ionic.io/app/55cc4462c1ff . Is it possible to give in a containment option that's not linear and have the marker drag in the circular path laid out by circle. To see what's happening please try to drag the orange path in the first circle

desandro commented 9 years ago

ha, fun feature. Sorry this is a bit of an edge case so I'm not likely to develop it.

But it is possible! You can re-write how containment works to use a radius around a point. If drag position is outside the radius, then you cap the position to the length of the radius at the angle of the drag position. There, did it in words!