Class PixelScaleSupportJFX

java.lang.Object
panamagl.canvas.PixelScaleSupportJFX

public class PixelScaleSupportJFX extends Object
HiDPI plumbing for GLCanvasJFX.

Reads the current pixel scale from Window.getRenderScaleX() / Window.getRenderScaleY() (the actual scale used by Prism — typically equal to the screen output scale, but possibly capped by the JVM property prism.allowhidpi).

Falls back to Screen.getOutputScaleX() / Screen.getOutputScaleY() when the canvas is not yet attached to a window — for example during construction.

Listeners are wired in cascade so that the scale-change events keep firing even when the canvas is reparented to a different scene or stage: canvas.sceneProperty -> scene.windowProperty -> window.renderScaleX/Y.

Unlike the AWT support, no polling is needed: JavaFX publishes a property change every time the render scale changes (e.g. monitor switch, OS scaling change).