mariuszhermansdorfer / SandWorm

Augmented Reality Sandbox for Grasshopper & Rhino
MIT License
20 stars 11 forks source link

Font sizes in custom UI elements may need to scale to DPI settings #81

Closed philipbelesky closed 2 years ago

philipbelesky commented 2 years ago

Not sure if this is a weird artefact of my setup, but the font size values (and perhaps UI dimensions more broadly) seem much overscaled in Grasshopper. This creates some clipping in the dropdown menus. This is at 200% UI scale on a 5120x2880px screen.

Screen Shot 2021-08-18 at 5 58 29 pm
mariuszhermansdorfer commented 2 years ago

Thanks for reporting. I never work with UI scaling, so never caught this bug. Definitely an oversight in the UI code.

mariuszhermansdorfer commented 2 years ago

@philipbelesky, I tried replicating this on my end - but it's a pain to work with 200% UI scale on a low-res monitor. I'm not sure what the issue is? Are all the UI elements way too big and all text should be made smaller, or is the font size ok, and the UI containers are too small?

If it's the former - try changing these values: https://github.com/mariuszhermansdorfer/SandWorm/blob/9801a79812ebe71dd67b9235f5ea08cc9361a705/SandWorm/CustomComponent/WidgetServer.cs#L89-L108

For the latter - it seems, that there is a hard-coded 20 px height value for each menu item: https://github.com/mariuszhermansdorfer/SandWorm/blob/9801a79812ebe71dd67b9235f5ea08cc9361a705/SandWorm/CustomComponent/MenuDropDown.cs#L91-L93

Quick search for '20' shows that it is referenced multiple times in the code. Replacing it with a proper variable relating to Windows' UI scaling factor could fix it.

mariuszhermansdorfer commented 2 years ago

@philipbelesky, did you make any progress on this issue?

philipbelesky commented 2 years ago

Hadn't had a go at it yet. I'd be happy to, but it might be more useful for you to look at given your work with Custom UI things?

mariuszhermansdorfer commented 2 years ago

I can help with the code, but don't have a high-res monitor around to test it on.