@@ -18,32 +18,40 @@ public class HorizontalTableView: TableView {
18
18
19
19
self . clipView. border = [ ]
20
20
self . tableView. border = [ ]
21
+
22
+ }
23
+
24
+ public override func updateAfterInitialize( isFlipped: Bool = true , bottomInset: CGFloat = 0 , drawBorder: Bool = false ) {
25
+ super. updateAfterInitialize ( isFlipped: isFlipped, bottomInset: bottomInset, drawBorder: drawBorder)
26
+
27
+ self . hasHorizontalScroller = false
28
+ self . horizontalScrollElasticity = . none
21
29
}
22
30
23
- public override func scrollWheel( with event: NSEvent ) {
24
-
31
+
32
+
33
+ override open func scrollWheel( with event: NSEvent ) {
34
+
35
+ if let applyExternalScroll = self . applyExternalScroll, applyExternalScroll ( event) {
36
+ return
37
+ }
38
+
25
39
var scrollPoint = contentView. bounds. origin
26
40
let isInverted : Bool = System . isScrollInverted
27
-
28
41
if event. scrollingDeltaY != 0 {
29
42
if isInverted {
30
43
scrollPoint. y += - event. scrollingDeltaY
31
44
} else {
32
45
scrollPoint. y -= event. scrollingDeltaY
33
46
}
47
+ scrollPoint. y = max ( 0 , min ( scrollPoint. y, listHeight - clipView. bounds. height) )
48
+ clipView. scroll ( to: scrollPoint)
49
+ window? . scrollWheel ( with: event)
50
+ return
34
51
}
35
-
36
- if event. scrollingDeltaX != 0 {
37
- if !isInverted {
38
- scrollPoint. y += - event. scrollingDeltaX
39
- } else {
40
- scrollPoint. y -= event. scrollingDeltaX
41
- }
52
+ if event. scrollingDeltaY != 0 || event. scrollingDeltaX != 0 {
53
+ super. scrollWheel ( with: event)
42
54
}
43
-
44
- scrollPoint. y = max ( 0 , min ( scrollPoint. y, listHeight - clipView. bounds. height) )
45
- clipView. scroll ( to: scrollPoint)
46
-
47
55
48
56
}
49
57
@@ -99,6 +107,20 @@ public class HorizontalTableView: TableView {
99
107
100
108
101
109
open class HorizontalScrollView : ScrollView {
110
+
111
+
112
+
113
+ public override init ( frame frameRect: NSRect ) {
114
+ super. init ( frame: frameRect)
115
+ self . hasVerticalScroller = false
116
+ self . verticalScrollElasticity = . none
117
+ }
118
+
119
+ required public init ? ( coder: NSCoder ) {
120
+ fatalError ( " init(coder:) has not been implemented " )
121
+ }
122
+
123
+
102
124
override open func scrollWheel( with event: NSEvent ) {
103
125
104
126
if let applyExternalScroll = self . applyExternalScroll, applyExternalScroll ( event) {
@@ -113,17 +135,16 @@ open class HorizontalScrollView : ScrollView {
113
135
} else {
114
136
scrollPoint. x -= event. scrollingDeltaY
115
137
}
116
- }
117
- if event. scrollingDeltaX != 0 {
118
- if !isInverted {
119
- scrollPoint. x += - event. scrollingDeltaX
120
- } else {
121
- scrollPoint. x -= event. scrollingDeltaX
122
- }
123
- }
124
- if documentView!. frame. width > frame. width {
125
138
scrollPoint. x = min ( max ( 0 , floorToScreenPixels ( backingScaleFactor, scrollPoint. x) ) , documentView!. frame. width - frame. width)
126
139
clipView. scroll ( to: scrollPoint)
140
+ window? . scrollWheel ( with: event)
141
+ return
142
+ }
143
+
144
+ if documentView!. frame. width > frame. width {
145
+ if event. scrollingDeltaY != 0 || event. scrollingDeltaX != 0 {
146
+ super. scrollWheel ( with: event)
147
+ }
127
148
} else {
128
149
superview? . scrollWheel ( with: event)
129
150
}
0 commit comments