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,viewport):WebGLController
Defined in: controllers/WebGLController.ts:42
Parameters
canvas
HTMLCanvasElement
The canvas element to draw on (typically created by createCanvas)
viewport
Initial world-space viewport rectangle
Returns
WebGLController
Methods
destroy()
destroy():
void
Defined in: controllers/WebGLController.ts:169
Releases all WebGL resources held by the points and shapes sub-controllers
Returns
void
draw()
draw():
void
Defined in: controllers/WebGLController.ts:161
Clears the canvas and draws all synchronized points and shapes
Returns
void
initialize()
initialize(
options?):Promise<WebGLController>
Defined in: controllers/WebGLController.ts:105
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(
size):boolean
Defined in: controllers/WebGLController.ts:136
Resizes the canvas to match the given CSS pixel size, accounting for
devicePixelRatio and clamping to _maxCanvasSize
Parameters
size
Desired CSS pixel dimensions
height
number
width
number
Returns
boolean
true if the canvas size actually changed, false otherwise
setDrawOptions()
setDrawOptions(
drawOptions):object
Defined in: controllers/WebGLController.ts:84
Applies new draw options
Parameters
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(
viewport):boolean
Defined in: controllers/WebGLController.ts:65
Updates the world-space viewport rectangle
Parameters
viewport
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:116
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:123
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()
staticcreateCanvas():HTMLCanvasElement
Defined in: controllers/WebGLController.ts:29
Creates a positioned, full-size <canvas> element for the WebGL overlay
Returns
HTMLCanvasElement