Skip to content

PaintSVGState

Overview

Handles SVG <defs> and fill/stroke style for SVG elements (by composition, not a trait or for inheritance).

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class PaintSVGState

import { PaintSVGState } from 'scenerystack/scenery';

Constructor

new PaintSVGState()

Instance Methods

initialize()

Initializes the state @public

dispose()

Disposes the PaintSVGState, releasing listeners as needed. @public

releaseFillPaint()

@private

releaseStrokePaint()

@private

updateFill( svgBlock, fill )

Called when the fill needs to be updated, with the latest defs SVG block @public

@param {SVGBlock} svgBlock @param {null|string|Color|LinearGradient|RadialGradient|Pattern} fill

updateStroke( svgBlock, stroke )

Called when the stroke needs to be updated, with the latest defs SVG block @public

@param {SVGBlock} svgBlock @param {null|string|Color|LinearGradient|RadialGradient|Pattern} fill

updateBaseStyle()

@private

updateStrokeDetailStyle( node )

@private

@param {Node} node

updateSVGBlock( svgBlock )

Called when the defs SVG block is switched (our SVG element was moved to another SVG top-level context) @public

@param {SVGBlock} svgBlock

Source Code

See the source for PaintSVGState.js in the scenery repository.