.../Source/Extensions/TransientScrollView.swift
Line | Count | Source |
1 | | // |
2 | | // TransientScrollView.swift |
3 | | // CutBox |
4 | | // |
5 | | // Created by Jason Milkins on 25/3/18. |
6 | | // Copyright © 2018-2023 ocodo. All rights reserved. |
7 | | // |
8 | | |
9 | | import Cocoa |
10 | | |
11 | | @IBDesignable |
12 | | |
13 | | public class TransientScrollView: NSScrollView { |
14 | | @IBInspectable @objc(enabled) public var isEnabled: Bool = true |
15 | | |
16 | 1 | public override func becomeFirstResponder() -> Bool { |
17 | 1 | return true |
18 | 1 | } |
19 | | |
20 | 2 | public override func scrollWheel(with event: NSEvent) { |
21 | 2 | if isEnabled { |
22 | 1 | super.scrollWheel(with: event) |
23 | 2 | } else { |
24 | 1 | nextResponder?.scrollWheel(with: event) |
25 | 2 | } |
26 | 2 | } |
27 | | } |