diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-12 20:37:01 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-13 18:32:01 +1100 |
| commit | 694a728ec4d25f06528c30ac50f69b43644496e8 (patch) | |
| tree | 3673c6b92307d45a9d92ab9d924b5c3082da866a /src/types.ts | |
| parent | 8f2b6dff0179eb42831dad42e5a68d1c328df7ff (diff) | |
Add LayoutFn type. Refactor some layout functions.
Diffstat (limited to 'src/types.ts')
| -rw-r--r-- | src/types.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/types.ts b/src/types.ts index 8a42ca0..82a8bb9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,7 +1,7 @@ export class TolNode { name: string; children: TolNode[]; - constructor(name: string, children: TolNode[]){ + constructor(name: string, children: TolNode[] = []){ this.name = name; this.children = children; } @@ -16,7 +16,7 @@ export class TreeNode { headerSz: number; sideArea: SideArea | null; tileCount: number; - constructor(tolNode: TolNode, children: TreeNode[], x=0, y=0, w=0, h=0, + constructor(tolNode: TolNode, children: TreeNode[], x=0, y=0, w=0, h=0, {headerSz=0, sideArea=null, tileCount=1} = {}){ this.tolNode = tolNode; this.children = children; @@ -41,7 +41,7 @@ export class LayoutNode { contentH: number; empSpc: number; sideArea: SideArea | null; - constructor(name: string, children: LayoutNode[], x=0, y=0, w=0, h=0, + constructor(name: string, children: LayoutNode[], x=0, y=0, w=0, h=0, {headerSz=0, contentW=0, contentH=0, empSpc=0, sideArea=null as SideArea|null} = {}){ this.name = name; this.x = x; |
