refactor Draggable code

This is more memory-efficient -- All helper functions only exist once,
not a separate copy for each draggable entity. It's also easier to read
(in my opinion).
Merge pull request #563 from sbyrnes321/drag

refactor Draggable code