@@ -61,9 +61,10 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
61
61
let scrollBarWidth = backend. scrollBarWidth
62
62
63
63
let hasHorizontalScrollBar =
64
- axes. contains ( . horizontal) && contentSize. idealSize . x > proposedSize. x
64
+ axes. contains ( . horizontal) && contentSize. idealWidthForProposedHeight > proposedSize. x
65
65
let hasVerticalScrollBar =
66
- axes. contains ( . vertical) && contentSize. idealSize. y > proposedSize. y
66
+ axes. contains ( . vertical) && contentSize. idealHeightForProposedWidth > proposedSize. y
67
+ print ( contentSize. idealHeightForProposedWidth)
67
68
68
69
let verticalScrollBarWidth = hasVerticalScrollBar ? scrollBarWidth : 0
69
70
let horizontalScrollBarHeight = hasHorizontalScrollBar ? scrollBarWidth : 0
@@ -94,12 +95,17 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
94
95
95
96
let finalResult : ViewUpdateResult
96
97
if !dryRun {
98
+ // TODO: scroll bar presence shouldn't affect whether we use current
99
+ // or ideal size. Only the presence of the given axis in the user's
100
+ // list of scroll axes should affect that.
97
101
let proposedContentSize = SIMD2 (
98
102
hasHorizontalScrollBar
99
- ? contentSize. idealSize. x
103
+ ? ( hasVerticalScrollBar
104
+ ? contentSize. idealSize. x : contentSize. idealWidthForProposedHeight)
100
105
: min ( contentSize. size. x, proposedSize. x - verticalScrollBarWidth) ,
101
106
hasVerticalScrollBar
102
- ? contentSize. idealSize. y
107
+ ? ( hasHorizontalScrollBar
108
+ ? contentSize. idealSize. y : contentSize. idealHeightForProposedWidth)
103
109
: min ( contentSize. size. y, proposedSize. y - horizontalScrollBarHeight)
104
110
)
105
111
@@ -136,6 +142,8 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
136
142
finalResult = childResult
137
143
}
138
144
145
+ print ( finalResult. size)
146
+
139
147
return ViewUpdateResult (
140
148
size: ViewSize (
141
149
size: scrollViewSize,
0 commit comments