MapGestureRecognizer class
Reads touches, the mouse, a trackpad and the keyboard as MapLibre GL JS
does, and moves a MapGestureTarget. One finger pans; two pinch, turn,
and tilt when dragged up or down together; a double tap zooms in and a
two finger tap out; a double tap held and dragged zooms. A mouse wheel
zooms, a double click zooms in and a shift double click out, a right or
control drag turns and tilts, and a shift drag zooms to its box. Two
fingers on a trackpad slide the map, a pinch zooms and a twist turns it.
With focus the arrow keys pan, + and - zoom, two levels with shift,
and shift with the arrows turns and tilts. Released gestures keep their
speed and slow down naturally. options switches each of them off.
It reads raw pointers rather than joining the gesture arena, so the map follows the finger from the first frame. Give it to a MapGestureDetector over the map.
Constructors
- MapGestureRecognizer(MapGestureTarget target, {VmapGestureOptions options = const VmapGestureOptions(), void onTap(Offset at)?, void onLongPress(Offset at)?, VoidCallback? onSettle})
Properties
- active → bool
-
Whether a gesture is under way: fingers down, or a wheel zoom not
yet come to rest.
no setter
-
box
→ ValueNotifier<
Rect?> -
The box a shift drag draws so far, in logical pixels.
final
-
cursor
→ ValueNotifier<
MouseCursor> -
The cursor over the map: a hand, closed while the mouse drags.
final
- focus → FocusNode
-
Takes the map's key presses once a press on it gave it focus.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- onLongPress ↔ void Function(Offset at)?
-
Called with where a finger was held still.
getter/setter pair
- onSettle ↔ VoidCallback?
-
Called when a gesture has let go of the map, for the host to tell
whether the camera has come to rest.
getter/setter pair
- onTap ↔ void Function(Offset at)?
-
Called with where a tap landed.
getter/setter pair
- options ↔ VmapGestureOptions
-
Which gestures move the map; a MapGestureDetector follows changes.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- target ↔ MapGestureTarget
-
getter/setter pair
Methods
-
claimPointer(
) → void - The next pointer down is on something above the map that takes its own tap, as a marker: it may still pan the map.
-
dispose(
) → void -
down(
PointerDownEvent e) → void -
key(
FocusNode node, KeyEvent e) → KeyEventResult -
move(
PointerMoveEvent e) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
panZoomEnd(
PointerPanZoomEndEvent e) → void -
panZoomStart(
PointerPanZoomStartEvent e) → void -
panZoomUpdate(
PointerPanZoomUpdateEvent e) → void -
signal(
PointerSignalEvent e) → void - A scroll from Flutter. In a browser the map reads the page's own wheel events instead, through wheel.
-
toString(
) → String -
A string representation of this object.
inherited
-
up(
PointerEvent e) → void -
wheel(
WheelInput input) → void - A wheel event, zoomed by as MapLibre GL JS's scroll zoom does.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited