RendererAdapter
Defined in: RendererAdapter.ts:33
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.
Properties
Section titled “Properties”canvas
Section titled “canvas”
readonlycanvas:HTMLCanvasElement
Defined in: RendererAdapter.ts:34
visibleVirtualRect?
Section titled “visibleVirtualRect?”
readonlyoptionalvisibleVirtualRect?:object
Defined in: RendererAdapter.ts:88
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.
height
Section titled “height”
readonlyheight:number
readonlywidth:number
readonlyx:number
readonlyy:number
Methods
Section titled “Methods”canvasToVirtual()?
Section titled “canvasToVirtual()?”
optionalcanvasToVirtual(x,y):object
Defined in: RendererAdapter.ts:40
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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”object
x:
number
y:
number
dispatchPointerEvent()?
Section titled “dispatchPointerEvent()?”
optionaldispatchPointerEvent(type,point,button?):void
Defined in: RendererAdapter.ts:73
Deliver a pointer event at point, in virtual-space pixels, through the
renderer’s own event system, so hit testing, stacking order and clipping
apply as they do for a person clicking. button says which mouse button
a press or a release carries; a move carries no button change and omits
it, and the renderer reports whatever buttons its synthetic pointer still
holds.
Optional. A renderer that cannot deliver yet — before it has drawn a frame, for one — throws with a message naming what to do.
Parameters
Section titled “Parameters”number
number
button?
Section titled “button?”0 | 1 | 2
Returns
Section titled “Returns”void
hitTestUI()?
Section titled “hitTestUI()?”
optionalhitTestUI(x,y):boolean
Defined in: RendererAdapter.ts:55
Hit-test at virtual-space coordinates and return true when the topmost
interactive container under (x, y) resolves to a consuming policy
registered via markPointerConsumeContainer.
The nearest explicit boolean wins. Inheriting UI with no explicit ancestor
consumes by default; an unregistered path does not.
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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
hitTestUIPath()?
Section titled “hitTestUIPath()?”
optionalhitTestUIPath(x,y):RendererUIHit|null
Defined in: RendererAdapter.ts:61
The same hit test as RendererAdapter.hitTestUI, reporting what was
hit rather than only whether the pointer is claimed. null when nothing
interactive sits under (x, y).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”RendererUIHit | null
Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.