Fix dragging

Dragging works even if the cursor gets out of the element.