enabled property

bool enabled

True iff the handler is active

Implementation

bool get enabled => _enabled;
void enabled=(bool e)

Implementation

set enabled(bool e) {
  _logger.fine("setting enabled to $e");
  // if we are currently dragging, delay a disable until it ends
  if(_dragging && _enabled && !e) {
    _delayedDisable = true;
    return;
  }
  // if we are enabled during a delayed disable, disable the delayed disable
  if(_delayedDisable && e) {
    _delayedDisable = false;
  }

  // if we aren't changing state, don't do anything
  if(_enabled != e) {

    // update flag
    _enabled = e;

    // add or remove handlers
    if(enabled) {
      // add mouse down handlers to the targets
      for(Element t in _targets) {
        _listen("mouseDown", t);
      }
    } else {
      // remove mouse down handlers from the targets
      for(Element t in _targets) {
        _cancel("mouseDown", t);
      }
    }
  }
}