fix(menu): give each popup instance its own id
This commit is contained in:
parent
6081a48cd3
commit
9f634b0ec2
3 changed files with 12 additions and 18 deletions
|
|
@ -115,16 +115,12 @@ impl<Message: Clone + 'static> ContextMenu<'_, Message> {
|
||||||
|
|
||||||
shell.publish(self.on_surface_action.as_ref().unwrap()(destroy_popup(id)));
|
shell.publish(self.on_surface_action.as_ref().unwrap()(destroy_popup(id)));
|
||||||
state.view_cursor = view_cursor;
|
state.view_cursor = view_cursor;
|
||||||
(
|
|
||||||
id,
|
|
||||||
layout.children().map(|lo| lo.bounds()).collect::<Vec<_>>(),
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
window::Id::unique(),
|
|
||||||
layout.children().map(|lo| lo.bounds()).collect(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
// A fresh id per popup, so the old popup's Done cannot be mistaken for the new one's
|
||||||
|
(
|
||||||
|
window::Id::unique(),
|
||||||
|
layout.children().map(|lo| lo.bounds()).collect::<Vec<_>>(),
|
||||||
|
)
|
||||||
});
|
});
|
||||||
let Some(context_menu) = self.context_menu.as_mut() else {
|
let Some(context_menu) = self.context_menu.as_mut() else {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -389,13 +389,12 @@ where
|
||||||
state.active_root.clear();
|
state.active_root.clear();
|
||||||
shell.publish(surface_action(destroy_popup(id)));
|
shell.publish(surface_action(destroy_popup(id)));
|
||||||
state.view_cursor = view_cursor;
|
state.view_cursor = view_cursor;
|
||||||
(id, layout.children().map(|lo| lo.bounds()).collect())
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
window::Id::unique(),
|
|
||||||
layout.children().map(|lo| lo.bounds()).collect(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
// A fresh id per popup, so the old popup's Done cannot be mistaken for the new one's
|
||||||
|
(
|
||||||
|
window::Id::unique(),
|
||||||
|
layout.children().map(|lo| lo.bounds()).collect(),
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut popup_menu: Menu<'static, _> = Menu {
|
let mut popup_menu: Menu<'static, _> = Menu {
|
||||||
|
|
|
||||||
|
|
@ -938,10 +938,9 @@ where
|
||||||
state.active_root.clear();
|
state.active_root.clear();
|
||||||
shell.publish(surface_action(destroy_popup(id)));
|
shell.publish(surface_action(destroy_popup(id)));
|
||||||
state.view_cursor = view_cursor;
|
state.view_cursor = view_cursor;
|
||||||
id
|
|
||||||
} else {
|
|
||||||
window::Id::unique()
|
|
||||||
}
|
}
|
||||||
|
// A fresh id per popup, so the old popup's Done cannot be mistaken for the new one's
|
||||||
|
window::Id::unique()
|
||||||
});
|
});
|
||||||
let Some(entity) = state.show_context else {
|
let Some(entity) = state.show_context else {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue