adds nice git interface
This commit is contained in:
@@ -290,20 +290,16 @@ public final class SearchModel {
|
||||
|
||||
// MARK: Layout
|
||||
|
||||
/// Column widths: the focused column takes 70%; at rest this file is 230, files 250,
|
||||
/// and a side column never drops below 180.
|
||||
public static func widths(total: CGFloat, columns: [Column], focused: Column) -> [Column: CGFloat] {
|
||||
let restingSide: [Column: CGFloat] = [.thisFile: 230, .files: 250]
|
||||
let minimumSide: CGFloat = 180
|
||||
/// Fixed column widths that never follow the focus: 30 · 45 · 25 with this file, else 65 · 35.
|
||||
public static func widths(total: CGFloat, columns: [Column]) -> [Column: CGFloat] {
|
||||
var widths: [Column: CGFloat] = [:]
|
||||
if focused == .project {
|
||||
for side in columns where side != .project { widths[side] = restingSide[side] }
|
||||
if columns.contains(.thisFile) {
|
||||
widths[.thisFile] = (total * 0.30).rounded()
|
||||
widths[.files] = (total * 0.25).rounded()
|
||||
} else {
|
||||
widths[focused] = (total * 0.7).rounded()
|
||||
for side in columns where side != .project && side != focused { widths[side] = minimumSide }
|
||||
widths[.files] = (total * 0.35).rounded()
|
||||
}
|
||||
let used = widths.values.reduce(0, +)
|
||||
widths[.project] = max(0, total - used)
|
||||
widths[.project] = max(0, total - widths.values.reduce(0, +))
|
||||
return widths
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user