Fix issue where you could have multiple context menus.

Fixes #12149
This commit is contained in:
Greyson Parrelli
2022-04-12 16:59:34 -04:00
parent e143c47c25
commit fae3004512
2 changed files with 14 additions and 5 deletions

View File

@@ -55,10 +55,10 @@ class SignalContextMenu private constructor(
contextMenuList.setItems(items)
}
private fun show() {
private fun show(): SignalContextMenu {
if (anchor.width == 0 || anchor.height == 0) {
anchor.post(this::show)
return
return this
}
contentView.measure(
@@ -107,6 +107,8 @@ class SignalContextMenu private constructor(
}
showAsDropDown(anchor, offsetX, offsetY)
return this
}
enum class HorizontalPosition {
@@ -147,8 +149,8 @@ class SignalContextMenu private constructor(
return this
}
fun show(items: List<ActionItem>) {
SignalContextMenu(
fun show(items: List<ActionItem>): SignalContextMenu {
return SignalContextMenu(
anchor = anchor,
container = container,
items = items,