diff options
| author | Terry Truong <terry06890@gmail.com> | 2022-03-23 10:05:23 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2022-03-23 10:05:23 +1100 |
| commit | c6b787974e52035b64b1fb40163c1fedf67c8376 (patch) | |
| tree | d19546ea69839940b976ec1a70fbd4685d3d99d3 /src/lib.ts | |
| parent | 4cfffc056d34323ca49038591ed50dbdcfc71a3e (diff) | |
Move root-tile boundary-offset handling to TileTree
Diffstat (limited to 'src/lib.ts')
| -rw-r--r-- | src/lib.ts | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -93,8 +93,8 @@ export class LayoutNode { // Assigns render-relevant data to this single node assignLayoutData(pos=[0,0] as [number,number], dims=[0,0] as [number,number], {showHeader=false, sepSweptArea=null as SepSweptArea|null, empSpc=0} = {}){ - this.pos = pos; - this.dims = dims; + this.pos = [...pos]; + this.dims = [...dims]; this.showHeader = showHeader; this.sepSweptArea = sepSweptArea; this.empSpc = empSpc; @@ -183,8 +183,8 @@ export function tryLayout(layoutTree: LayoutNode, pos: [number,number], dims: [n } if (success){ // Center in layout area - tempTree.pos[0] = (dims[0] - tempTree.dims[0]) / 2; - tempTree.pos[1] = (dims[1] - tempTree.dims[1]) / 2; + tempTree.pos[0] += (dims[0] - tempTree.dims[0]) / 2; + tempTree.pos[1] += (dims[1] - tempTree.dims[1]) / 2; // Apply to active LayoutNode tree tempTree.copyTreeForRender(layoutTree); } |
