Refactored drag code to allow for snapping state