fix: on ui event reset selection type (#555)
* fix: on ui event reset selection type * test: add test
This commit is contained in:
parent
5b9b6d80f5
commit
7336274ff9
2 changed files with 26 additions and 37 deletions
|
|
@ -439,43 +439,6 @@ class _DesktopSelectionServiceWidgetState
|
|||
return min.clamp(start, end);
|
||||
}
|
||||
|
||||
/*void _showDebugLayerIfNeeded() {
|
||||
remove false to show debug overlay.
|
||||
if (kDebugMode && false) {
|
||||
_debugOverlay?.remove();
|
||||
if (offset != null) {
|
||||
_debugOverlay = OverlayEntry(
|
||||
builder: (context) => Positioned.fromRect(
|
||||
rect: Rect.fromPoints(offset, offset.translate(20, 20)),
|
||||
child: Container(
|
||||
color: Colors.red.withOpacity(0.2),
|
||||
),
|
||||
),
|
||||
);
|
||||
Overlay.of(context)?.insert(_debugOverlay!);
|
||||
} else if (_panStartOffset != null) {
|
||||
_debugOverlay = OverlayEntry(
|
||||
builder: (context) => Positioned.fromRect(
|
||||
rect: Rect.fromPoints(
|
||||
_panStartOffset?.translate(
|
||||
0,
|
||||
-(editorState.service.scrollService!.dy -
|
||||
_panStartScrollDy!),
|
||||
) ??
|
||||
Offset.zero,
|
||||
offset ?? Offset.zero),
|
||||
child: Container(
|
||||
color: Colors.red.withOpacity(0.2),
|
||||
),
|
||||
),
|
||||
);
|
||||
Overlay.of(context)?.insert(_debugOverlay!);
|
||||
} else {
|
||||
_debugOverlay = null;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
@override
|
||||
void registerGestureInterceptor(SelectionGestureInterceptor interceptor) {
|
||||
_interceptors.add(interceptor);
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ class EditorState {
|
|||
final completer = Completer<void>();
|
||||
|
||||
if (reason == SelectionUpdateReason.uiEvent) {
|
||||
selectionType = SelectionType.inline;
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(timeStamp) => completer.complete(),
|
||||
);
|
||||
|
|
@ -208,6 +209,7 @@ class EditorState {
|
|||
// broadcast to other users here
|
||||
selectionExtraInfo = extraInfo;
|
||||
_selectionUpdateReason = reason;
|
||||
|
||||
this.selection = selection;
|
||||
|
||||
return completer.future;
|
||||
|
|
|
|||
Loading…
Reference in a new issue