Skip to content

Commit

Permalink
Remove mouse tap text drag selection throttling to improve responsive…
Browse files Browse the repository at this point in the history
…ness (#123460)

Remove mouse tap text drag selection throttling to improve responsiveness
  • Loading branch information
loune authored Apr 6, 2023
1 parent efb8b38 commit 5eb236c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
4 changes: 0 additions & 4 deletions packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,6 @@ sealed class BaseTapAndDragGestureRecognizer extends OneSequenceGestureRecognize
/// The frequency at which the [onDragUpdate] callback is called.
///
/// The value defaults to null, meaning there is no delay for [onDragUpdate] callback.
///
/// See also:
/// * [TextSelectionGestureDetector], which uses this parameter to avoid excessive updates
/// text layouts in text fields.
Duration? dragUpdateThrottleFrequency;

/// An upper bound for the amount of taps that can belong to one tap series.
Expand Down
10 changes: 0 additions & 10 deletions packages/flutter/lib/src/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ import 'transitions.dart';
export 'package:flutter/rendering.dart' show TextSelectionPoint;
export 'package:flutter/services.dart' show TextSelectionDelegate;

/// A duration that controls how often the drag selection update callback is
/// called.
const Duration _kDragSelectionUpdateThrottle = Duration(milliseconds: 50);

/// The type for a Function that builds a toolbar's container with the given
/// child.
///
Expand Down Expand Up @@ -2953,10 +2949,6 @@ class TextSelectionGestureDetector extends StatefulWidget {
final GestureTapDragStartCallback? onDragSelectionStart;

/// Called repeatedly as a mouse moves while dragging.
///
/// The frequency of calls is throttled to avoid excessive text layout
/// operations in text fields. The throttling is controlled by the constant
/// [_kDragSelectionUpdateThrottle].
final GestureTapDragUpdateCallback? onDragSelectionUpdate;

/// Called when a mouse that was previously dragging is released.
Expand Down Expand Up @@ -3123,7 +3115,6 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
// Text selection should start from the position of the first pointer
// down event.
..dragStartBehavior = DragStartBehavior.down
..dragUpdateThrottleFrequency = _kDragSelectionUpdateThrottle
..onTapDown = _handleTapDown
..onDragStart = _handleDragStart
..onDragUpdate = _handleDragUpdate
Expand All @@ -3142,7 +3133,6 @@ class _TextSelectionGestureDetectorState extends State<TextSelectionGestureDetec
// Text selection should start from the position of the first pointer
// down event.
..dragStartBehavior = DragStartBehavior.down
..dragUpdateThrottleFrequency = _kDragSelectionUpdateThrottle
..onTapDown = _handleTapDown
..onDragStart = _handleDragStart
..onDragUpdate = _handleDragUpdate
Expand Down

0 comments on commit 5eb236c

Please sign in to comment.