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 {
|
func cgfloat(_ key: String) -> CGFloat {
|
||||||
if let result = (NumberFormatter().number(from: string(key)).flatMap { CGFloat(truncating: $0) }) {
|
if let intResult = Int(string(key)) {
|
||||||
return result
|
return CGFloat(intResult)
|
||||||
}
|
}
|
||||||
removeObject(forKey: key)
|
removeObject(forKey: key)
|
||||||
return cgfloat(key)
|
return cgfloat(key)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class ThumbnailsView: NSVisualEffectView {
|
|||||||
var currentY = Preferences.interCellPadding
|
var currentY = Preferences.interCellPadding
|
||||||
var maxX = CGFloat(0)
|
var maxX = CGFloat(0)
|
||||||
var maxY = currentY + height + Preferences.interCellPadding
|
var maxY = currentY + height + Preferences.interCellPadding
|
||||||
scrollView.documentView!.subviews.removeAll()
|
var newViews = [ThumbnailView]()
|
||||||
rows.removeAll()
|
rows.removeAll()
|
||||||
rows.append([ThumbnailView]())
|
rows.append([ThumbnailView]())
|
||||||
for (index, window) in Windows.list.enumerated() {
|
for (index, window) in Windows.list.enumerated() {
|
||||||
@@ -81,10 +81,11 @@ class ThumbnailsView: NSVisualEffectView {
|
|||||||
currentX = projectedX
|
currentX = projectedX
|
||||||
maxX = max(isLeftToRight ? currentX : widthMax - currentX, maxX)
|
maxX = max(isLeftToRight ? currentX : widthMax - currentX, maxX)
|
||||||
}
|
}
|
||||||
scrollView.documentView!.subviews.append(view)
|
newViews.append(view)
|
||||||
rows[rows.count - 1].append(view)
|
rows[rows.count - 1].append(view)
|
||||||
window.row = rows.count - 1
|
window.row = rows.count - 1
|
||||||
}
|
}
|
||||||
|
scrollView.documentView!.subviews = newViews
|
||||||
return (maxX, maxY)
|
return (maxX, maxY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user