tapspace
Version:
A zoomable user interface lib for web apps
33 lines (28 loc) • 739 B
JavaScript
module.exports = function (component, position) {
// @Plane:addChild(component, position)
// @Plane:appendChild
//
// Place a component onto this plane. Same as Component:addChild but
// ensures that the component is not added off the plane, onto different z.
// Spaces can be added onto the plane although they and their contents are
// displayed flat.
//
// Parameters:
// component
// a Component
// position
// optional Point
//
// Return
// this, for chaining
//
// Insert to DOM
this.element.appendChild(component.element)
if (position) {
if (position.transitRaw) {
position = position.transitRaw(this)
}
component.translateTo(position)
}
return this
}