Similar code as in draggable directive. Could be centralized in a service in a separate PR.