Skip to content

Commit

Permalink
fix: only notify ui of selection change if it actually changed (#914)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xazin authored Oct 8, 2024
1 parent c07f9ef commit 8eb1400
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:appflowy_editor/src/editor/editor_component/service/selection/mobile_selection_service.dart';
import 'package:appflowy_editor/src/editor/editor_component/service/selection/shared.dart';
import 'package:appflowy_editor/src/service/selection/selection_gesture.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';

class DesktopSelectionServiceWidget extends StatefulWidget {
Expand Down Expand Up @@ -333,7 +334,10 @@ class _DesktopSelectionServiceWidgetState
final start = _panStartPosition!;
final end = last.getSelectionInRange(panStartOffset, panEndOffset).end;
final selection = Selection(start: start, end: end);
updateSelection(selection);

if (selection != currentSelection.value) {
updateSelection(selection);
}
}

editorState.service.scrollService?.startAutoScroll(
Expand Down

0 comments on commit 8eb1400

Please sign in to comment.