Skip to content

Commit

Permalink
polish: Prevent the 'Advanced Settings' submenu from touching the rig…
Browse files Browse the repository at this point in the history
…ht notebook window edge
  • Loading branch information
ConnorGray committed Jun 8, 2023
1 parent 78788cc commit f967261
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions Source/Chatbook/UI.wl
Original file line number Diff line number Diff line change
Expand Up @@ -2122,14 +2122,36 @@ makeChatActionMenuContent[
}},
Spacings -> 0
],
Hold[AttachCell[
EvaluationCell[],
advancedSettingsMenu,
{Right, Bottom},
{50, 50},
{Left, Bottom},
RemovalConditions -> "MouseExit"
]]
Hold @ With[{
mouseX = MousePosition["WindowScaled"][[1]]
}, {
(* Note: Depending on the X coordinate of the users mouse
when they click the 'Advanced Settings' button, either
show the attached submenu to the left or right of the
outer menu. This ensures that this submenu doesn't touch
the right edge of the notebook window when it is opened
from the 'Chat Settings' notebook toolbar. *)
positions = If[
TrueQ[mouseX < 0.5],
{
{Right, Bottom},
{Left, Bottom}
},
{
{Left, Bottom},
{Right, Bottom}
}
]
},
AttachCell[
EvaluationCell[],
advancedSettingsMenu,
positions[[1]],
{50, 50},
positions[[2]],
RemovalConditions -> "MouseExit"
]
]
}
}
];
Expand Down

0 comments on commit f967261

Please sign in to comment.