@@ -7,10 +7,20 @@ export default class Grid extends IRenderableWithChildren {
7
7
super ( "Grid" ) ;
8
8
}
9
9
10
- columns = 3 ;
11
- rows = 3 ;
12
- gapX = 2 ;
10
+ columns = this . sizes . UNSET ;
11
+ rows = this . sizes . UNSET ;
12
+ gapX = 1 ;
13
13
gapY = 1 ;
14
+ gapRatio = [ 1 , 1 ] ;
15
+
16
+ getSizingType ( ) {
17
+ if ( this . columns === this . sizes . UNSET ) {
18
+ }
19
+ if ( this . rows === this . sizes . UNSET ) {
20
+ }
21
+
22
+ }
23
+
14
24
15
25
render ( ) {
16
26
let { width, height } = this . getSize ( ) ;
@@ -23,36 +33,39 @@ export default class Grid extends IRenderableWithChildren {
23
33
*/
24
34
25
35
let cBuffers = this . renderChildren ( ) ;
26
- let cSizes = this . getChildrenSizes ( ) ;
27
36
37
+ /*
38
+ let cBuffers = this.renderChildren();
39
+ let cSizes = this.getChildrenSizes();
40
+
28
41
let cellWidth = Math.floor((width - (this.columns - 1) * this.gapX) / this.columns);
29
42
let cellHeight = Math.floor((height - (this.rows - 1) * this.gapY) / this.rows);
30
-
43
+
31
44
for (let row = 0; row < this.rows; row++) {
32
45
for (let rowHeight = 0; rowHeight < cellHeight; rowHeight++) {
33
46
let tempBuffer = [];
34
47
for (let col = 0; col < this.columns; col++) {
35
48
let tempStringBuffer = "";
36
-
49
+
37
50
let _cellWidth = cellWidth;
38
-
51
+
39
52
if (col === this.columns - 1) {
40
53
// this is last, check and make sure the column widths + gaps are equal to the width of the grid
41
54
let totalWidth = cellWidth * this.columns + this.gapX * (this.columns - 1);
42
55
let remainingWidth = width - totalWidth;
43
56
_cellWidth += remainingWidth;
44
57
}
45
-
58
+
46
59
//tempStringBuffer += s("", _cellWidth, "A");
47
60
repeat(_cellWidth, () => {
48
61
tempStringBuffer += chalk.bgYellow("A");
49
62
});
50
-
51
-
63
+
64
+
52
65
if (col !== this.columns - 1) {
53
66
tempStringBuffer += " ".repeat(this.gapX);
54
67
}
55
-
68
+
56
69
tempBuffer.push(tempStringBuffer);
57
70
}
58
71
this.fillOnce(tempBuffer.join(""));
@@ -62,7 +75,7 @@ export default class Grid extends IRenderableWithChildren {
62
75
this.fillOnce(" ");
63
76
}
64
77
}
65
- }
78
+ }*/
66
79
67
80
//this.fillOnce(largestLength.toString());
68
81
//this.fillOnce(widths.join(","));
0 commit comments