rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
742 stars 93 forks source link

Scale should impact the viewport! #375

Open IceReaper opened 2 years ago

IceReaper commented 2 years ago

When using Scale, a message box for example is opened outside of the ui. As a workaround i was able to do this:

protected Screen()
{
    this.Desktop = new() { BoundsFetcher = this.GetDesktopBounds };
}

private Rectangle GetDesktopBounds()
{
    return new(this.bounds.Location, new((int)(this.bounds.Size.X / this.Desktop.Scale.X), (int)(this.bounds.Size.Y / this.Desktop.Scale.Y)));
}
IceReaper commented 2 years ago

Found some more cases. In general scale does not make elements use the right layout bounds.