perf: main window appears (a few frames) faster on trigger
This commit is contained in:
1 parent
bc16ca56f9
commit
2bc09e64b2
2 files changed
+5
-4
No files matched your search
@@ -397,8 +397,8 @@ extension UserDefaults {
|
||||
}
|
||||
|
||||
func cgfloat(_ key: String) -> CGFloat {
|
||||
if let result = (NumberFormatter().number(from: string(key)).flatMap { CGFloat(truncating: $0) }) {
|
||||
return result
|
||||
if let intResult = Int(string(key)) {
|
||||
return CGFloat(intResult)
|
||||
}
|
||||
removeObject(forKey: key)
|
||||
return cgfloat(key)
|
||||
|
||||
@@ -59,7 +59,7 @@ class ThumbnailsView: NSVisualEffectView {
|
||||
var currentY = Preferences.interCellPadding
|
||||
var maxX = CGFloat(0)
|
||||
var maxY = currentY + height + Preferences.interCellPadding
|
||||
scrollView.documentView!.subviews.removeAll()
|
||||
var newViews = [ThumbnailView]()
|
||||
rows.removeAll()
|
||||
rows.append([ThumbnailView]())
|
||||
for (index, window) in Windows.list.enumerated() {
|
||||
@@ -81,10 +81,11 @@ class ThumbnailsView: NSVisualEffectView {
|
||||
currentX = projectedX
|
||||
maxX = max(isLeftToRight ? currentX : widthMax - currentX, maxX)
|
||||
}
|
||||
scrollView.documentView!.subviews.append(view)
|
||||
newViews.append(view)
|
||||
rows[rows.count - 1].append(view)
|
||||
window.row = rows.count - 1
|
||||
}
|
||||
scrollView.documentView!.subviews = newViews
|
||||
return (maxX, maxY)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user