Reference · Where every tie sits
LayoutBoxtype
A tie's place in the tree.
Import it
import type { LayoutBox } from "@johnmorrisdotca/taisen-brackets/layout";
Also exported from: @johnmorrisdotca/taisen-brackets
Definition
interface LayoutBox {
i: number;
round: number;
y: number;
to: number | null;
fed: boolean;
order: readonly [
0 | 1,
0 | 1
];
bye: 0 | 1 | null;
byes: readonly (0 | 1)[];
}
Members
| Name | Type | Description |
|---|---|---|
i | number | The tie's index. |
round | number | |
y | number | The row, 0 at the top; fractional where a tie sits between two. |
to | number | null | The row of the tie this one feeds, or |
fed | boolean | Whether a tie feeds this one. |
order | readonly [0 | 1, 0 | 1] | Which side is drawn on top, then which below: |
bye | 0 | 1 | null | The side that had a bye (it came from no tie, though the other did), or |
byes | readonly (0 | 1)[] | Every side that skipped the earlier rounds: the |
Examples
import { layoutBracket, type LayoutBox } from "@johnmorrisdotca/taisen-brackets";
const layout = layoutBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }]);
const box: LayoutBox = layout.sides[0].boxes[0];
console.log(box.round, box.y, box.to);1 0 0What it prints (run when this page was built)