Skip to main content

Class: WebGLController

Defined in: controllers/WebGLController.ts:17

Top-level WebGL controller that coordinates point and shape rendering

Owns a <canvas> element, a WebGL2RenderingContext, and delegates to WebGLPointsController and WebGLShapesController for data-type-specific synchronization and drawing.

Constructors

Constructor

new WebGLController(canvas, initialViewport): WebGLController

Defined in: controllers/WebGLController.ts:43

Parameters

canvas

HTMLCanvasElement

The canvas element to draw on (typically created by createCanvas)

initialViewport

Rect

Initial world-space viewport rectangle

Returns

WebGLController

Properties

canvas

readonly canvas: HTMLCanvasElement

Defined in: controllers/WebGLController.ts:21

Methods

destroy()

destroy(): void

Defined in: controllers/WebGLController.ts:194

Releases all WebGL resources held by the points and shapes sub-controllers

Returns

void


draw()

draw(): void

Defined in: controllers/WebGLController.ts:162

Clears the canvas and draws all synchronized points and shapes

Returns

void


getWorldBounds()

getWorldBounds(): Rect | null

Defined in: controllers/WebGLController.ts:174

Computes the axis-aligned bounding box of all rendered points and shapes in world coordinates

Returns

Rect | null

Bounding box in world coordinates, or null if no points or shapes are rendered


initialize()

initialize(options?): Promise<WebGLController>

Defined in: controllers/WebGLController.ts:106

Performs one-time asynchronous initialization (e.g. loading the marker atlas)

Parameters

options?

Optional abort signal

signal?

AbortSignal

Returns

Promise<WebGLController>

This controller instance, for chaining


resizeCanvas()

resizeCanvas(newCanvasSize): boolean

Defined in: controllers/WebGLController.ts:137

Resizes the canvas to match the given screen-space dimensions, accounting for devicePixelRatio and clamping to _maxCanvasSize

Parameters

newCanvasSize

Desired canvas size in screen-space pixels

height

number

width

number

Returns

boolean

true if the canvas size actually changed, false otherwise


setDrawOptions()

setDrawOptions(drawOptions): object

Defined in: controllers/WebGLController.ts:85

Applies new draw options

Parameters

drawOptions

DrawOptions

The new draw options

Returns

object

Flags indicating whether points and/or shapes need to be re-synchronized, and whether a redraw is needed

redraw

redraw: boolean

syncPoints

syncPoints: boolean

syncShapes

syncShapes: boolean


setViewport()

setViewport(newViewport): boolean

Defined in: controllers/WebGLController.ts:66

Updates the world-space viewport rectangle

Parameters

newViewport

Rect

New viewport bounds in world coordinates

Returns

boolean

true if the viewport actually changed, false otherwise


synchronizePoints()

synchronizePoints(...args): Promise<void>

Defined in: controllers/WebGLController.ts:117

Delegates to WebGLPointsController.synchronize

Parameters

args

...[Layer[], Points[], DefaultMap<Marker>[], DefaultMap<number>[], DefaultMap<Color>[], DefaultMap<boolean>[], DefaultMap<number>[], (pointsId, options?) => Promise<PointsData>, (tableId, options?) => Promise<TableData>, object]

Returns

Promise<void>


synchronizeShapes()

synchronizeShapes(...args): Promise<void>

Defined in: controllers/WebGLController.ts:124

Delegates to WebGLShapesController.synchronize

Parameters

args

...[Layer[], Shapes[], DefaultMap<Color>[], DefaultMap<boolean>[], DefaultMap<number>[], (shapesId, options?) => Promise<ShapesData>, (tableId, options?) => Promise<TableData>, object]

Returns

Promise<void>


createCanvas()

static createCanvas(): HTMLCanvasElement

Defined in: controllers/WebGLController.ts:29

Creates a positioned, full-size <canvas> element for the WebGL overlay

Returns

HTMLCanvasElement