Factored out 'mouse capture' and 'dragging' functionality into separate directives.