ScriptedMouseCapture class final

A MouseCapture a test drives: it takes the pointer when asked, unless told not to, gathers the motion a test moves it by while it holds it, and lets go when asked or when loseFocus takes it away.

As the platform behaves. Motion is gathered only while the pointer is held — a mouse that is not captured moves a cursor, not the camera — and drainDelta hands it over once and forgets it. A capture starts from no motion; a release keeps what was gathered and not yet taken, so the last fragment before it still reaches the step. A capture the platform refuses (isSupported false, or refuses set, as a browser refuses one with no user gesture before it) changes nothing and reports nothing. Every change of isCaptured is announced on changes.

Inheritance

Constructors

ScriptedMouseCapture({bool isSupported = true})
A capture on a platform that can, or cannot (isSupported), take the pointer.

Properties

changes → Stream<bool>
Each change of isCaptured: true when the pointer is taken, false when it is given back, by the player or by the system taking focus away.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
isCaptured → bool
Whether the pointer is taken now.
no setteroverride
isSupported → bool
Whether the platform can take the pointer at all.
final
refuses ↔ bool
Whether the next capture is refused, as a browser refuses one with no user gesture. Settable.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

capture() → Future<void>
Asks for the pointer. A browser grants it only after a user gesture.
override
drainDelta() → Offset
The motion since the last call, in logical pixels, and forgets it.
override
loseFocus() → void
Takes the pointer away, as Escape or a lost focus does.
move(Offset delta) → void
Moves the mouse by delta: gathered while the pointer is held, a cursor's motion and dropped while it is not.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release() → Future<void>
Gives the pointer back.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited