Obj
Base object.
- have unique id
- have parent and children
- can be serialized (store and copy-paste)
- can be traversed
Extended by
Constructors
new Obj()
new Obj():
Obj
Returns
Source
Properties
children
children:
Obj
[]
Source
id
id:
string
Source
parent
parent:
null
|Obj
Source
type
type:
string
Source
Methods
find()
find(
pred
):null
|Obj
Find an shape in breath-first order
Parameters
• pred
Returns
null
| Obj
Source
findDepthFirst()
findDepthFirst(
pred
):null
|Obj
Find an shape in depth-first order
Parameters
• pred
Returns
null
| Obj
Source
findParent()
findParent(
pred
):null
|Obj
Find a shape along with the parent-chain
Parameters
• pred
Returns
null
| Obj
Source
fromJSON()
fromJSON(
json
):void
Parameters
• json: any
Returns
void
Source
isDescendant()
isDescendant(
obj
):boolean
Test whether the given shape is a descendant
Parameters
• obj: Obj
Returns
boolean
Source
resolveRefs()
resolveRefs(
idMap
,nullIfNotFound
):void
Resolve references
Parameters
• idMap: Record
<string
, Obj
>
id to object map
• nullIfNotFound: boolean
= false
assign null if not found
Returns
void
Source
toJSON()
toJSON(
recursive
,keepRefs
):any
Parameters
• recursive: boolean
= false
• keepRefs: boolean
= false
Returns
any
Source
traverse()
traverse(
fun
,parent
):void
Traverse all objects in breath-first order
Parameters
• fun
• parent: null
| Obj
= null
Returns
void
Source
traverseDepthFirst()
traverseDepthFirst(
fun
,parent
):void
Traverse all shapes in depth-first order
Parameters
• fun
• parent: null
| Obj
= null
Returns
void
Source
traverseDepthFirstSequence()
traverseDepthFirstSequence():
Obj
[]
Returns an array of shapes in order of traverse sequence.
Returns
Obj
[]
Source
traverseSequence()
traverseSequence():
Obj
[]
Returns an array of shapes in order of traverse sequence.
Returns
Obj
[]