I want to build a kind of joystick, so the inner picture (my draggable object) should have a specific range. Currently it's just a squarde and I don't like that!
I found the possibility to control moves by returning true or false in my drag-method but if I return false the object jumps back to its start instead of standing still :(
Any ideas how to do this?
Inside your drag handler you have change the position. If your draggable tries to go outside of the container that you want to keep it in, then just truncate the position back within the container and don't return false.
I think the containment option will be there when you want to restrict your object in particular area. see below link for reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.