Core.SizeNode Class
Defined in:
samsara/core/SizeNode.js:9
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)
Item Index
Methods
Methods
set
(
-
obj
Introduce new data streams to the size node in {key : value} pairs.
Here the key is one of "size", "proportions" or "marins".
The value is either a stream, or a simple type like a Number or Array.
Simple types will be wrapped in an Observerable to emit appropriate events.
Parameters:
-
objObjectObject of data sources