Core.SizeNode Class
Defined in:
samsara/core/nodes/SizeNode.js:6
Encapsulates a stream of size data (size, proportions, margins). Listens on start/update/end events, batches them, and emits resize events downstream to descendant size nodes.
Size can be defined with height and width given numerically, but they can also be:
undefined
- takes the parent value
true
- takes the DOM calculated value
false
- value defined by setting an aspect ratio
Constructor
Core.SizeNode
(
private
-
sources
Parameters:
Example:
var context = Context();
var surface = new Surface({
size : [100,100],
properties : {background : 'red'}
});
var sizeNode = new SizeNode({
size : [100, undefined],
margins : [50, 50]
});
context.add(sizeNode).add(surface);
context.mount(document.body)