@@ -23,41 +23,18 @@ struct PadLayoutEditView: View {
2323 var body : some View {
2424 GeometryReader { geo in
2525 let isActuallyLandscape = geo. size. width > geo. size. height
26+ let safeAreaTop = geo. safeAreaInsets. top
2627 ZStack {
28+ // Canvas
2729 if isActuallyLandscape {
2830 landscapeEditorCanvas ( )
2931 } else {
3032 portraitEditorCanvas ( width: geo. size. width, height: geo. size. height)
3133 }
3234
33- // Banner when editing data for a different orientation than current geometry
34- if isActuallyLandscape != editLandscape {
35- VStack {
36- HStack ( spacing: 6 ) {
37- Image ( systemName: " exclamationmark.triangle.fill " )
38- Text ( editLandscape
39- ? " Editing landscape layout in portrait. Rotate device to landscape for full canvas. "
40- : " Editing portrait layout in landscape. Rotate device to portrait for full canvas. " )
41- . font ( . caption. weight ( . semibold) )
42- . multilineTextAlignment ( . center)
43- . lineLimit ( 3 )
44- }
45- . foregroundStyle ( . yellow)
46- . padding ( . horizontal, 12 )
47- . padding ( . vertical, 8 )
48- . background ( . black. opacity ( 0.6 ) , in: RoundedRectangle ( cornerRadius: 8 ) )
49- Spacer ( )
50- }
51- . padding ( . top, 50 )
52- . padding ( . horizontal, 20 )
53- . allowsHitTesting ( false )
54- }
55-
56- VStack {
57- compactToolbar
58- Spacer ( )
59- }
60- . padding ( . top, 50 )
35+ // Chrome overlay
36+ editorChrome ( isLandscape: isActuallyLandscape, safeAreaTop: safeAreaTop)
37+ . zIndex ( 1 )
6138 }
6239 }
6340 . navigationBarHidden ( true )
@@ -115,9 +92,23 @@ struct PadLayoutEditView: View {
11592 }
11693 }
11794
118- // MARK: - Compact toolbar
119- private var compactToolbar : some View {
120- HStack ( spacing: 12 ) {
95+ // MARK: - Editor chrome overlay
96+ private func editorChrome( isLandscape: Bool , safeAreaTop: CGFloat ) -> some View {
97+ VStack ( spacing: 0 ) {
98+ editorToolbar ( isLandscape: isLandscape)
99+
100+ if isLandscape != editLandscape {
101+ rotationWarningBanner ( )
102+ . padding ( . top, 8 )
103+ }
104+
105+ Spacer ( )
106+ }
107+ . padding ( . top, max ( safeAreaTop, 4 ) )
108+ }
109+
110+ private func editorToolbar( isLandscape: Bool ) -> some View {
111+ HStack ( spacing: isLandscape ? 8 : 12 ) {
121112 // Cancel
122113 Button {
123114 if let snapshot = originalSnapshot {
@@ -126,7 +117,7 @@ struct PadLayoutEditView: View {
126117 onDismiss ( )
127118 } label: {
128119 Image ( systemName: " xmark.circle.fill " )
129- . font ( . title2)
120+ . font ( isLandscape ? . title3 : . title2)
130121 . foregroundStyle ( . white)
131122 }
132123
@@ -136,7 +127,7 @@ struct PadLayoutEditView: View {
136127 restore ( snapshot: snapshot)
137128 } label: {
138129 Image ( systemName: " arrow.uturn.backward.circle " )
139- . font ( . title2)
130+ . font ( isLandscape ? . title3 : . title2)
140131 . foregroundStyle ( undoStack. isEmpty ? . white. opacity ( 0.3 ) : . white)
141132 }
142133 . disabled ( undoStack. isEmpty)
@@ -149,16 +140,16 @@ struct PadLayoutEditView: View {
149140 Text ( " Landscape " ) . tag ( true )
150141 }
151142 . pickerStyle ( . segmented)
152- . frame ( width: 140 )
143+ . frame ( width: 160 )
153144 . background ( . black. opacity ( 0.3 ) , in: RoundedRectangle ( cornerRadius: 8 ) )
154145
155146 Spacer ( )
156147
157148 // Skin picker
158- skinPickerMenu
149+ skinPickerMenuButton ( isLandscape : isLandscape )
159150
160151 // Options (visibility + reset)
161- optionsMenu
152+ optionsMenuButton ( isLandscape : isLandscape )
162153
163154 // Save
164155 Button {
@@ -169,17 +160,35 @@ struct PadLayoutEditView: View {
169160 onDismiss ( )
170161 } label: {
171162 Image ( systemName: " checkmark.circle.fill " )
172- . font ( . title2)
163+ . font ( isLandscape ? . title3 : . title2)
173164 . foregroundStyle ( . green)
174165 }
175166 }
176167 . padding ( . horizontal)
177168 . padding ( . top, 4 )
178169 . padding ( . bottom, 8 )
179- . background ( . black. opacity ( 0.5 ) )
170+ . background ( . black. opacity ( 0.72 ) , in: RoundedRectangle ( cornerRadius: 12 , style: . continuous) )
171+ }
172+
173+ private func rotationWarningBanner( ) -> some View {
174+ HStack ( spacing: 6 ) {
175+ Image ( systemName: " exclamationmark.triangle.fill " )
176+ Text ( editLandscape
177+ ? " Editing landscape layout in portrait. Rotate device to landscape for full canvas. "
178+ : " Editing portrait layout in landscape. Rotate device to portrait for full canvas. " )
179+ . font ( . caption. weight ( . semibold) )
180+ . multilineTextAlignment ( . center)
181+ . lineLimit ( 3 )
182+ }
183+ . foregroundStyle ( . yellow)
184+ . padding ( . horizontal, 12 )
185+ . padding ( . vertical, 8 )
186+ . background ( . black. opacity ( 0.6 ) , in: RoundedRectangle ( cornerRadius: 8 ) )
187+ . padding ( . horizontal, 20 )
188+ . allowsHitTesting ( false )
180189 }
181190
182- private var skinPickerMenu : some View {
191+ private func skinPickerMenuButton ( isLandscape : Bool ) -> some View {
183192 Menu {
184193 ForEach ( VirtualPadSkin . allCases) { skin in
185194 Button {
@@ -190,12 +199,12 @@ struct PadLayoutEditView: View {
190199 }
191200 } label: {
192201 Image ( systemName: " paintpalette.fill " )
193- . font ( . title2)
202+ . font ( isLandscape ? . title3 : . title2)
194203 . foregroundStyle ( . white)
195204 }
196205 }
197206
198- private var optionsMenu : some View {
207+ private func optionsMenuButton ( isLandscape : Bool ) -> some View {
199208 Menu {
200209 // Visibility section
201210 Section ( " Visibility " ) {
@@ -229,7 +238,7 @@ struct PadLayoutEditView: View {
229238 }
230239 } label: {
231240 Image ( systemName: " ellipsis.circle " )
232- . font ( . title2)
241+ . font ( isLandscape ? . title3 : . title2)
233242 . foregroundStyle ( . white)
234243 }
235244 }
0 commit comments