Skip to content

Commit

Permalink
Remove absorbPanEventsOnScrollables option (#1455)
Browse files Browse the repository at this point in the history
* Remove absorbPanEventsOnScrollables option

The only reason this has been kept around is because some plugins which
used drag gestures relied on it. It turns out if those plugins detect
vertical/horizontal drag instead of pan this flag is not necessary.

* Remove unnecessary comments
  • Loading branch information
rorystephenson authored Apr 2, 2023
1 parent ac15548 commit 870aeea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 43 deletions.
1 change: 0 additions & 1 deletion example/lib/pages/map_inside_listview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class MapInsideListViewPage extends StatelessWidget {
height: 300,
child: FlutterMap(
options: MapOptions(
absorbPanEventsOnScrollables: true,
center: LatLng(51.5, -0.09),
zoom: 5,
),
Expand Down
3 changes: 0 additions & 3 deletions lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,6 @@ class MapOptions {
/// see [InteractiveFlag] for custom settings
final int interactiveFlags;

final bool absorbPanEventsOnScrollables;

final TapCallback? onTap;
final TapCallback? onSecondaryTap;
final LongPressCallback? onLongPress;
Expand Down Expand Up @@ -293,7 +291,6 @@ class MapOptions {
final bool keepAlive;

MapOptions({
this.absorbPanEventsOnScrollables = true,
this.crs = const Epsg3857(),
LatLng? center,
this.bounds,
Expand Down
46 changes: 7 additions & 39 deletions lib/src/map/flutter_map_state.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'dart:math' as math;

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map/src/core/bounds.dart';
import 'package:flutter_map/src/gestures/gestures.dart';
import 'package:flutter_map/src/map/map.dart';
import 'package:flutter_map/src/map/map_state_widget.dart';
import 'package:latlong2/latlong.dart';
import 'dart:math' as math;
import 'package:flutter_map/src/core/bounds.dart';

class FlutterMapState extends MapGestureMixin
with AutomaticKeepAliveClientMixin {
Expand Down Expand Up @@ -72,14 +73,6 @@ class FlutterMapState extends MapGestureMixin
..onTap = _positionedTapController.onTap
..onSecondaryTap = _positionedTapController.onSecondaryTap
..onSecondaryTapDown = _positionedTapController.onTapDown;
// ..onTapCancel = onTapCancel
// ..onSecondaryTapUp = onSecondaryTapUp
// ..onSecondaryTapCancel = onSecondaryTapCancel
// ..onTertiaryTapDown = onTertiaryTapDown
// ..onTertiaryTapUp = onTertiaryTapUp
// ..onTertiaryTapCancel = onTertiaryTapCancel
// ..gestureSettings = gestureSettings;
// instance.team = _team;
},
);

Expand All @@ -88,42 +81,18 @@ class FlutterMapState extends MapGestureMixin
() => LongPressGestureRecognizer(debugOwner: this),
(LongPressGestureRecognizer instance) {
instance.onLongPress = _positionedTapController.onLongPress;
// ..onLongPressDown = onLongPressDown
// ..onLongPressCancel = onLongPressCancel
// ..onLongPressStart = onLongPressStart
// ..onLongPressMoveUpdate = onLongPressMoveUpdate
// ..onLongPressUp = onLongPressUp
// ..onLongPressEnd = onLongPressEnd
// ..onSecondaryLongPressDown = onSecondaryLongPressDown
// ..onSecondaryLongPressCancel = onSecondaryLongPressCancel
// ..onSecondaryLongPress = onSecondaryLongPress
// ..onSecondaryLongPressStart = onSecondaryLongPressStart
// ..onSecondaryLongPressMoveUpdate = onSecondaryLongPressMoveUpdate
// ..onSecondaryLongPressUp = onSecondaryLongPressUp
// ..onSecondaryLongPressEnd = onSecondaryLongPressEnd
// ..onTertiaryLongPressDown = onTertiaryLongPressDown
// ..onTertiaryLongPressCancel = onTertiaryLongPressCancel
// ..onTertiaryLongPress = onTertiaryLongPress
// ..onTertiaryLongPressStart = onTertiaryLongPressStart
// ..onTertiaryLongPressMoveUpdate = onTertiaryLongPressMoveUpdate
// ..onTertiaryLongPressUp = onTertiaryLongPressUp
// ..onTertiaryLongPressEnd = onTertiaryLongPressEnd
// ..gestureSettings = gestureSettings;
// instance.team = _team;
},
);

if (options.absorbPanEventsOnScrollables &&
InteractiveFlag.hasFlag(
options.interactiveFlags, InteractiveFlag.drag)) {
if (InteractiveFlag.hasFlag(
options.interactiveFlags, InteractiveFlag.drag)) {
gestures[VerticalDragGestureRecognizer] =
GestureRecognizerFactoryWithHandlers<VerticalDragGestureRecognizer>(
() => VerticalDragGestureRecognizer(debugOwner: this),
(VerticalDragGestureRecognizer instance) {
instance.onUpdate = (details) {
//Absorbing vertical drags
// Absorbing vertical drags
};
// ..dragStartBehavior = dragStartBehavior
instance.gestureSettings = gestureSettings;
instance.team ??= _team;
},
Expand All @@ -133,9 +102,8 @@ class FlutterMapState extends MapGestureMixin
() => HorizontalDragGestureRecognizer(debugOwner: this),
(HorizontalDragGestureRecognizer instance) {
instance.onUpdate = (details) {
//Absorbing horizontal drags
// Absorbing horizontal drags
};
// ..dragStartBehavior = dragStartBehavior
instance.gestureSettings = gestureSettings;
instance.team ??= _team;
},
Expand Down

0 comments on commit 870aeea

Please sign in to comment.