Class: SVGController
Defined in: SVGController.ts:37
Controller for managing the drawing of SVG shapes
Constructors
Constructor
new SVGController(
container,options?):SVGController
Defined in: SVGController.ts:80
Creates the transform node inside the given container and registers the shape drawing event handlers
The viewport starts out as the unit square; setViewport is the only way to change it.
Parameters
container
SVGSVGElement
The <svg> element to draw on (typically created by createContainer)
options?
Optional shape drawing event handlers
onShapeComplete?
(shape) => void
Returns
SVGController
Properties
container
readonlycontainer:SVGSVGElement
Defined in: SVGController.ts:38
shapeCompleteHandler?
readonlyoptionalshapeCompleteHandler?: (shape) =>void
Defined in: SVGController.ts:40
Parameters
shape
Returns
void
transformNode
readonlytransformNode:SVGGElement
Defined in: SVGController.ts:39
Methods
destroy()
destroy():
void
Defined in: SVGController.ts:153
Returns
void
resizeContainer()
resizeContainer(
newContainerSize):boolean
Defined in: SVGController.ts:132
Resizes the SVG container to match the given screen-space dimensions,
accounting for devicePixelRatio
Parameters
newContainerSize
Desired container size in screen-space pixels
Returns
boolean
true if the container size actually changed, false otherwise
setInteractionMode()
setInteractionMode(
newInteractionMode):void
Defined in: SVGController.ts:115
Updates the interaction mode
Parameters
newInteractionMode
New interaction mode
Returns
void
setViewport()
setViewport(
viewport):boolean
Defined in: SVGController.ts:101
Updates the world-space viewport rectangle
Parameters
viewport
New viewport bounds in world coordinates
Returns
boolean
true if the viewport actually changed, false otherwise
createContainer()
staticcreateContainer():SVGSVGElement
Defined in: SVGController.ts:60
Creates a positioned, full-size <svg> element for the SVG overlay
Returns
SVGSVGElement