Implemented a basic snap function on mouse up