Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/src/gestures/map_interactive_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ class MapInteractiveViewerState extends State<MapInteractiveViewer>
void _handleScaleStart(ScaleStartDetails details) {
_dragMode = _pointerCounter == 1;

// This is not always emitted publicly - see #1939!
final eventSource = _dragMode
? MapEventSource.dragStart
: MapEventSource.multiFingerGestureStart;
Expand Down Expand Up @@ -572,23 +573,21 @@ class MapInteractiveViewerState extends State<MapInteractiveViewer>
void _handleScaleDragUpdate(ScaleUpdateDetails details) {
if (_ckrTriggered.value) return;

const eventSource = MapEventSource.onDrag;

if (InteractiveFlag.hasDrag(_interactionOptions.flags)) {
if (!_dragStarted) {
// We could emit start event at [handleScaleStart], however it is
// possible drag will be disabled during ongoing drag then
// [didUpdateWidget] will emit MapEventMoveEnd and if drag is enabled
// again then this will emit the start event again.
_dragStarted = true;
widget.controller.moveStarted(eventSource);
widget.controller.moveStarted(MapEventSource.dragStart);
}

final localDistanceOffset = _rotateOffset(
_lastFocalLocal - details.localFocalPoint,
);

widget.controller.dragUpdated(eventSource, localDistanceOffset);
widget.controller.dragUpdated(MapEventSource.onDrag, localDistanceOffset);
}
}

Expand Down Expand Up @@ -654,7 +653,7 @@ class MapInteractiveViewerState extends State<MapInteractiveViewer>
if (!_pinchMoveStarted) {
// We want to call moveStart only once for a movement so don't call
// it if a pinch move is already underway.
widget.controller.moveStarted(MapEventSource.onMultiFinger);
widget.controller.moveStarted(MapEventSource.multiFingerGestureStart);
}
}
}
Expand All @@ -669,7 +668,7 @@ class MapInteractiveViewerState extends State<MapInteractiveViewer>
if (!_pinchZoomStarted) {
// We want to call moveStart only once for a movement so don't call
// it if a pinch zoom is already underway.
widget.controller.moveStarted(MapEventSource.onMultiFinger);
widget.controller.moveStarted(MapEventSource.multiFingerGestureStart);
}
}
}
Expand Down