mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 06:37:14 -04:00
Merge pull request #1319 from LucasXu0/image_selection_area
update image node selection style and fix the context menu display problem
This commit is contained in:
commit
39254b7f17
2 changed files with 15 additions and 1 deletions
|
@ -34,6 +34,8 @@ class ImageNodeWidget extends StatefulWidget {
|
|||
|
||||
class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
||||
with SelectableMixin {
|
||||
RenderBox get _renderBox => context.findRenderObject() as RenderBox;
|
||||
|
||||
final _imageKey = GlobalKey();
|
||||
|
||||
double? _imageWidth;
|
||||
|
@ -76,6 +78,12 @@ class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get shouldCursorBlink => false;
|
||||
|
||||
@override
|
||||
CursorStyle get cursorStyle => CursorStyle.borderLine;
|
||||
|
||||
@override
|
||||
Position start() {
|
||||
return Position(path: widget.node.path, offset: 0);
|
||||
|
@ -93,7 +101,8 @@ class _ImageNodeWidgetState extends State<ImageNodeWidget>
|
|||
|
||||
@override
|
||||
Rect? getCursorRectInPosition(Position position) {
|
||||
return null;
|
||||
final size = _renderBox.size;
|
||||
return Rect.fromLTWH(-size.width / 2.0, 0, size.width, size.height);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -508,6 +508,11 @@ class _AppFlowySelectionState extends State<AppFlowySelection>
|
|||
void _showContextMenu(TapDownDetails details) {
|
||||
_clearContextMenu();
|
||||
|
||||
// For now, only support the text node.
|
||||
if (!currentSelectedNodes.every((element) => element is TextNode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final baseOffset =
|
||||
editorState.renderBox?.localToGlobal(Offset.zero) ?? Offset.zero;
|
||||
final offset = details.globalPosition + const Offset(10, 10) - baseOffset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue