Skip to content

Commit 0c69295

Browse files
committed
Use convenience addSubview variant
1 parent 2a3fbb4 commit 0c69295

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Sources/GateEngine/UI/Button.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,7 @@ open class Button: Control {
293293
weak var _label: Label! = nil
294294
func createLabel() {
295295
let label = Label(text: kind == .momentaryPush ? "Button" : "Toggle", font: .default, fontSize: 18, style: .bold, textColor: self.textColors[.normal] ?? .white)
296-
label.centerXAnchor.constrain(to: self.centerXAnchor)
297-
label.centerYAnchor.constrain(to: self.centerYAnchor)
298-
label.widthAnchor.constrain(to: self.widthAnchor, adding: -8) // Inset by 4
299-
label.heightAnchor.constrain(to: self.heightAnchor, adding: -8) // Inset by 4
300-
self.addSubview(label)
296+
self.addSubview(label, constrainHorizontal: .fill, constrainVertical: .fill, insets: Insets(4))
301297
self.labelCreated = true
302298
_label = label
303299
}

0 commit comments

Comments
 (0)