Open jzy3d opened 1 year ago
Another way of dealing with HiDPI for Windows would be
setLayout(new BorderLayout() {
@Override
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
Insets insets = target.getInsets();
int top = insets.top;
int bottom = target.getHeight() - insets.bottom;
int left = insets.left;
int right = target.getWidth() - insets.right;
Graphics graphics = getGraphics();
AffineTransform transform = ((Graphics2D) graphics).getTransform();
double scaleX = transform.getScaleX();
double scaleY = transform.getScaleY();
int width = right - left;
int height = bottom - top;
width *= scaleX;
height *= scaleY;
renWin.setBounds(left, top, width, height);
}
}
});
Currently, some specific code is required when handling 2D overlays with JOGL (native) and EmulGL charts.
This result in lot of code area where we use canvas.isNative() to apply different formulae for the layout in EmulGL or Native (e.g. View2DLayout).
Code would be simpler and more readable if EmulGLCanvas could return a scaled renderer height/width.