Function
Static Public Summary | ||
public |
ExistsRequest(url: *): * |
|
public |
GetRequest(url: String): Promise Prepares a GET request and initiates the communication. |
|
public |
ParseStringToXml(text: *): * |
|
public |
PostRequest(options: Object): Promise Prepares a POST request and initiates the communication. |
|
public |
TrueSizedLayoutDockHelper(context: LayoutContext, options: Object) |
|
public |
UrlParser(url: *): * Parses a url |
|
public |
annotate(fn: *, annotation: *) |
|
public |
callbackToPromise(functionWithCallback: *, args: ...*): * |
|
public |
combineOptions(defaultOptions: *, options: *): * |
|
public |
createProviderFromFnOrClass(fnOrClass: *, annotations: *): * |
|
public |
event._subscribe(subscriptionType: String, eventName: String, callback: Function): Function Internal function used by the event decorators to generalize the idea of on, once, and off. |
|
public |
Adds an event listener to the renderable when specific event happened. |
|
public |
event.once(eventName: *, callback: *): Function Adds an event listener to the renderable when specific event happened once. |
|
public |
event.pipe(pipeToName: *): Function Pipes events from one renderable to another. |
|
public |
flow.defaultOptions(flowOptions: Object): Function Sets the default flow options for a View. |
|
public |
flow.defaultState(stateName: String, stateOptions: Object, transformations: Array.Function): Function Functions the same as @flow.stateStep(), and additionally also immediately applies the decorators passed into the 'transformations' argument. |
|
public |
flow.multipleStateStep(stateName: String, states: Array.Object): Function A wrapper around @flow.stateStep, to allow defining multiple steps with the same state name. |
|
public |
flow.stateStep(stateName: String, stateOptions: Object, transformations: Array.Function): Function Used to define a state that the renderable is able to flow to. |
|
public |
flow.viewStates(states: Object): Function Defines the View-level states, that exist of concurrently and sequentially executed renderable-level states. |
|
public |
hasAnnotation(fn: *, annotationClass: *): boolean |
|
public |
inject(tokens: ...*): * |
|
public |
isFunction(value: *): * |
|
public |
isObject(value: *): * |
|
public |
isUpperCase(char: *): * |
|
public |
layout._dockTo(dockMethod: *, size: *, space: *, zIndex: *): Function Internal function to do docking |
|
public |
Translates the renderable by a proportion of the context size. |
|
public |
layout.animate(options: Object): Function Creates an animation controller to show/hide the renderable. |
|
public |
layout.columnDockPadding(maxContentWidth: Number, defaultPadding: Array.Number): Function Like @layout.dockPadding, sets the padding between this view and its docked content. |
|
public |
layout.custom(customLayoutFunction: *): Function Adds a custom layout function to the view. |
|
public |
layout.dock.bottom(space: Number, zIndex: Number): Function Docks the renderable to the bottom. |
|
public |
Fills the space that is left after the docking with this renderable. |
|
public |
Docks the renderable to the left. |
|
public |
Marks the renderable as not being docked anymore. |
|
public |
Docks the renderable to the right. |
|
public |
layout.dock.top(space: Number, zIndex: Number): Function Docks the renderable to the top. |
|
public |
layout.dockPadding(firstMargin: Number, secondMargin: Number, thirdMargin: Number, fourthMargin: Number): Function Sets the margins for the docked content. |
|
public |
layout.dockSpace(space: Number): Function Specifies the space that should come before the docked renderable. |
|
public |
Makes the renderable allowed to be dragged around. |
|
public |
layout.flow(Options: Object): Function Makes the view flow by tweening all intermediate stages of a changed attribute of any renderable. |
|
public |
Marks the renderable to cover the entire screen. |
|
public |
layout.nativeScrollable(options: Object): Function Experimental feature of scrolling natively. |
|
public |
layout.opacity(opacity: Number): Function Sets the opacity of a renderable. |
|
public |
Sets the point where the renderable has its anchor from where rotation and translation will be done. |
|
public |
Merely marks a view property as a decorated renderable, which allows it to be rendered. |
|
public |
layout.rotate(x: Number, y: Number, z: Number): Function Rotates the renderable around any of the three axes (in radians). |
|
public |
layout.rotateFrom(x: Number, y: Number, z: Number): Function Rotates the renderable around any of the three axes (in radians) relatively to the current rotation |
|
public |
layout.scale(x: Number, y: Number, z: Number): Function Specifies the scale of a renderable. |
|
public |
layout.scrollable(options: {}): Function Makes the view as scrollable. |
|
public |
Specifies the size of the renderable. |
|
public |
layout.skew(x: Number, y: Number, z: Number): Function Specifies the skew of a renderable. |
|
public |
layout.swipable(options: Object): Function Makes the renderable swipable with physics-like velocity after the dragging is released. |
|
public |
layout.translate(x: Number, y: Number, z: Number): Function Specifies a translation of a renderable. |
|
public |
layout.translateFrom(x: Number, y: Number, z: Number): Function Specifies a relative translation of a renderable. |
|
public |
limit(min: *, value: *, max: *): * @author: Tom Clement (tjclement) |
|
public |
provide(tokens: ...*): * |
|
public |
readAnnotations(fn: *): * |
|
public |
|
|
public |
toString(token: *): * |
|
public |
waitMilliseconds(milliseconds: *): * |
Static Public
public ExistsRequest(url: *): * source
import {ExistsRequest} from 'arva-js/utils/request/RequestClient.js'
Params:
Name | Type | Attribute | Description |
url | * |
Return:
* |
public GetRequest(url: String): Promise source
import {GetRequest} from 'arva-js/utils/request/RequestClient.js'
Prepares a GET request and initiates the communication.
Params:
Name | Type | Attribute | Description |
url | String |
Return:
Promise | Returns an asynchronous response object which can be managed to read the response in an chaining proces. |
public ParseStringToXml(text: *): * source
import {ParseStringToXml} from 'arva-js/utils/request/XmlParser.js'
@author: Hans van den Akker (mysim1)
Params:
Name | Type | Attribute | Description |
text | * |
Return:
* |
public PostRequest(options: Object): Promise source
import {PostRequest} from 'arva-js/utils/request/RequestClient.js'
Prepares a POST request and initiates the communication.
Params:
Name | Type | Attribute | Description |
options | Object | Provide properties: { headers: <Map>, data: <string>, url: <string> } |
Return:
Promise | Returns an asynchronous response object which can be managed to read the response in an chaining proces. |
public TrueSizedLayoutDockHelper(context: LayoutContext, options: Object) source
import {TrueSizedLayoutDockHelper} from 'arva-js/layout/TrueSizedLayoutDockHelper.js'
public UrlParser(url: *): * source
import {UrlParser} from 'arva-js/utils/request/UrlParser.js'
Parses a url
Params:
Name | Type | Attribute | Description |
url | * |
Return:
* |
public annotate(fn: *, annotation: *) source
import {annotate} from 'arva-js/utils/di/Decorators.js'
Params:
Name | Type | Attribute | Description |
fn | * | ||
annotation | * |
public callbackToPromise(functionWithCallback: *, args: ...*): * source
import {callbackToPromise} from 'arva-js/utils/CallbackHelpers.js'
Params:
Name | Type | Attribute | Description |
functionWithCallback | * | ||
args | ...* |
Return:
* |
public combineOptions(defaultOptions: *, options: *): * source
import {combineOptions} from 'arva-js/utils/CombineOptions.js'
Params:
Name | Type | Attribute | Description |
defaultOptions | * | ||
options | * |
Return:
* |
public createProviderFromFnOrClass(fnOrClass: *, annotations: *): * source
import {createProviderFromFnOrClass} from 'arva-js/utils/di/providers.js'
Params:
Name | Type | Attribute | Description |
fnOrClass | * | ||
annotations | * |
Return:
* |
public event._subscribe(subscriptionType: String, eventName: String, callback: Function): Function source
Internal function used by the event decorators to generalize the idea of on, once, and off.
public event.on(eventName: *, callback: *): Function source
Adds an event listener to the renderable when specific event happened.
Params:
Name | Type | Attribute | Description |
eventName | * | ||
callback | * |
Example:
@layout.on('click', function() {this._handleClick})
thing = new Surface({properties: {backgroundColor: 'red'}});
_handleClick() { ... }
public event.once(eventName: *, callback: *): Function source
Adds an event listener to the renderable when specific event happened once.
Params:
Name | Type | Attribute | Description |
eventName | * | ||
callback | * |
Example:
@layout.size(100,100)
@layout.stick.center()
@layout.once('click', function() {this._handleClick})
thing = new Surface({properties: {backgroundColor: 'red'}});
_handleClick() { ... }
public event.pipe(pipeToName: *): Function source
Pipes events from one renderable to another. The other renderable has to be declared above the one that is doing the piping, otherwise an exception will be thrown.
Params:
Name | Type | Attribute | Description |
pipeToName | * |
Example:
@layout.fullSize()
@layout.pipe('dbsv')
//Pipe events to another renderable declared above, called 'dbsv'
scrollableSurface = new Surface();
public flow.defaultOptions(flowOptions: Object): Function source
Sets the default flow options for a View. These options will be overridden by each of its renderables, if they have flow options defined through e.g. flow.stateStep()
Params:
Name | Type | Attribute | Description |
flowOptions | Object | Options to set as default. |
|
flowOptions.delay | Object |
|
The amount of milliseconds to wait in between state transitions. |
flowOptions.transition | Object |
|
A Famo.us-compatible transition object defining the animation specifics. |
flowOptions.transition.curve | Object |
|
The animation curve to use when flowing from one state to another, e.g. Easing.outCubic. |
flowOptions.transition.duration | Object |
|
The amount of milliseconds a flow animation should take. |
Example:
@flow.defaultOptions({ transition: { curve: Easing.outCubic, duration: 200 } })
class MyView extends View {
}
public flow.defaultState(stateName: String, stateOptions: Object, transformations: Array.Function): Function source
Functions the same as @flow.stateStep(), and additionally also immediately applies the decorators passed into the 'transformations' argument. Used to define a state step, without having to also manually apply the same decorators to the renderable to ensure it is rendered this way on initial show.
Params:
Name | Type | Attribute | Description |
stateName | String | The state name to assign to this state step. |
|
stateOptions | Object |
|
Flow options to use in the state step. |
stateOptions.delay | Object |
|
The amount of milliseconds to wait in between state transitions. |
stateOptions.transition | Object |
|
A Famo.us-compatible transition object defining the animation specifics. |
stateOptions.transition.curve | Object |
|
The animation curve to use when flowing from one state to another, e.g. Easing.outCubic. |
stateOptions.transition.duration | Object |
|
The amount of milliseconds a flow animation should take. |
transformations | Array.Function | Decorators to assign to this state, and to apply initially, passed in as regular comma-separated arguments. |
Example:
// Initial size is [100, 100], and rendered at center of parent.
@flow.defaultState('active', {}, layout.size(100, 100), layout.stick.center())
myRenderable = new Surface();
public flow.multipleStateStep(stateName: String, states: Array.Object): Function source
A wrapper around @flow.stateStep, to allow defining multiple steps with the same state name.
Params:
Name | Type | Attribute | Description |
stateName | String | State name to assign states to. |
|
states | Array.Object | An array of {stateOptions: [..], transformations: [..]} objects, with stateOptions and transformations being the same usage as @flow.stateStep(). |
public flow.stateStep(stateName: String, stateOptions: Object, transformations: Array.Function): Function source
Used to define a state that the renderable is able to flow to. When multiple state steps with the same state name are defined, flowing into that state will sequentially execute all defined steps with that state name.
Params:
Name | Type | Attribute | Description |
stateName | String | The state name to assign to this state step. |
|
stateOptions | Object |
|
Flow options to use in the state step. |
stateOptions.delay | Object |
|
The amount of milliseconds to wait in between state transitions. |
stateOptions.transition | Object |
|
A Famo.us-compatible transition object defining the animation specifics. |
stateOptions.transition.curve | Object |
|
The animation curve to use when flowing from one state to another, e.g. Easing.outCubic. |
stateOptions.transition.duration | Object |
|
The amount of milliseconds a flow animation should take. |
transformations | Array.Function | Decorators to assign to this state, and to apply initially, passed in as regular comma-separated arguments. |
Example:
// Initial size is [0, 0], and rendered at top left of parent, because no @flow.defaultStep() was done,
// and no other decorators are applied to the renderable.
@flow.stateStep('active', {}, layout.size(100, 100), layout.stick.center())
myRenderable = new Surface();
public flow.viewStates(states: Object): Function source
Defines the View-level states, that exist of concurrently and sequentially executed renderable-level states. When e.g. View.setViewFlowState('active') is called, the renderable states defined in the view-level state 'active' are executed.
Params:
Name | Type | Attribute | Description |
states | Object | An object keyed by View-level state names, with values of arrays of objects. |
Example:
// Calling setViewFlowState('active') will first hide the loader, and when that is completed, show both buttons at the same time.
@flow.viewStates({ 'active': [{loader: 'hidden'}, { button1: 'active', button2: 'active' }] })
class MyView extends View {
@flow.defaultState('shown', {}, layout.opacity(1), layout.fullSize())
@flow.stateStep('hidden', {}, layout.opacity(0))
loader = new Surface();
@flow.defaultState('inactive', {}, layout.opacity(0), layout.size(100, 100), layout.stick.top())
@flow.stateStep('active', {}, layout.opacity(1))
button1 = new Surface();
@flow.defaultState('inactive', {}, layout.opacity(0), layout.size(100, 100), layout.stick.bottom())
@flow.stateStep('active', {}, layout.opacity(1))
button1 = new Surface();
}
public hasAnnotation(fn: *, annotationClass: *): boolean source
import {hasAnnotation} from 'arva-js/utils/di/Decorators.js'
Params:
Name | Type | Attribute | Description |
fn | * | ||
annotationClass | * |
public inject(tokens: ...*): * source
import {inject} from 'arva-js/utils/di/Decorators.js'
Params:
Name | Type | Attribute | Description |
tokens | ...* |
Return:
* |
public isFunction(value: *): * source
import {isFunction} from 'arva-js/utils/di/util.js'
Params:
Name | Type | Attribute | Description |
value | * |
Return:
* |
public isObject(value: *): * source
import {isObject} from 'arva-js/utils/di/util.js'
Params:
Name | Type | Attribute | Description |
value | * |
Return:
* |
public isUpperCase(char: *): * source
import {isUpperCase} from 'arva-js/utils/di/util.js'
Params:
Name | Type | Attribute | Description |
char | * |
Return:
* |
public layout._dockTo(dockMethod: *, size: *, space: *, zIndex: *): Function source
Internal function to do docking
Params:
Name | Type | Attribute | Description |
dockMethod | * | ||
size | * | ||
space | * | ||
zIndex | * |
public layout.align(): Function source
Translates the renderable by a proportion of the context size.
Example:
@layout.align(0.5, 0.5)
@layout.size(100,100)
//Displays a red box just below the vertical mid point and past the horizontal mid point
renderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.animate(options: Object): Function source
Creates an animation controller to show/hide the renderable. Renderables can be shown by calling this.showRenderable(renderableName) and hidden using this.hideRenderable(renderableName) or this.showRenderable(renderableName, false). When a renderable has been shown, it will emit the event 'shown'.
Params:
Name | Type | Attribute | Description |
options | Object |
|
The same as famous-flex Animation Controller, plus 2 more: |
options.showInitially | Boolean |
|
Whether to show the renderable when the view is created. (Default: true). |
options.waitFor | String |
|
If specified, it will wait for the renderable with the specified name to show before showing the renderable |
options.transition | Object |
|
Transition options. |
options.animation | Function |
|
Animation function (default: |
options.zIndexOffset | Number |
|
Optional z-index difference between the hiding & showing renderable (default: 0). |
options.keepHiddenViewsInDOMCount | Number |
|
Keeps views in the DOM after they have been hidden (default: 0). |
options.show | Object |
|
Show specific options. |
options.show.transition | Object |
|
Show specific transition options. |
options.show.animation | Function |
|
Show specific animation function. |
options.hide | Object |
|
Hide specific options. |
options.hide.transition | Object |
|
Hide specific transition options. |
options.hide.animation | Function |
|
Hide specific animation function. |
options.transfer | Object |
|
Transfer options. |
options.transfer.transition | Object |
|
Transfer specific transition options. |
options.transfer.zIndex | Number |
|
Z-index the tranferables are moved on top while animating (default: 10). |
options.transfer.fastResize | Bool |
|
When enabled, scales the renderable i.s.o. resizing when doing the transfer animation (default: true). |
options.transfer.items | Array |
|
Ids (key/value) pairs (source-id/target-id) of the renderables that should be transferred. |
Example:
@layout.stick.center()
@layout.size(100,100)
@layout.animate({transition: {duration: 350}})
renderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.columnDockPadding(maxContentWidth: Number, defaultPadding: Array.Number): Function source
Like @layout.dockPadding, sets the padding between this view and its docked content. When the screen width plus this padding exceeds maxContentWidth, the padding is increased, so that the content is never wider than maxContentWidth.
Params:
Name | Type | Attribute | Description |
maxContentWidth | Number | Maximum width the content should be allowed to be. |
|
defaultPadding | Array.Number | A 1-D, 2-D, or 4-D array of padding numbers, just like the padding spec in CSS. |
Example:
@layout.columnDockPadding(720, [16])
//Creates a class with 16px margin on all sides for docked renderables
class myView extends View{
//Will be displayed with margin to the top and sides, and will at max be 720px wide.
@layout.dock.top(20)
onTop = new Surface({content: "hello world"});
//Will be displayed without margin since we're using @layout.stick instead of @layout.dock
@layout.stick.bottom
onButtom = new Surface({content: "hey hey"});
}
public layout.custom(customLayoutFunction: *): Function source
Adds a custom layout function to the view. This decorator works directly on the object so you shouldn't pass any arguments nor use parentheses.
Params:
Name | Type | Attribute | Description |
customLayoutFunction | * |
Example:
@layout.custom((context) => {
context.set('myRenderable', {
size: [100, 100]
})
class MyView extends View {
constructor(options) {
super(options);
this.renderables.myRenderable = new Surface({properties: {backgroundColor: 'red'}});
}
}
public layout.dock.bottom(space: Number, zIndex: Number): Function source
Docks the renderable to the bottom. When using both a docked size and the layout.size decorator, then that layout.size becomes the actual inner size. The renderable can then be stickd within the docking area with origin and align. When combined with align, treats the context size the docking size. When using layout.size without specifying a docked size, it will use that size as docking size. Useful for automatic sizing when parent defines true size and orthogonal size (e.g. height for dock 'left') has to be defined.
Params:
Name | Type | Attribute | Description |
size]. | Number | Function |
|
The size of the renderable in the one dimension that is being docked, e.g. dock left or right will be width, whereas dock top or bottom will result in height. For more information about different variations, see layout.size. |
space | Number |
|
= 0]. Any space that should be inserted before the docked renderable |
zIndex | Number |
|
= 0]. DEPRECATED: Use translate(0, 0, zIndex) instead. |
Example:
@layout.dock.bottom(30, 0, 10)
@layout.size(15, undefined)
@layout.origin(0.5, 0)
@layout.align(0.5, 0)
dockedRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dock.fill(): Function source
Fills the space that is left after the docking with this renderable. When using layout.size, it will use that size as an inner size. This works similarly to other docking, from where translate, size, origin, align, etc can be specified.
Example:
@layout.dock.fill()
filledRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dock.left(): Function source
Docks the renderable to the left. When using both a docked size and the layout.size decorator, then that layout.size becomes the actual inner size. The renderable can then be stickd within the docking area with origin and align. When combined with align, treats the context size the docking size. When using layout.size without specifying a docked size, it will use that size as docking size. Useful for automatic sizing when parent defines true size and orthogonal size (e.g. height for dock 'left') has to be defined.
Params:
Name | Type | Attribute | Description |
size]. | Number | Function |
|
The size of the renderable in the one dimension that is being docked, e.g. dock left or right will be width, whereas dock top or bottom will result in height. For more information about different variations, see layout.size. |
space]. | Number |
|
Any space that should be inserted before the docked renderable |
zIndex]. | Number |
|
DEPRECATED: Use translate(0, 0, zIndex) instead. |
Example:
@layout.dock.left(30, 0, 10)
@layout.size(15, undefined)
@layout.origin(0.5, 0)
@layout.align(0.5, 0)
dockedRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dock.none(): Function source
Marks the renderable as not being docked anymore. Useful when dynamically changing decorations through this.decorateRenderable or this.setRenderableFlowState
Example:
@layout.dock.fill()
@flow.stateStep('nonFilled', layout.dock.none(), layout.size(100, 100))
filledRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dock.right(): Function source
Docks the renderable to the right. When using both a docked size and the layout.size decorator, then that layout.size becomes the actual inner size. The renderable can then be stickd within the docking area with origin and align. When combined with align, treats the context size the docking size. When using layout.size without specifying a docked size, it will use that size as docking size. Useful for automatic sizing when parent defines true size and orthogonal size (e.g. height for dock 'left') has to be defined.
Params:
Name | Type | Attribute | Description |
size]. | Number | Function |
|
The size of the renderable in the one dimension that is being docked, e.g. dock left or right will be width, whereas dock top or bottom will result in height. For more information about different variations, see layout.size. |
space]. | Number |
|
Any space that should be inserted before the docked renderable |
zIndex]. | Number |
|
DEPRECATED: Use translate(0, 0, zIndex) instead. |
Example:
@layout.dock.right(30, 0, 10)
@layout.size(15, undefined)
@layout.origin(0.5, 0)
@layout.align(0.5, 0)
dockedRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dock.top(space: Number, zIndex: Number): Function source
Docks the renderable to the top. When using both a docked size and the layout.size decorator, then that layout.size becomes the actual inner size. The renderable can then be stickd within the docking area with origin and align. When combined with align, treats the context size the docking size. When using layout.size without specifying a docked size, it will use that size as docking size. Useful for automatic sizing when parent defines true size and orthogonal size (e.g. height for dock 'left') has to be defined.
Params:
Name | Type | Attribute | Description |
size]. | Number | Function |
|
The size of the renderable in the one dimension that is being docked, e.g. dock left or right will be width, whereas dock top or bottom will result in height. For more information about different variations, see layout.size. |
space | Number |
|
= 0]. Any space that should be inserted before the docked renderable |
zIndex | Number |
|
= 0]. DEPRECATED: Use translate(0, 0, zIndex) instead. |
Example:
@layout.dock.top(30, 0, 10)
@layout.size(15, undefined)
@layout.origin(0.5, 0)
@layout.align(0.5, 0)
dockedRenderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.dockPadding(firstMargin: Number, secondMargin: Number, thirdMargin: Number, fourthMargin: Number): Function source
Sets the margins for the docked content. This can be applied both to a child and a class. When in conflict, the parent will override the child's setting. If the margin is set on a Surface, then CSS padding will be set. margins can be 1, 2, or 4, parameters, which can be specified as shorthand in the same way as CSS does it.
Example:
@layout.dockPadding(15)
//Creates a class with 15px margin on all sides for docked renderables
class myView extends View{
//Will be displayed with margin
@layout.dock.top(20)
onTop = new Surface({content: "hello world"});
//Will be displayed without margin since we're using @layout.stick
@layout.stick.bottom
onButtom = new Surface({content: "hey hey"});
}
public layout.dockSpace(space: Number): Function source
Specifies the space that should come before the docked renderable. Useful when not specifying the size in the layout.dock function. Note that the space does not appear if there isn't any renderable with a size greater than zero before it.
Params:
Name | Type | Attribute | Description |
space | Number | The space that is inserted before the renderable. |
Example:
// there's a 20px space before this box
@layout.dockSpace(20)
@layout.size(100, 100)
@layout.dock.left()
box = new Surface({properties: {backgroundColor: 'red'}});
public layout.draggable(): Function source
Makes the renderable allowed to be dragged around. this.renderables[name] refers to a RenderNode containing this draggable along with the renderable itself.
Params:
Name | Type | Attribute | Description |
draggableOptions]. | Object |
|
Same options that can be passed to a Famous Draggable. |
options.snapX | Number |
|
grid width for snapping during drag |
options.snapY | Number |
|
grid height for snapping during drag |
options.xRange | Array.Number |
|
maxmimum [negative, positive] x displacement from start of drag |
options.yRange | Array.Number |
|
maxmimum [negative, positive] y displacement from start of drag |
options.scale | Number |
|
one pixel of input motion translates to this many pixels of output drag motion |
options.projection | Number |
|
User should set to Draggable._direction.x or Draggable._direction.y to constrain to one axis. |
Example:
@layout.draggable({xRange: [0, 100}, yRange: [0, 200]})
@layout.size(100, 100)
// Makes a draggable square that is red
draggableRenderable = new Surface({properties: {backgroundColor: 'red'});
public layout.flow(Options: Object): Function source
Makes the view flow by tweening all intermediate stages of a changed attribute of any renderable.
Params:
Name | Type | Attribute | Description |
Options | Object | to pass as flowOptions to the LayoutController |
|
flowOptions.transition | Bool |
|
If specified, sets the default transition to use |
flowOptions.reflowOnResize | Bool |
|
Smoothly reflows renderables on resize (only used when flow = true) (default: |
flowOptions.spring | Object |
|
Spring options used by nodes when reflowing (default: |
flowOptions.properties | Object |
|
Properties which should be enabled or disabled for flowing. |
flowOptions.insertSpec | Spec |
|
Size, transform, opacity... to use when inserting new renderables into the scene (default: |
flowOptions.removeSpec | Spec |
|
Size, transform, opacity... to use when removing renderables from the scene (default: undefined). |
Example:
@layout.flow({spring: {dampingRatio: 0.8, period: 1000}})
class myView extends View{
...
}
public layout.fullSize(): Function source
Marks the renderable to cover the entire screen. Translate can also be specified on such a renderable.
Example:
@layout.fullSize()
// View will have a red background
background = new Surface({properties: {backgroundColor: 'red'}});
public layout.nativeScrollable(options: Object): Function source
Experimental feature of scrolling natively.
public layout.opacity(opacity: Number): Function source
Sets the opacity of a renderable.
Params:
Name | Type | Attribute | Description |
opacity | Number | The opacity, between 0 and 1 |
Example:
@layout.opacity(0.5)
@layout.size(100, 10)
@layout.place.center()
// Writes text that is half invisible
renderable = new Surface({content: 'Half invisible'});
public layout.origin(): Function source
Sets the point where the renderable has its anchor from where rotation and translation will be done. You could consider it as translating the negative of the proportion times its size. The arguments are always between and including 0 and 1.
Example:
@layout.origin(0.5, 0)
@layout.align(0.5, 0.5)
@layout.size(100,100)
//Displays a red box horizontically centered and displays just below the vertical mid point
renderable = new Surface({properties: {backgroundColor: 'red'}});
public layout.renderable(): Function source
Merely marks a view property as a decorated renderable, which allows it to be rendered. Use this in combination with a @layout.custom decorator on the view in which this renderable resides.
Example:
@layout.renderable
renderable = new Surface();
public layout.rotate(x: Number, y: Number, z: Number): Function source
Rotates the renderable around any of the three axes (in radians).
Example:
@layout.size(100,100)
@layout.rotate(0, 0, Math.PI)
// Writes text upside down
renderable = new Surface({content: 'upside down text'});
public layout.rotateFrom(x: Number, y: Number, z: Number): Function source
Rotates the renderable around any of the three axes (in radians) relatively to the current rotation
Example:
@layout.size(100,100)
@layout.rotate(0, 0, Math.PI)
// Writes text upside down
renderable = new Surface({content: 'upside down text'});
public layout.scale(x: Number, y: Number, z: Number): Function source
Specifies the scale of a renderable. Can be applied to every kind of renderable.
Example:
class myView extends View{
@layout.scale(2, 2, 2)
@layout.fullscreen
// Will scale the renderable by 2 in the x,y,z dimension
myBackground = new Surface({properties: {backgroudColor: 'red'}});
}
public layout.scrollable(options: {}): Function source
Makes the view as scrollable. This will put the entire content in a ReflowingScrollView that uses getSize on the view to determine scrolling size. If the size cannot be determined, you might consider declaring your own getSize() on the View.
Params:
Name | Type | Attribute | Description |
options | {} |
|
Example:
@layout.scrollable()
class myView extends View{
...
}
public layout.size(x: Number | Function, y: Number | Function): Function source
Specifies the size of the renderable. For both of the parameters, sizes can be interpreted as follows:
If specified as a function, then the argument passed is the context size of the specified dimension (width or height). Note that if an arrow function is used, this scoping cannot be used when inside a decorator, since the scope will be the global scope.
If true is specified or a tilde with a size (e.g. ~300), then the renderable will be automatically sized. If a tilde is used to indicate the size, then the size after the tilde will be used when/if the renderable doesn't have a size, or turn into the actual size if it can be determined. This is useful when wanting to reduce the flickering of surfaces who's size cannot be determined the first render tick. Beware that true sizing of surfaces or other raw dom elements (input surfaces, image surfaces, text boxes etc) often comes with a perfomance penalty and should only be used when necessary. Also beware that any negative size will be interpreted as a tilde, since ~x = 1 - x
If undefined is specified, then the size of that dimension will equal the entire context size.
If a size between 0 and 1 is specified, then that will be interpreted as a proportion of the context size. For example if 0.5 is specified, then the size will be half of the context size (the parent's size). Instead of specifying 1 to cover the entire context size, use undefined instead.
Example:
@layout.size(function(contextWidth) {return Math.max(contextWidth, this.options.maxWidth)}, ~300)
// Creates a renderable where the width is equal to the text width and the height is whatever is bigger,
// options.maxWidth, or the context size
text = new Surface({content: 'This is some text', properties: {backgroundColor: 'red'}});
public layout.skew(x: Number, y: Number, z: Number): Function source
Specifies the skew of a renderable. Can be applied to every kind of renderable.
Example:
class myView extends View{
@layout.skew(2, 2, 2)
@layout.fullscreen
// Will skew the renderable by 2 in the x,y,z dimension
myBackground = new Surface({properties: {backgroudColor: 'red'}});
}
public layout.swipable(options: Object): Function source
Makes the renderable swipable with physics-like velocity after the dragging is released. Emits event 'thresholdReached' with arguments ('x'|'y', 0|1) when any thresholds have been reached. this.renderables[name] now refers to a a RenderNode containing a positionModifier along with the renderable itself.
Params:
Name | Type | Attribute | Description |
options | Object | ||
options.snapX | Boolean |
|
Whether to snap to the x axis |
options.snapY | Boolean |
|
Whether to snap to the Y axis |
options.enabled | Boolean |
|
Whether the swipable should be initially enabled |
options.xThreshold | Array.Number |
|
Two values of the thresholds that trigger the thresholdReached event with argument 'x' and second argument 0 or 1, depending on the direction. Specify undefined in one of them to disable threshold to that direction. |
options.yThreshold | Array.Number |
|
Two values of the thresholds that trigger the thresholdReached event with argument 'y' and second argument 0 or 1, depending on the direction. Specify undefined in one of them to disable threshold to that direction. |
Example:
@layout.size(100, 100)
@layout.swipable({xRange: [0, 100], snapX: true})
//Make a red box that can slide to the right
swipable = new Surface({properties: {backgroundColor: 'red'});
public layout.translate(x: Number, y: Number, z: Number): Function source
Specifies a translation of a renderable. Can be applied to every kind of renderable (docked, fullSize, and normal). Can also be applied on view level to translate every renderable of that view. The view wide translation defaults to [0, 0, 10] in order to always increase the z space of every level of the Famous rendering tree.
Example:
@layout.translate(0, 0, 20)
class myView extends View{
@layout.translate(0, 0, -20)
@layout.fullSize()
// Will display relatively at z level 0 (20 minus 20)
myBackground = new Surface({properties: {backgroudColor: 'red'}});
}
public layout.translateFrom(x: Number, y: Number, z: Number): Function source
Specifies a relative translation of a renderable. Can be applied to every kind of renderable (docked, fullSize, and normal). Can also be applied on view level to translate every renderable of that view. The view wide translation defaults to [0, 0, 10] in order to always increase the z space of every level of the Famous rendering tree.
Example:
@layout.translateFrom(0, 0, 20)
class myView extends View{
@layout.translateFrom(0, 0, -20)
@layout.fullSize()
// Will display relatively at z level 0 (20 minus 20)
myBackground = new Surface({properties: {backgroudColor: 'red'}});
}
public limit(min: *, value: *, max: *): * source
import {limit} from 'arva-js/utils/Limiter.js'
@author: Tom Clement (tjclement)
Params:
Name | Type | Attribute | Description |
min | * | ||
value | * | ||
max | * |
Return:
* |
public provide(tokens: ...*): * source
import {provide} from 'arva-js/utils/di/Decorators.js'
Params:
Name | Type | Attribute | Description |
tokens | ...* |
Return:
* |
public readAnnotations(fn: *): * source
import {readAnnotations} from 'arva-js/utils/di/Decorators.js'
Params:
Name | Type | Attribute | Description |
fn | * |
Return:
* |
public successAndErrorToPromise(): * source
import {successAndErrorToPromise} from 'arva-js/utils/CallbackHelpers.js'
Return:
* |
public toString(token: *): * source
import {toString} from 'arva-js/utils/di/util.js'
Params:
Name | Type | Attribute | Description |
token | * |
Return:
* |
public waitMilliseconds(milliseconds: *): * source
import {waitMilliseconds} from 'arva-js/utils/CallbackHelpers.js'
Params:
Name | Type | Attribute | Description |
milliseconds | * |
Return:
* |