@@ -128,17 +128,16 @@ struct PanelView: View {
128128 @SceneStorage ( " panel.height " ) var panelHeight : Double = DefaultUIState . PANEL_HEIGHT
129129
130130 @State var showSheet = false
131- @State var keyboardHeight : CGFloat = 0.0
132131
133132 var maxHeight : CGFloat {
134- UIScreen . main . bounds . height
133+ windowHeight
135134 - UIApplication. shared. getSafeArea ( edge: . top)
136135 - UIApplication. shared. getSafeArea ( edge: . bottom)
137- - keyboardHeight
138136 - TOP_BAR_HEIGHT
139137 - EDITOR_MINIMUM_HEIGHT
140138 - BOTTOM_BAR_HEIGHT
141139 }
140+ var windowHeight : CGFloat
142141
143142 func evaluateProposedHeight( proposal: CGFloat ) {
144143 if proposal < PANEL_MINIMUM_HEIGHT {
@@ -153,7 +152,7 @@ struct PanelView: View {
153152
154153 var body : some View {
155154 Implementation ( )
156- . frame ( height: CGFloat ( panelHeight) )
155+ . frame ( height: min ( CGFloat ( panelHeight) , maxHeight ) )
157156 . background ( Color . init ( id: " editor.background " ) )
158157 . gesture (
159158 DragGesture ( )
@@ -162,31 +161,5 @@ struct PanelView: View {
162161 evaluateProposedHeight ( proposal: proposedNewHeight)
163162 }
164163 )
165- . onReceive (
166- NotificationCenter . default. publisher ( for: UIDevice . orientationDidChangeNotification)
167- ) { notification in
168- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 0.05 ) {
169- evaluateProposedHeight ( proposal: panelHeight)
170- }
171- }
172- . onReceive (
173- NotificationCenter . default. publisher (
174- for: UIResponder . keyboardDidChangeFrameNotification) ,
175- perform: { notification in
176- if let keyboardSize =
177- ( notification. userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? NSValue ) ?
178- . cgRectValue
179- {
180- keyboardHeight = keyboardSize. height
181- evaluateProposedHeight ( proposal: panelHeight)
182- }
183- }
184- )
185- . onReceive (
186- NotificationCenter . default. publisher ( for: UIResponder . keyboardDidHideNotification) ,
187- perform: { _ in
188- keyboardHeight = 0.0
189- }
190- )
191164 }
192165}
0 commit comments