Skip to content

Commit 5224aad

Browse files
committed
Fixed tab views not working when content views have views added before the tab view is added to a superview
1 parent 6ca8b1f commit 5224aad

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"./CCKit2/*": "./src/CCKit2/*.ts"
77
},
88
"scripts": {
9-
"test": "echo \"Error: no test specified\" && exit 1"
9+
"build": "tstl",
10+
"doc": "typedoc"
1011
},
1112
"repository": {
1213
"type": "git",
1314
"url": "git+https://github.com/Phoenix-ComputerCraft/CCKit2.git"
1415
},
1516
"author": "JackMacWindows",
16-
"license": "SEE LICENSE IN LICENSE",
17+
"license": "GPL-2.0-only",
1718
"bugs": {
1819
"url": "https://github.com/Phoenix-ComputerCraft/CCKit2/issues"
1920
},

src/CCKit2/CCTabView.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ export default class CCTabView extends CCView {
8888
this.setNeedsDisplay();
8989
}
9090

91+
public didMoveToSuperview(): void {
92+
super.didMoveToSuperview();
93+
for (let view of this.contentViews) {
94+
if (view.window !== this.window) {
95+
view.window = this.window;
96+
view.didMoveToSuperview();
97+
}
98+
}
99+
}
100+
91101
public draw(rect: CCRect): void {
92102
super.draw(rect);
93103
let ctx = CCGraphicsContext.current!;

0 commit comments

Comments
 (0)