Dart Documentationdartkart.mapMouseEvent

MouseEvent class

MouseEvent is an event triggered by mouse gestures. In contrast to the fundamental html.MouseEvent class it can represent the mouse events in a drag operation. Instead of a bare bone 'mouse move' event it can represent a 'mouse hover' or a 'mouse drag' event.

class MouseEvent {
 static const int CLICK = 0;
 static const int DOUBLE_CLICK = 1;
 static const int DRAG_START = 2;
 static const int DRAG = 3;
 static const int DRAG_END = 4;
 static const int HOVER = 5;

 /// the type of the mouse event 
 final int type;
 
 /// the underlying DOM mouse event 
 final html.MouseEvent event;
 
 /**
  * Create a mouse event of type [type] connected to the 
  * underlying DOM mouse [event].
  */
 MouseEvent(this.type, this.event);
 
 String get _typeAsString {
   switch(type) {
     case CLICK: return "CLICK";
     case DOUBLE_CLICK: return "DOUBLE_CLICK";
     case DRAG: return "DRAG";
     case DRAG_START: return "DRAG_START";
     case DRAG_END: return "DRAG_END";
     case HOVER: return "HOVER";
   }
 }

 /// returns true if this mouse event is a drag event
 bool get isDragEvent => type == DRAG_START || type == DRAG ||
     type == DRAG_END;

 @override
 toString() => "{MouseEvent: type=${_typeAsString}, x=${event.offset.x},"
    " y=${event.offset.y}";
}

Static Properties

const int CLICK #

static const int CLICK = 0

const int DOUBLE_CLICK #

static const int DOUBLE_CLICK = 1

const int DRAG #

static const int DRAG = 3

const int DRAG_END #

static const int DRAG_END = 4

const int DRAG_START #

static const int DRAG_START = 2

const int HOVER #

static const int HOVER = 5

Constructors

new MouseEvent(int type, MouseEvent event) #

Create a mouse event of type type connected to the underlying DOM mouse event.

MouseEvent(this.type, this.event);

Properties

final MouseEvent event #

the underlying DOM mouse event

final html.MouseEvent event

final bool isDragEvent #

returns true if this mouse event is a drag event

bool get isDragEvent => type == DRAG_START || type == DRAG ||
   type == DRAG_END;

final int type #

the type of the mouse event

final int type

Methods

dynamic toString() #

Returns a string representation of this object.

docs inherited from Object
@override
toString() => "{MouseEvent: type=${_typeAsString}, x=${event.offset.x},"
  " y=${event.offset.y}";