API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
interfaceCanvasApplicationOptions
@codexo/exojs / core / stable
8
props
0
methods
0
events
Import
import { CanvasApplicationOptions } from '@codexo/exojs'Properties8
Existing surface to render into. If omitted, Application creates a canvas element - and a canvas it created is also one it removes from the document again in Application.destroy. A surface passed in here stays yours: it is left untouched when the application goes down. An OffscreenCanvas is accepted and makes the application surface-only: it has no layout box, no styling and no events, so mount, tabIndex and imageRendering do not apply, the document-based sizing policies reject it, and the host has to supply its own ApplicationOptions.platform affordances for input. See OffscreenPlatform.
height?: numberBase (design) resolution in logical pixels. See CanvasApplicationOptions.width. Default: 600.
imageRendering?: "auto" | "crisp-edges" | "pixelated"CSS image-rendering hint applied to the canvas style.
mount?: HTMLElement | stringElement (or CSS selector) to append the canvas to on construction. If omitted, the canvas is created but not mounted - append it yourself.
pixelRatio?: numberDevice/render pixel ratio applied to the backing buffer. Default: the host devicePixelRatio clamped to 2 (crisp on Retina/HiDPI out of the box, capped so DPR-3 phones don't pay a 9× fill-rate cost), followed for the application's lifetime as the host's ratio changes. Pass an explicit value to override - e.g. window.devicePixelRatio for full native density, or 1 to force logical-pixel rendering - which also pins it, so a later host change is ignored.
Strategy that keeps the canvas in step with its surroundings. Omit it for a canvas that stays at width × height for good, in CSS pixels and in backing-store pixels alike, and observes nothing. The built-in policies - FixedResolutionCanvasSizing, CappedResolutionCanvasSizing, ResponsiveCanvasSizing and ManualCanvasSizing - cover the usual cases; CanvasSizing is the public base class for anything else. Each instance owns its own observers, so nothing is attached for a policy that tracks nothing. An instance belongs to one application: it is attached here and detached again when Application.sizing is reassigned or the application is destroyed. The document-based policies need a canvas element with a parent, which for a canvas created by the engine means mount has to be given too.
tabIndex?: numberCanvas tabIndex. Default: -1, preserving current behavior.
width?: numberBase (design) resolution in logical pixels, and with it the base aspect ratio. Default: 800. This is the resolution the application is authored against: the logical coordinate system starts here, CanvasApplicationOptions.sizing measures its resolution caps against it, and it is the size a canvas with no sizing policy keeps for good.
Source