SVGBlock¶
Overview¶
Handles a visual SVG layer of drawables.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class SVGBlock¶
Constructor¶
new SVGBlock( display, renderer, transformRootInstance, filterRootInstance )¶
Instance Methods¶
initialize( display, renderer, transformRootInstance, filterRootInstance )¶
@param {Display} display - the scenery Display this SVGBlock will appear in @param {number} renderer - the bitmask for the renderer, see Renderer.js @param {Instance} transformRootInstance - All transforms of this instance and its ancestors will already have been applied. This block will only be responsible for applying transforms of this instance's descendants. @param {Instance} filterRootInstance - All filters (visibility/opacity/filters) of this instance and its ancestors will already have been applied. This block will only be responsible for applying filters of this instance's descendants. @returns {FittedBlock}
onAddPaint( paint )¶
Callback for paintCountMap's create @private
@param {Paint} paint @returns {SVGGradient|SVGPattern}
onRemovePaint( paint, svgPaint )¶
Callback for paintCountMap's destroy @private
@param {Paint} paint @param {SVGGradient|SVGPattern} svgPaint
incrementPaint( paint )¶
Increases our reference count for the specified {Paint}. If it didn't exist before, we'll add the SVG def to the paint can be referenced by SVG id. @public
@param {Paint} paint
decrementPaint( paint )¶
Decreases our reference count for the specified {Paint}. If this was the last reference, we'll remove the SVG def from our SVG tree to prevent memory leaks, etc. @public
@param {Paint} paint
markDirtyGradient( gradient )¶
@param {SVGGradient} gradient
markDirtyGroup( block )¶
@param {Block} block
markDirtyDrawable( drawable )¶
@param {Drawable} drawable
setSizeFullDisplay()¶
setSizeFitBounds()¶
update()¶
Updates the DOM appearance of this drawable (whether by preparing/calling draw calls, DOM element updates, etc.) @public @override
@returns {boolean} - Whether the update should continue (if false, further updates in supertype steps should not be done).
reduceReferences()¶
Looks to remove dirty objects that may have been disposed. See https://github.com/phetsims/energy-forms-and-changes/issues/356 @public
dispose()¶
Releases references @public
addDrawable( drawable )¶
@param {Drawable} drawable
removeDrawable( drawable )¶
@param {Drawable} drawable
onIntervalChange( firstDrawable, lastDrawable )¶
@param {Drawable} firstDrawable @param {Drawable} lastDrawable
toString()¶
Returns a string form of this object @public
@returns {string}
Source Code¶
See the source for SVGBlock.js in the scenery repository.