@@ -61,9 +61,10 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
6161 let scrollBarWidth = backend. scrollBarWidth
6262
6363 let hasHorizontalScrollBar =
64- axes. contains ( . horizontal) && contentSize. idealSize . x > proposedSize. x
64+ axes. contains ( . horizontal) && contentSize. idealWidthForProposedHeight > proposedSize. x
6565 let hasVerticalScrollBar =
66- axes. contains ( . vertical) && contentSize. idealSize. y > proposedSize. y
66+ axes. contains ( . vertical) && contentSize. idealHeightForProposedWidth > proposedSize. y
67+ print ( contentSize. idealHeightForProposedWidth)
6768
6869 let verticalScrollBarWidth = hasVerticalScrollBar ? scrollBarWidth : 0
6970 let horizontalScrollBarHeight = hasHorizontalScrollBar ? scrollBarWidth : 0
@@ -94,12 +95,17 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
9495
9596 let finalResult : ViewUpdateResult
9697 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.
97101 let proposedContentSize = SIMD2 (
98102 hasHorizontalScrollBar
99- ? contentSize. idealSize. x
103+ ? ( hasVerticalScrollBar
104+ ? contentSize. idealSize. x : contentSize. idealWidthForProposedHeight)
100105 : min ( contentSize. size. x, proposedSize. x - verticalScrollBarWidth) ,
101106 hasVerticalScrollBar
102- ? contentSize. idealSize. y
107+ ? ( hasHorizontalScrollBar
108+ ? contentSize. idealSize. y : contentSize. idealHeightForProposedWidth)
103109 : min ( contentSize. size. y, proposedSize. y - horizontalScrollBarHeight)
104110 )
105111
@@ -136,6 +142,8 @@ public struct ScrollView<Content: View>: TypeSafeView, View {
136142 finalResult = childResult
137143 }
138144
145+ print ( finalResult. size)
146+
139147 return ViewUpdateResult (
140148 size: ViewSize (
141149 size: scrollViewSize,
0 commit comments