From 9eb488a87a8776999ea444773cc60044cf66db93 Mon Sep 17 00:00:00 2001 From: saint Date: Fri, 24 May 2024 10:36:58 -0400 Subject: [PATCH] okay works and the resize works for the overlay too yay --- Fenestra.swift | 9 ++++----- gloss/ContentView.swift | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Fenestra.swift b/Fenestra.swift index 6dbb1a7..af4293f 100644 --- a/Fenestra.swift +++ b/Fenestra.swift @@ -89,13 +89,12 @@ struct Pane: View { @State var refresh: Bool = false - @State var vertSep = CGFloat(20) - @Environment(\.appDatabase) private var appDatabase // var handleVisibilityChanged: (String, VisibilityChange, VisibilityTracker) -> Void var body: some View { + var adjustedHeight = height - paneConnector.vertSep ZStack { ScrollViewReader { proxy in VisibilityTrackingScrollView(action: handleVisibilityChanged) { @@ -191,7 +190,7 @@ struct Pane: View { } .zIndex(1) .background(Color(red: 0.2, green: 0.2, blue: 0.2)) - .frame(width: width, height: height) + .frame(width: width, height: adjustedHeight) if self.paneConnector.showOverlay { Rectangle() @@ -199,7 +198,7 @@ struct Pane: View { .background(.ultraThinMaterial) .opacity(0.98) .offset(y: -50) - .frame(width: width, height: height + 100) + .frame(width: width, height: adjustedHeight + 100) // .blur(radius: 0.8) // .opacity(1) @@ -211,7 +210,7 @@ struct Pane: View { .zIndex(2) } } - .frame(width: width, height: height) + .frame(width: width, height: adjustedHeight) } func handleVisibilityChanged(_: String, change _: VisibilityChange, tracker: VisibilityTracker) { diff --git a/gloss/ContentView.swift b/gloss/ContentView.swift index 7d8a048..c4a9a97 100644 --- a/gloss/ContentView.swift +++ b/gloss/ContentView.swift @@ -191,6 +191,7 @@ class PaneConnector: NSObject, ObservableObject { // var setScrollOffset: CGFloat var showOverlay: Bool = false @Published var refresh: Bool = false + @Published var vertSep = CGFloat(20) var currentId = "" var currentOffset = CGFloat() var visibilityTracker: VisibilityTracker? @@ -208,8 +209,6 @@ struct ContentView: View { @State var refresh: Bool = false - @State var vertSep = CGFloat(20) - @State var endedDrag = true @State var readOffset = CGPoint() @@ -277,7 +276,7 @@ struct ContentView: View { segs: segs, selectedRibbon: selectedRibbon, width: geometry.size.width - 50, - height: geometry.size.height / 2 - vertSep) + height: geometry.size.height / 2) ////// Text("separator").foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00))) @@ -285,7 +284,7 @@ struct ContentView: View { DragGesture() .onChanged { gesture in - vertSep = vertSep - gesture.translation.height + paneConnector.vertSep = paneConnector.vertSep - gesture.translation.height Print(gesture.translation.width) Print(gesture.translation.height)