1
1
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:
Tae Won Ha 2016-11-16 21:10:49 +01:00
parent dfdb3fb91b
commit ccb2f7b239
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -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
}
}