Class: SVGController
Defined in: controllers/SVGController.ts:19
Controller for managing the drawing of SVG shapes
Constructors
Constructor
new SVGController(
container,initialViewport,options?):SVGController
Defined in: controllers/SVGController.ts:55
Parameters
container
SVGSVGElement
The <svg> element to draw on (typically created by createContainer)
initialViewport
Initial world-space viewport rectangle
options?
Optional shape drawing event handlers
onShapeComplete?
(shape) => void
Returns
SVGController
Properties
container
readonlycontainer:SVGSVGElement
Defined in: controllers/SVGController.ts:20
shapeCompleteHandler?
readonlyoptionalshapeCompleteHandler?: (shape) =>void
Defined in: controllers/SVGController.ts:22
Parameters
shape
Returns
void
transformNode
readonlytransformNode:SVGGElement
Defined in: controllers/SVGController.ts:21
Methods
destroy()
destroy():
void
Defined in: controllers/SVGController.ts:131
Returns
void
resizeContainer()
resizeContainer(
newContainerSize):boolean
Defined in: controllers/SVGController.ts:107
Resizes the SVG container to match the given screen-space dimensions,
accounting for devicePixelRatio
Parameters
newContainerSize
Desired container size in screen-space pixels
height
number
width
number
Returns
boolean
true if the container size actually changed, false otherwise
setInteractionMode()
setInteractionMode(
newInteractionMode):void
Defined in: controllers/SVGController.ts:96
Updates the interaction mode
Parameters
newInteractionMode
New interaction mode
Returns
void
setViewport()
setViewport(
newViewport):boolean
Defined in: controllers/SVGController.ts:77
Updates the world-space viewport rectangle
Parameters
newViewport
New viewport bounds in world coordinates
Returns
boolean
true if the viewport actually changed, false otherwise
createContainer()
staticcreateContainer():SVGSVGElement
Defined in: controllers/SVGController.ts:40
Creates a positioned, full-size <svg> element for the SVG overlay
Returns
SVGSVGElement