A mixin that brings the possibility to observe dragging of the view element.
The view has to implement the DraggableView
interface to use it:
export default class MyDraggableView extends DraggableViewMixin( View ) implements DraggableView {
// ...
}
Creating a class extending it attaches a set of mouse and touch listeners allowing to observe dragging of the view element:
mousedown
and touchstart
on the view element - starting the dragging.
mousemove
and touchmove
on the document - updating the view coordinates.
mouseup
and touchend
on the document - stopping the dragging.
The mixin itself does not provide a visual feedback (that is, the dragged element does not change its position) -
it is up to the developer to implement it.
Type parameters
Base : extends Constructor<View<HTMLElement>>
Parameters
view
:
Base
-
Returns
Mixed<Base, DraggableView>
-