DrawGestures class

One- or two-finger gesture surface for the draw editor.

  • 1 finger: draw a stroke (beginStroke / addPoint / endStroke).
  • 2 fingers: drop the in-flight stroke and pan + scale the viewerCamera (screen-space transform stacked on top of the editor's base camera). Once the gesture goes multi-touch we stay in pan/zoom mode until ALL fingers lift — matches telegram's editor behaviour. New strokes require a fresh single-finger gesture.

When crop has applied edits, viewport pointer coords are inverted through the cropped-view transform (host camera + crop's imageTransform) AND through viewerCamera so strokes land at the right source pixel.

Inheritance
Available extensions

Constructors

DrawGestures({Key? key, required DrawImageLayer layer, required ValueListenable<Matrix4> hostCamera, CropImageLayer? crop, ValueNotifier<Matrix4>? viewerCamera})
Draws into layer as hostCamera shows it.
const

Properties

crop → CropImageLayer?
The crop the scene is shown through.
final
hashCode → int
The hash code for this object.
no setterinherited
hostCamera → ValueListenable<Matrix4>
The host's image-to-viewport transform.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
layer → DrawImageLayer
The layer strokes are drawn into.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
viewerCamera → ValueNotifier<Matrix4>?
Screen-space transform stacked on top of the base camera. The painter applies it; the gesture system mutates it on two-finger pinch/pan. Null disables the pan/zoom mode and gestures stay in "drawing only" behaviour.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<DrawGestures>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sliver({Key? key}) → Widget

Available on Widget, provided by the SliverExtension extension

Wraps this widget in a SliverToBoxAdapter.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

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