The unit of position is CGFloat
This commit is contained in:
parent
fca91db133
commit
b866b34ac8
1 changed files with 4 additions and 4 deletions
|
@ -51,15 +51,15 @@ void MenuMac::PopupAt(Window* window, int x, int y, int positioning_item) {
|
|||
|
||||
// If no preferred item is specified, try to show all of the menu items.
|
||||
if (!positioning_item) {
|
||||
int windowBottom = CGRectGetMinY([view window].frame);
|
||||
int distaceFromBottom = windowBottom + position.y - [menu size].height;
|
||||
CGFloat windowBottom = CGRectGetMinY([view window].frame);
|
||||
CGFloat distaceFromBottom = windowBottom + position.y - [menu size].height;
|
||||
if (distaceFromBottom < 0)
|
||||
position.y = position.y - distaceFromBottom;
|
||||
}
|
||||
|
||||
// Place the menu left of cursor if it is overflowing off right of screen.
|
||||
int windowLeft = CGRectGetMinX([view window].frame);
|
||||
int rightmostPoint = windowLeft + position.x + [menu size].width;
|
||||
CGFloat windowLeft = CGRectGetMinX([view window].frame);
|
||||
CGFloat rightmostPoint = windowLeft + position.x + [menu size].width;
|
||||
if (rightmostPoint > [[NSScreen mainScreen] visibleFrame].size.width)
|
||||
position.x = position.x - [menu size].width;
|
||||
|
||||
|
|
Loading…
Reference in a new issue