internal ContextMenu(ContextMenuArea cma) { options = cma.options; position = new Position(Input.mX, Input.mY); int mX = 0; int y = 0; foreach (ContextMenuOption option in options) { option.owner = this; option.yOff = y; Vector2 dim = GUIHelper.StrSize(option.text); if (dim.X > mX) { mX = (int)dim.X; } y += (int)dim.Y + 8; } size = new Size(mX > 200 ? mX : 200, y); foreach (ContextMenuOption option in options) { option.width = mX > 200 ? mX : 200; } Rectangle menu = new Rectangle(position.X, position.Y, size.width, size.height); if (menu.Bottom > GUIHelper.sb.GraphicsDevice.Viewport.Height) { position.Y = Input.mY - size.height; } }