API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classCappedResolutionCanvasSizing

@codexo/exojs / core / stable

Scales the canvas to its parent and lets the render resolution follow it downwards, but never above the base resolution. The CSS box is the largest base-aspect rectangle that fits the parent, exactly as with FixedResolutionCanvasSizing. Below the base resolution the backing store follows the smaller display size, so a phone renders fewer pixels; above it the backing store stops at `base x pixelRatio`, so a large display costs no more to draw than the resolution the app was authored for. The logical coordinate system is always the base resolution. The balanced responsive mode, and the usual choice when a fixed aspect ratio is wanted but a fixed pixel budget is not. Requires a canvas element with a parent in the document.

0
props
2
methods
0
events
Import
import { CappedResolutionCanvasSizing } from '@codexo/exojs'

Scales the canvas to its parent and lets the render resolution follow it downwards, but never above the base resolution.

The CSS box is the largest base-aspect rectangle that fits the parent, exactly as with FixedResolutionCanvasSizing. Below the base resolution the backing store follows the smaller display size, so a phone renders fewer pixels; above it the backing store stops at `base x pixelRatio`, so a large display costs no more to draw than the resolution the app was authored for. The logical coordinate system is always the base resolution.

The balanced responsive mode, and the usual choice when a fixed aspect ratio is wanted but a fixed pixel budget is not.

Requires a canvas element with a parent in the document.

Constructors1
new(): CappedResolutionCanvasSizing
Methods2
Take ownership of context. Called once the surface exists and, for a canvas mounted through canvas.mount, once it is in the document.
detach(): void
Release everything CanvasSizing.attach created - observers, listeners, message channels - and undo any styling the policy applied itself. The CSS box committed through CanvasSizingContext.apply is not one of those: the application clears that on detach. The default implementation does nothing, which is correct for a policy that observes nothing.
Source