Keep hidden 3D views from covering the open view

A 3D view asked for a frame while its card was hidden, for example when
the sidebar resized, showed its GPU window again. AWT maps a shown
canvas even under a hidden parent, so the window covered the open view
in black. Frames only go into the window while the view is on screen.

Model used: Opus 5.5
This commit is contained in:
piexel committed 2026-10-25 21:49:03 +01:00
1 parent 6900f270ee
commit e3bc27d50c
1 file changed
+5 -4
@@ -354,8 +354,9 @@ final class OrbitViewport extends JComponent {
}
/**
* Frames go straight into the window when the scene can be drawn that way, Swing has nothing to paint over the
* whole view, and the screen's pixels are the view's own. The window is shown before the frame is drawn into it.
* Frames go straight into the window when the view is on screen, the scene can be drawn that way, Swing has nothing
* to paint over the whole view, and the screen's pixels are the view's own. The window is shown before the frame is
* drawn into it. Showing it maps it even while its card is hidden, where it would cover the card that is open.
*
* @return the window, or nothing to draw a picture for Swing instead
*/
@@ -370,8 +371,8 @@ final class OrbitViewport extends JComponent {
}
private boolean drawsOnScreen() {
return canvas != null && canvas.window() != 0L && scene != null && !scene.isEmpty() && scene.canRenderOnScreen()
&& !isLoadingShown() && hasUnscaledPixels();
return canvas != null && isShowing() && canvas.window() != 0L && scene != null && !scene.isEmpty()
&& scene.canRenderOnScreen() && !isLoadingShown() && hasUnscaledPixels();
}
private boolean hasUnscaledPixels() {