Tweak window setup order so viewsd have access to screen in View.wasAdded

This commit is contained in:
Shadowfacts 2019-10-21 11:38:01 -04:00
parent da8c5f73cf
commit 8a3be763f1
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 5 additions and 0 deletions

View File

@ -37,8 +37,11 @@ open class CacaoScreen: Screen(LiteralText("CacaoScreen")) {
*/ */
fun <T: Window> addWindow(window: T, index: Int = _windows.size): T { fun <T: Window> addWindow(window: T, index: Int = _windows.size): T {
_windows.add(index, window) _windows.add(index, window)
window.screen = this window.screen = this
window.wasAdded()
window.resize(width, height) window.resize(width, height)
return window return window
} }

View File

@ -79,7 +79,9 @@ class Window(
init { init {
createInternalConstraints() createInternalConstraints()
}
fun wasAdded() {
viewController.window = this viewController.window = this
viewController.loadView() viewController.loadView()