From 694a728ec4d25f06528c30ac50f69b43644496e8 Mon Sep 17 00:00:00 2001 From: Terry Truong Date: Sat, 12 Mar 2022 20:37:01 +1100 Subject: Add LayoutFn type. Refactor some layout functions. --- src/types.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/types.ts') 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; -- cgit v1.2.3