stopDrag method

void stopDrag(
  1. [MouseEvent event]

Manually end the drag


void stopDrag([MouseEvent event]) {
  _logger.fine("stopping drag");

  // signal that we are no longer dragging
  _dragging = false;

  // TODO if elements are changed during a drag, they won't be removed either

  // remove callbacks
  // TODO this can just be paused
  _cancel("mouseMove", document);
  for(Element e in _overTargets) {
    _cancel("mouseOver", e);
  for(Element e in _outTargets) {
    _cancel("mouseOut", e);

  // send end event if we weren't just pending
  if(!_dragStartPending) {
    _dragEndStreamController.add(new DragEvent._(this, currentTarget, event));

  // clear current target
  currentTarget = null;

  // if we are on a delayed disable, do the disable
  if(_delayedDisable) {
    _delayedDisable = false;
    enabled = false;

  // clear pending flag if it was set
  _dragStartPending = false;