φ Famo.us University Famo.us/Angular Docs Help Blog Download
  • core
  • Context
  • ElementAllocator
  • ElementOutput
  • Engine
  • Entity
  • EventEmitter
  • EventHandler
  • Group
  • Modifier
  • OptionsManager
  • RenderNode
  • Scene
  • SpecParser
  • Surface
  • Transform
  • View
  • ViewSequence
  • events
  • EventArbiter
  • EventFilter
  • EventMapper
  • inputs
  • Accumulator
  • GenericSync
  • MouseSync
  • PinchSync
  • RotateSync
  • ScaleSync
  • ScrollSync
  • TouchSync
  • TouchTracker
  • TwoFingerSync
  • math
  • Matrix
  • Quaternion
  • Random
  • Utilities
  • Vector
  • modifiers
  • Draggable
  • Fader
  • ModifierChain
  • StateModifier
  • physics
  • PhysicsEngine
  • physics/bodies
  • Body
  • Circle
  • Particle
  • Rectangle
  • physics/constraints
  • Collision
  • Constraint
  • Curve
  • Distance
  • Snap
  • Surface
  • Wall
  • Walls
  • physics/forces
  • Drag
  • Force
  • Repulsion
  • RotationalDrag
  • RotationalSpring
  • Spring
  • VectorField
  • physics/integrators
  • SymplecticEuler
  • surfaces
  • CanvasSurface
  • ContainerSurface
  • ImageSurface
  • InputSurface
  • TextareaSurface
  • VideoSurface
  • transitions
  • CachedMap
  • Easing
  • MultipleTransition
  • SnapTransition
  • SpringTransition
  • Transitionable
  • TransitionableTransform
  • TweenTransition
  • WallTransition
  • utilities
  • KeyCodes
  • Timer
  • Utility
  • views
  • ContextualView
  • Deck
  • DrawerLayout
  • EdgeSwapper
  • FlexibleLayout
  • Flipper
  • GridLayout
  • HeaderFooterLayout
  • Lightbox
  • RenderController
  • ScrollContainer
  • Scroller
  • Scrollview
  • SequentialLayout
  • widgets
  • NavigationBar
  • TabBar

Surface

A base class for viewable content and event targets inside a Famo.us application, containing a renderable document fragment. Like an HTML div, it can accept internal markup, properties, classes, and handle events.

Overview

Options
size] [width, height
classes
properties
attributes
content
Methods
setAttributes
getAttributes
setProperties
getProperties
addClass
removeClass
toggleClass
setClasses
getClasslist
setContent
getContent
setOptions
getSize
setSize

Surface(options)

Constructor Parameters

options

Object

default option overrides

size] [width, height
Array.Number
in pixels
classes
Array.string
CSS classes to set on target div
properties
Array
string dictionary of CSS properties to set on target div
attributes
Array
string dictionary of HTML attributes to set on target div
content
String
inner (HTML) content of surface
Methods

setAttributes(attributes)

Set HTML attributes on this Surface. Note that this will cause dirtying and thus re-rendering, even if values do not change.

Parameters
attributes
Object
property dictionary of "key" => "value"

getAttributes()

Get HTML attributes on this Surface.

Returns
Object
Dictionary of this Surface's attributes.

setProperties(properties)

Set CSS-style properties on this Surface. Note that this will cause dirtying and thus re-rendering, even if values do not change.

Parameters
properties
Object
property dictionary of "key" => "value"

getProperties()

Get CSS-style properties on this Surface.

Returns
Object
Dictionary of this Surface's properties.

addClass(className)

Add CSS-style class to the list of classes on this Surface. Note this will map directly to the HTML property of the actual corresponding rendered <div>.

Parameters
className
String
name of class to add

removeClass(className)

Remove CSS-style class from the list of classes on this Surface. Note this will map directly to the HTML property of the actual corresponding rendered <div>.

Parameters
className
String
name of class to remove

toggleClass(className)

Toggle CSS-style class from the list of classes on this Surface. Note this will map directly to the HTML property of the actual corresponding rendered <div>.

Parameters
className
String
name of class to toggle

setClasses(classList)

Reset class list to provided dictionary.

Parameters
classList
Array.string

getClasslist()

Get array of CSS-style classes attached to this div.

Returns
Array.string
array of class names

setContent(content)

Set or overwrite inner (HTML) content of this surface. Note that this causes a re-rendering if the content has changed.

Parameters
content
String|Document Fragment
HTML content

getContent()

Return inner (HTML) content of this surface.

Returns
String
inner (HTML) content

setOptions(options)

Set options for this surface

Parameters
options
Object
overrides for default options. See constructor.

setup(allocator)Private

One-time setup for an element to be ready for commits to document.

Parameters
allocator
ElementAllocator
document element pool for this context

commit(context)Private

Apply changes from this component to the corresponding document element. This includes changes to classes, styles, size, content, opacity, origin, and matrix transforms.

Parameters
context
Context
commit context

cleanup(allocator)Private

Remove all Famous-relevant attributes from a document element. This is called by SurfaceManager's detach(). This is in some sense the reverse of .deploy().

Parameters
allocator
ElementAllocator

deploy(target)Private

Place the document element that this component manages into the document.

Parameters
target
Node
document parent of this container

recall()Private

Remove any contained document content associated with this surface from the actual document.

getSize()

Get the x and y dimensions of the surface.

Returns
Array.Number
[x,y] size of surface

setSize(size)

Set x and y dimensions of the surface.

Parameters
size
Array.Number
as [width, height]
Branding Terms Privacy Jobs © Famous Industries, Inc. 2015