Skip to content

Commit

Permalink
fix: fix: Consider object translation on Menu Flyouts (Fixes #1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Sep 29, 2024
1 parent 8f108bd commit 2a2fc6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- feat: Add `TabView.stripBuilder` ([#1106](https://github.com/bdlukaa/fluent_ui/issues/1106))
- fix : The EditableComboBox is missing the part that applies the style to the TextBox, so add it.
- feat: Add `BreadcrumbBar.chevronIconBuilder` and `BreadcrumbBar.chevronIconSize` ([#1111](https://github.com/bdlukaa/fluent_ui/issues/1111))
* fix: Consider object translation on Menu Flyouts ([#1104](https://github.com/bdlukaa/fluent_ui/issues/1104))

## 4.9.1

Expand Down
13 changes: 8 additions & 5 deletions lib/src/controls/flyouts/menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,14 @@ class _MenuFlyoutState extends State<MenuFlyout> {

final itemBox =
subItem.currentContext!.findRenderObject() as RenderBox;
final itemRect = itemBox.localToGlobal(
Offset.zero,
ancestor: parent?.widget.root?.context.findRenderObject(),
) &
itemBox.size;
final parentBox =
(parent?.widget.root?.context.findRenderObject() as RenderBox);
final translation = parentBox.getTransformTo(null).getTranslation();
final offset = Offset(translation[0], translation[1]);
final itemRect =
(itemBox.localToGlobal(Offset.zero, ancestor: parentBox) +
offset) &
itemBox.size;

if (!itemRect.contains(event.position)) {
state.close(menuInfo);
Expand Down

0 comments on commit 2a2fc6d

Please sign in to comment.