Skip to content

Commit 4f73192

Browse files
Respect floating transcript scroll intent
Keep the Swift live transcript panel from re-enabling bottom snapping when transcript content changes while the user has scrolled away.
1 parent e6c3602 commit 4f73192

1 file changed

Lines changed: 0 additions & 17 deletions

File tree

plugins/windows/swift-lib/src/FloatingBarView.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -626,24 +626,19 @@ private struct TranscriptScrollObserver: NSViewRepresentable {
626626
context.coordinator.isPinnedToBottom = $isPinnedToBottom
627627
DispatchQueue.main.async {
628628
context.coordinator.bind(to: view.enclosingScrollView)
629-
context.coordinator.updatePinnedState()
630629
}
631630
}
632631

633632
final class Coordinator {
634633
var isPinnedToBottom: Binding<Bool>?
635634
private weak var scrollView: NSScrollView?
636635
private var boundsObserver: NSObjectProtocol?
637-
private var frameObserver: NSObjectProtocol?
638636
private let threshold: CGFloat = 20
639637

640638
deinit {
641639
if let boundsObserver {
642640
NotificationCenter.default.removeObserver(boundsObserver)
643641
}
644-
if let frameObserver {
645-
NotificationCenter.default.removeObserver(frameObserver)
646-
}
647642
}
648643

649644
func bind(to scrollView: NSScrollView?) {
@@ -652,9 +647,6 @@ private struct TranscriptScrollObserver: NSViewRepresentable {
652647
if let boundsObserver {
653648
NotificationCenter.default.removeObserver(boundsObserver)
654649
}
655-
if let frameObserver {
656-
NotificationCenter.default.removeObserver(frameObserver)
657-
}
658650

659651
self.scrollView = scrollView
660652
guard let scrollView else { return }
@@ -668,15 +660,6 @@ private struct TranscriptScrollObserver: NSViewRepresentable {
668660
self?.updatePinnedState()
669661
}
670662

671-
scrollView.documentView?.postsFrameChangedNotifications = true
672-
frameObserver = NotificationCenter.default.addObserver(
673-
forName: NSView.frameDidChangeNotification,
674-
object: scrollView.documentView,
675-
queue: .main
676-
) { [weak self] _ in
677-
self?.updatePinnedState()
678-
}
679-
680663
updatePinnedState()
681664
}
682665

0 commit comments

Comments
 (0)