@@ -26,6 +26,7 @@ struct PadLayoutEditView: View {
2626 let safeAreaTop = geo. safeAreaInsets. top
2727 let safeAreaBottom = geo. safeAreaInsets. bottom
2828 let isMismatch = isActuallyLandscape != editLandscape
29+ let chromeAlignment : Alignment = isActuallyLandscape ? . top : . bottom
2930 ZStack {
3031 // Canvas
3132 if isActuallyLandscape {
@@ -40,20 +41,13 @@ struct PadLayoutEditView: View {
4041 . zIndex ( 1 )
4142 . allowsHitTesting ( false )
4243 }
43-
44- // Chrome overlay
45- VStack ( spacing: 0 ) {
46- if isActuallyLandscape {
47- editorToolbar ( isLandscape: true )
48- Spacer ( )
49- } else {
50- Spacer ( )
51- editorToolbar ( isLandscape: false )
52- }
53- }
54- . padding ( . top, isActuallyLandscape ? max ( safeAreaTop, 4 ) : 0 )
55- . padding ( . bottom, isActuallyLandscape ? 0 : max ( safeAreaBottom, 8 ) )
56- . zIndex ( 2 )
44+ }
45+ . overlay ( alignment: chromeAlignment) {
46+ editorChrome (
47+ isLandscape: isActuallyLandscape,
48+ safeAreaTop: safeAreaTop,
49+ safeAreaBottom: safeAreaBottom
50+ )
5751 }
5852 }
5953 . navigationBarHidden ( true )
@@ -115,6 +109,12 @@ struct PadLayoutEditView: View {
115109 }
116110
117111 // MARK: - Editor toolbar
112+ private func editorChrome( isLandscape: Bool , safeAreaTop: CGFloat , safeAreaBottom: CGFloat ) -> some View {
113+ editorToolbar ( isLandscape: isLandscape)
114+ . padding ( . top, isLandscape ? max ( safeAreaTop, 8 ) : 0 )
115+ . padding ( . bottom, isLandscape ? 0 : max ( safeAreaBottom, 8 ) )
116+ }
117+
118118 private func editorToolbar( isLandscape: Bool ) -> some View {
119119 HStack ( spacing: isLandscape ? 8 : 12 ) {
120120 // Cancel
0 commit comments