1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

GH-215 Refactor slightly

- play with some constants
This commit is contained in:
Tae Won Ha 2016-07-16 18:38:54 +02:00
parent a06c1ca4f6
commit b02c0b4c87
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -44,9 +44,13 @@ public class NeoVimView: NSView {
private var descent = CGFloat(0)
private var leading = CGFloat(0)
private var scrollGuardCounterX = 9
private var scrollGuardCounterY = 9
private let scrollGuardYield = 10
private let maxScrollDeltaX = 30
private let maxScrollDeltaY = 30
private let scrollLimiterX = CGFloat(20)
private let scrollLimiterY = CGFloat(20)
private var scrollGuardCounterX = 5
private var scrollGuardCounterY = 5
private let scrollGuardYield = 5
private let drawer: TextDrawer
private var font: NSFont {
@ -540,8 +544,8 @@ extension NeoVimView {
// The absolute delta values can get very very big when you use two finger scrolling on the trackpad:
// Cap them using heuristic values...
let numX = deltaX != 0 ? max(1, min(Int(absDeltaX / 20), 25)) : 0
let numY = deltaY != 0 ? max(1, min(Int(absDeltaY / 20), 25)) : 0
let numX = deltaX != 0 ? max(1, min(Int(absDeltaX / self.scrollLimiterX), self.maxScrollDeltaX)) : 0
let numY = deltaY != 0 ? max(1, min(Int(absDeltaY / self.scrollLimiterY), self.maxScrollDeltaY)) : 0
for i in 0..<max(numX, numY) {
if i < numX {