rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
704 stars 94 forks source link

Scale should impact the viewport! #375

Open IceReaper opened 1 year ago

IceReaper commented 1 year 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 1 year ago

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