Skip to content

RendererAdapter

Defined in: RendererAdapter.ts:13

Cross-package contract for “something that owns a canvas and can map canvas-relative CSS pixels into virtual-space pixels”.

Implemented by @yagejs/renderer’s RendererPlugin and consumed by @yagejs/input for pointer-event targeting and coordinate mapping under responsive fit. Foreign renderers can implement this interface and register under RendererAdapterKey to integrate with the input plugin without importing @yagejs/renderer.

readonly canvas: HTMLCanvasElement

Defined in: RendererAdapter.ts:14


readonly optional visibleVirtualRect?: object

Defined in: RendererAdapter.ts:44

The on-screen region of virtual space, CLAMPED to the declared virtual rect — the area a screen-space overlay may lay out in and expect to be both visible and reachable. Distinct from mapping the canvas corners through canvasToVirtual: under letterbox fit the corners map into the masked bars, where drawn content is clipped but pointer input still lands. Must return a fresh object per access (consumers diff and store it). Optional — when absent, consumers fall back to corner mapping, which is correct only for fit modes without masked bars.

readonly height: number

readonly width: number

readonly x: number

readonly y: number

optional canvasToVirtual(x, y): object

Defined in: RendererAdapter.ts:20

Convert CSS pixels relative to the canvas into virtual-space pixels. Optional — when absent, consumers fall back to raw CSS pixels (correct only when canvas CSS size equals virtual size).

number

number

object

x: number

y: number


optional hitTestUI(x, y): boolean

Defined in: RendererAdapter.ts:33

Hit-test at virtual-space coordinates and return true when the topmost interactive container under (x, y) is parented (directly or through any ancestor) to a container marked via markPointerConsumeContainer. Optional — when absent, the input plugin’s UI auto-consume fallback is a no-op.

Implemented by @yagejs/renderer over Pixi’s EventBoundary. The input plugin calls this on pointerdown drains to auto-claim presses that land on UI surfaces (UIPanel backgrounds, decorative UIText, etc.) without requiring per-component handler boilerplate.

number

number

boolean