turn zoom into a toggle rather than an explicit zoom/unzoom

This commit is contained in:
Mitchell Hashimoto
2023-09-02 16:03:51 -07:00
parent 70bdc21d22
commit 4570356e57
8 changed files with 27 additions and 50 deletions

View File

@@ -199,14 +199,13 @@ extension Ghostty {
var body: some View {
let center = NotificationCenter.default
let pubZoom = center.publisher(for: Notification.didToggleSplitZoom)
// If we're zoomed, we don't render anything, we are transparent. This
// ensures that the View stays around so we don't lose our state, but
// also that the zoomed view on top can see through if background transparency
// is enabled.
if (zoomedSurface == nil) {
let pubZoom = center.publisher(for: Notification.didZoomSplit)
ZStack {
switch (node) {
case .noSplit(let leaf):
@@ -248,11 +247,8 @@ extension Ghostty {
}
.navigationTitle(surfaceTitle ?? "Ghostty")
} else {
// If we're zoomed, we want to listen for zoom resets.
let pubZoomReset = center.publisher(for: Notification.didZoomResetSplit)
ZStack {}
.onReceive(pubZoomReset) { onZoomReset(notification: $0) }
.onReceive(pubZoom) { onZoomReset(notification: $0) }
}
}