mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 11:37:32 +03:00
GH-296 Refactor slightly
This commit is contained in:
parent
dfdb3fb91b
commit
ccb2f7b239
@ -534,31 +534,33 @@ extension WorkspaceBar {
|
||||
}
|
||||
|
||||
var lastButton = firstButton
|
||||
for button in self.tools[1..<self.tools.count].map({ $0.button }) {
|
||||
switch self.location {
|
||||
case .top:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(toSuperviewEdge: .top),
|
||||
button.autoPinEdge(.left, to: .right, of: lastButton),
|
||||
])
|
||||
case .right:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.top, to: .bottom, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .right),
|
||||
])
|
||||
case .bottom:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.left, to: .right, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .bottom),
|
||||
])
|
||||
case .left:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.top, to: .bottom, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .left),
|
||||
])
|
||||
}
|
||||
|
||||
lastButton = button
|
||||
self.tools[1..<self.tools.count]
|
||||
.map({ $0.button })
|
||||
.forEach { button in
|
||||
switch self.location {
|
||||
case .top:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(toSuperviewEdge: .top),
|
||||
button.autoPinEdge(.left, to: .right, of: lastButton),
|
||||
])
|
||||
case .right:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.top, to: .bottom, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .right),
|
||||
])
|
||||
case .bottom:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.left, to: .right, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .bottom),
|
||||
])
|
||||
case .left:
|
||||
self.layoutConstraints.append(contentsOf: [
|
||||
button.autoPinEdge(.top, to: .bottom, of: lastButton),
|
||||
button.autoPinEdge(toSuperviewEdge: .left),
|
||||
])
|
||||
}
|
||||
|
||||
lastButton = button
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user