Adjust position of ContextMenu if it's too close to bottom or right edges #188
This commit is contained in:
parent
186f8a1742
commit
2be2b6b54b
@ -30,9 +30,14 @@ void ContextMenu::Show(ui::Point position)
|
|||||||
}
|
}
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
|
|
||||||
Position = position;
|
|
||||||
Size.Y = items.size()*16;
|
|
||||||
Size.X = 100;
|
Size.X = 100;
|
||||||
|
Size.Y = items.size()*16-1;
|
||||||
|
|
||||||
|
if(position.X+Size.X > XRES+BARSIZE)
|
||||||
|
position.X -= std::min(position.X, Size.X);
|
||||||
|
if(position.Y+Size.Y > YRES+MENUSIZE)
|
||||||
|
position.Y -= std::min(position.Y, Size.Y);
|
||||||
|
Position = position;
|
||||||
|
|
||||||
int currentY = 1;
|
int currentY = 1;
|
||||||
for(int i = 0; i < items.size(); i++)
|
for(int i = 0; i < items.size(); i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user