-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Borders are calculated wrong #376
Comments
can you share MML code? |
namespace Prototype.Screens.MainMenu;
using Microsoft.Xna.Framework;
using Myra.Graphics2D.Brushes;
using Myra.Graphics2D.UI;
public sealed class PlayMenuWidget : VerticalStackPanel
{
public PlayMenuWidget(Game game)
{
this.HorizontalAlignment = HorizontalAlignment.Stretch;
this.VerticalAlignment = VerticalAlignment.Stretch;
this.Padding = new(9);
this.Background = new SolidBrush(new Color(0x10, 0x10, 0x10));
this.Border = new SolidBrush(new Color(0x80, 0x80, 0x80));
this.BorderThickness = new(1);
var playersScroll = new ScrollViewer
{
Border = new SolidBrush(new Color(0x80, 0x80, 0x80)), BorderThickness = new(1), Margin = new(0, 0, 0, 0), Height = 130
};
this.AddChild(playersScroll);
var players = new VerticalStackPanel();
playersScroll.Content = players;
var pressToJoin = new Label();
players.AddChild(pressToJoin);
var buttons = new Grid { Border = new SolidBrush(new Color(0x80, 0x80, 0x80)), BorderThickness = new(1) };
this.AddChild(buttons);
var back = new TextButton { Text = "Back", Width = 100, Height = 15, HorizontalAlignment = HorizontalAlignment.Left };
back.Click += (_, _) => this.Desktop.Root = new MainMenuWidget(game);
buttons.AddChild(back);
var play = new TextButton { Text = "Play", Width = 100, Height = 15, HorizontalAlignment = HorizontalAlignment.Right };
play.Click += (_, _) => this.Desktop.Root = new MainMenuWidget(game);
buttons.AddChild(play);
}
} |
|
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using border, the border is correctly drawn inside the box. However the next element is pushed away by the border distance, resulting in a gap between widgets when using borders.
The following inner boxes do not use margin or padding:
![image](https://user-images.githubusercontent.com/1322277/195823748-ecbfa176-62de-4aba-ad28-8f32e1bfc5b1.png)
![image](https://user-images.githubusercontent.com/1322277/195823896-70155514-8301-4d84-a122-8897ceba2d29.png)
which is a borderwidth of 1. when setting it to two, the result is:
Also there is a visible magical padding on the right bottom of the lower box. Might be related to that.
The text was updated successfully, but these errors were encountered: