scenerygraphics / sciview

sciview is a tool for visualization and interaction with ND image and mesh data
BSD 2-Clause "Simplified" License
62 stars 17 forks source link

Node selection menu is displaced by Windows Display scaling. #475

Open moreApi opened 1 year ago

moreApi commented 1 year ago

When windows display scaling is active like this:

image

then the node selection popup menu is displaced by that amount: image In the picture the user clicked on the middle of the box and that is the location the menu is expected but the position iof the menu has been multiplied by 1.5. (Clicking on other parts of the screen shows the 1.5 relation. E.g. clicking in the top left corner (0,0) places the menu correctly (0,0) * 1.5 = (0,0). The further away one clicks from the top left corner the larger is the displacement.)

Setting the scaling to 100% and restarting the application removes that behavior.

This might be a swing issue.

ctrueden commented 1 year ago

Duplicate of #469? Err, I guess not a duplicate, but seems likely we could address it as part of a broader fix for HiDPI...

kephale commented 4 months ago

I found that val dpiScaling = Toolkit.getDefaultToolkit().screenResolution.toDouble() / 96.0 wasn't leading to a scale factor that helped (i needed 0.5, but am getting 1.5729166666666667)

This is an easy place to test out: https://github.com/scenerygraphics/sciview/blob/80c84030ed2058ffa597bfef96993eeea5b3e7bf/src/main/kotlin/sc/iview/Controls.kt#L578 then if you run sciview and add the mesh demo and double click on it the context menu should show up. When I scale x, y by 0.5 I can get the context menu in the right place.