FittedBlock¶
Overview¶
A Block that needs to be fitted to either the screen bounds or other local bounds. This potentially reduces memory usage and can make graphical operations in the browser faster, yet if the fit is rapidly changing could cause performance degradation.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class FittedBlock¶
Instance Methods¶
initialize( display, renderer, transformRootInstance, preferredFit )¶
@param {Display} display @param {number} renderer @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 {FittedBlock.Fit} preferredFit @returns {FittedBlock} - For chaining
setFit( fit )¶
Changes the current fit, if it's currently different from the argument. @private
@param {FittedBlock.Fit} fit
markDirtyFit()¶
updateFit()¶
Should be called from update() whenever this block is dirty @protected
setSizeFullDisplay()¶
setSizeFitBounds()¶
addCommonFitInstance( instance )¶
@param {Instance|null} instance
removeCommonFitInstance()¶
dispose()¶
Releases references @public @override
addDrawable( drawable )¶
Track the fittability of the added drawable. @public @override
@param {Drawable} drawable
removeDrawable( drawable )¶
Stop tracking the fittability of the removed drawable. @public @override
@param {Drawable} drawable
onFittabilityChange( fittable )¶
Called from the fittability listener attached to child drawables when their fittability changes. @private
@param {boolean} fittable - Whether the particular child drawable is fittable
incrementUnfittable()¶
The number of unfittable child drawables was increased by 1. @private
decrementUnfittable()¶
The number of unfittable child drawables was decreased by 1. @private
checkFitConstraints()¶
Check to make sure we are using the correct current fit. @private
computeCommonAncestorInstance()¶
@returns {Instance}
onIntervalChange( firstDrawable, lastDrawable )¶
@param {Drawable} firstDrawable @param {Drawable} lastDrawable
Source Code¶
See the source for FittedBlock.js in the scenery repository.