I fail to make the scroll view able to reach the bottom of its view.
The canvas is made of drawings where the user can touch through captured coordinates. Touching the bottom of the view is impossible due to the fact that the scroll view immediately scrolls up to the initial height of 657.
I've tried to capture the vStackGeometryReader.size.height with a PreferenceKey struct, but it failed to set the height of the main view.
var body: some View {
VStack {
Text("…")
GeometryReader { mainGeometryReader in
ScrollView(.horizontal, showsIndicators: true) {
ScrollViewReader { horizontalScrollViewReader in
GeometryReader { vStackGeometryReader in
VStack {
Canvas { headerCanvasContext, headerCanvasSize in
}
.frame(width: vStackGeometryReader.size.width, height: CanvasConstant.value)
ScrollView {
Canvas { bodyCanvasContext, bodyCanvasSize in
}
.frame(width:height) // based on vStackGeometryReader.size
}
}
.frame(width:height) // based on mainGeometryReader.size
}
}
}
}
}