File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed
Sources/SwiftCrossUI/Scenes Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -120,21 +120,27 @@ public final class WindowGroupNode<Content: View>: SceneGraphNode {
120120 scene = newScene
121121 }
122122
123- let environment =
124- backend. computeWindowEnvironment ( window: window, rootEnvironment: environment)
125- . with ( \. onResize) { [ weak self] _ in
126- guard let self = self else { return }
127- // TODO: Figure out whether this would still work if we didn't recompute the
128- // scene's body. I have a vague feeling that it wouldn't work in all cases?
129- // But I don't have the time to come up with a counterexample right now.
130- _ = self . update (
131- self . scene,
132- proposedWindowSize: backend. size ( ofWindow: window) ,
133- backend: backend,
134- environment: environment
135- )
136- }
137- . with ( \. window, window)
123+ var newEnvironment = backend. computeWindowEnvironment (
124+ window: window,
125+ rootEnvironment: environment
126+ )
127+
128+ // Assign onResize manually
129+ newEnvironment. onResize = { [ weak self] _ in
130+ guard let self = self else { return }
131+ _ = self . update (
132+ self . scene,
133+ proposedWindowSize: backend. size ( ofWindow: window) ,
134+ backend: backend,
135+ environment: newEnvironment
136+ )
137+ }
138+
139+ // Assign window manually
140+ newEnvironment. window = window
141+
142+ let environment = newEnvironment
143+
138144
139145 let dryRunResult : ViewUpdateResult ?
140146 if !windowSizeIsFinal {
You can’t perform that action at this time.
0 commit comments