Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: menu displayed at mouse location

Arymanab4a2e8b07af
diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
index 7fe02bab1a..7375f6a113 100644
--- a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/disclosure_action.dart
@@ -76,13 +76,7 @@ class ViewDisclosureRegion extends StatelessWidget
@override
Widget build(BuildContext context) {
return Listener(
- onPointerDown: (event) => {
- if (event.kind == PointerDeviceKind.mouse &&
- event.buttons == kSecondaryMouseButton)
- {
- show(context),
- }
- },
+ onPointerDown: (event) => {_handleClick(event, context)},
child: child,
);
}
@@ -101,6 +95,17 @@ class ViewDisclosureRegion extends StatelessWidget
(wrapper) => onSelected(dartz.some(wrapper.inner)),
);
};
+
+ void _handleClick(PointerDownEvent event, BuildContext context) {
+ if (event.kind == PointerDeviceKind.mouse &&
+ event.buttons == kSecondaryMouseButton) {
+ RenderBox box = context.findRenderObject() as RenderBox;
+ Offset position = box.localToGlobal(Offset.zero);
+ double x = event.position.dx - position.dx - box.size.width;
+ double y = event.position.dy - position.dy - box.size.height;
+ show(context, anchorOffset: Offset(x, y));
+ }
+ }
}
class ViewDisclosureActionWrapper extends ActionItem {
diff --git a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
index 93855c3fa2..3ca8577d8c 100644
--- a/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/home/menu/app/section/item.dart
@@ -86,7 +86,6 @@ class ViewSectionItem extends StatelessWidget {
}
return ViewDisclosureRegion(
- // context.read<ViewBloc>().add(const ViewEvent.setIsEditing(true)),
onSelected: (action) {
context.read<ViewBloc>().add(const ViewEvent.setIsEditing(false));
_handleAction(context, action);