track method

void track(
  1. HtmlElement element
)

Starts listening to drag events for a child element.

Implementation

void track(HtmlElement element) {
  element.draggable = true;
  List subs = _subscriptionsForElement(element);
  subs.add(element.onDragStart.listen((e) {
    // Required for firefox to support drag
    e.dataTransfer.setData("Text", element.id);
    e.dataTransfer.effectAllowed = "copyMove";
    _onDragStart(e);
  }));

  subs.add(element.onDragEnd.listen(_onDragEnd));
  subs.add(element.onKeyDown.listen((e) => _onKeyDown(e, element)));
  _dragSubscriptions[element] =
      element.onDragOver.listen((e) => _onDragOver(e, element));
  // Subscribing to onclick events when multi select is turned on.
  if (multiSelect) {
    subs.add(element.onClick.listen((e) => _onClick(e, element)));
  }
}