Open andre2007 opened 1 year ago
Your static layout didn't scale sizes with the zoom. There's a method Widget.scaleWithDpi
that can help:
http://arsd-official.dpldocs.info/arsd.minigui.Widget.scaleWithDpi.1.html
If you stick a scaleWithDpi(...)
around each of your position and size numbers it should help. I'm not sure it will be perfect but it should help.
(StaticLayout uses exactly the numbers you give it, assuming you know what you're doing, so it doesn't automatically adjust. Most the other layouts should adjust tho unless i bugged it again.)
Thanks Adam. This almost works fine. I adapted the coding above. Please notice the function
void correctScale(StaticLayout l)
{
foreach(child; l.children)
{
child.x = child.scaleWithDpi(child.x);
child.y = child.scaleWithDpi(child.y);
child.width = child.scaleWithDpi(child.width);
child.height = child.scaleWithDpi(child.height);
}
}
(I had to set width and height from protected to public in minigui.d)
With the new coding, the elements looks fine. I noticed one small issue. With 200% scale, the window is too small.
Although I call super("Fanglist", scaleWithDpi(800), scaleWithDpi(450));
But that is not a big issue.
Maybe you could consider also doing the scaling automatically for the static layout in future.
On windows display settings you can set the scale e.g. 100%, 125 %, 150%, 200% This is with scale 125%![image](https://user-images.githubusercontent.com/1451047/216136184-ad12782a-8996-4569-8947-45a421baf953.png)
This is with scale 200% The bigger the scale, the more UI issues occurs.![image](https://user-images.githubusercontent.com/1451047/216136000-fbb2a2c5-4cf0-4181-9835-d49454d00d4b.png)
I am not sure, whether this is expected or not. The source code looks like this: