Skip to content

Commit d0910a2

Browse files
committed
Simplify implementation
1 parent aac6509 commit d0910a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Core/Sources/ChatGPTChatTab/ChatPanel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ struct ChatPanelMessages: View {
137137

138138
func trackScrollWheel() {
139139
NSApplication.shared.publisher(for: \.currentEvent)
140-
.filter { _ in isEnabled }
141-
.filter { event in event?.type == .scrollWheel }
140+
.compactMap { $0 }
141+
.filter { isEnabled && $0.type == .scrollWheel }
142142
.sink { event in
143-
guard isEnabled, isPinnedToBottom else { return }
144-
let delta = event?.deltaY ?? 0
143+
guard isPinnedToBottom else { return }
144+
let delta = event.deltaY
145145
let scrollUp = delta > 0
146146
if scrollUp {
147147
isPinnedToBottom = false

0 commit comments

Comments
 (0)