This library provides and easy way to make DOM elements (Html or Svg) draggable.
An element is considered to be dragging when the mouse is pressed and moved before it is released. Otherwise, the action is considered a click. This is useful because in some cases you may want to support both actions.
Basic config
config = basicConfig OnDragByCustom config, including arbitrary options. See Events.
config = customConfig
[ onDragBy OnDragBy
, onDragStart OnDragStart
, onDragEnd OnDragEnd
]Handle update messages for the draggable model. It assumes that the drag state will be stored under the key drag.
Handle mouse subscriptions used for dragging
DOM event handler to start dragging on mouse down. It requires a String key for the element, in order to provide support for multiple drag targets sharing the same drag state. Of course, if only one element is draggable, it can have any value, including "".
div [ mouseTrigger "element-id" DragMsg ] [ text "Drag me" ]A type alias representing the distance between two drag points.
Drag state to be included in model.
A message type for updating the internal drag state.
Configuration of a draggable model.
An event declaration for the draggable config
Initial drag state