BaseMouseTracker class

A base class that tracks the relationship between mouse devices and MouseTrackerAnnotations.

A device update is defined as an event that changes the relationship between mouse devices and MouseTrackerAnnotations. Subclasses should override handleDeviceUpdate to process the updates.

This class is a ChangeNotifier that notifies its listeners if the value of mouseIsConnected changes.

States and device updates

The state of BaseMouseTracker consists of two parts:

  • The mouse devices that are connected.
  • In which annotations each device is contained.

The states remain stable most of the time, and are only changed at the following moments:

  • An eligible PointerEvent has been observed, e.g. a device is added, removed, or moved. In this case, the state related to this device will be immediately updated, and triggers handleDeviceUpdate on this device.
  • A frame has been painted. In this case, a callback will be scheduled for the upcoming post-frame phase to update all devices, and triggers handleDeviceUpdate on each device separately.

See also:

  • MouseTracker, which is a subclass of BaseMouseTracker with definition of how to process mouse event callbacks and mouse cursors.
  • MouseCursorMixin, which is a mixin for BaseMouseTracker that defines how to process mouse cursors.
Inheritance
Implementers

Constructors

BaseMouseTracker(PointerRouter _router, MouseDetectorAnnotationFinder annotationFinder)
Creates a BaseMouseTracker to keep track of mouse locations. [...]

Properties

annotationFinder MouseDetectorAnnotationFinder
Find annotations at a given offset in global logical coordinate space in visual order from front to back. [...]
final
hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
mouseIsConnected bool
Whether or not at least one mouse is connected and has produced events.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener and removeListener will throw after the object is disposed). [...]
override
handleDeviceUpdate(MouseTrackerUpdateDetails details) → void
A callback that is called on the update of a device. [...]
@mustCallSuper, @protected
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyListeners() → void
Call all the registered listeners. [...]
@protected, @visibleForTesting, inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
inherited
schedulePostFrameCheck() → void
Mark all devices as dirty, and schedule a callback that is executed in the upcoming post-frame phase to check their updates. [...]
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited