Keep diagram buttons the same size when selected

This commit is contained in:
Ian Gulliver
2026-10-22 10:13:40 -07:00
parent 33604e2a51
commit b54a1a04b3
+15 -10
View File
@@ -435,16 +435,21 @@ private struct WebButton: View {
var body: some View { var body: some View {
let fill = danger ? Palette.danger : Palette.accent let fill = danger ? Palette.danger : Palette.accent
configuration.label ZStack {
.font(Fonts.font(13, weight: primary ? 700 : 400)) configuration.label
.foregroundStyle(primary ? Palette.bg : danger ? Palette.danger : Palette.text) .font(Fonts.font(13, weight: 700))
.padding(.horizontal, 12) .hidden()
.padding(.vertical, touchOnly ? 7 : 4) configuration.label
.background(primary ? fill : Palette.raised, in: RoundedRectangle(cornerRadius: 6)) .font(Fonts.font(13, weight: primary ? 700 : 400))
.overlay(RoundedRectangle(cornerRadius: 6).stroke(primary ? fill : hover && enabled ? Palette.muted : Palette.border)) }
.opacity(enabled ? (configuration.isPressed ? 0.8 : 1) : 0.45) .foregroundStyle(primary ? Palette.bg : danger ? Palette.danger : Palette.text)
.contentShape(Rectangle()) .padding(.horizontal, 12)
.onHover { hover = $0 } .padding(.vertical, touchOnly ? 7 : 4)
.background(primary ? fill : Palette.raised, in: RoundedRectangle(cornerRadius: 6))
.overlay(RoundedRectangle(cornerRadius: 6).stroke(primary ? fill : hover && enabled ? Palette.muted : Palette.border))
.opacity(enabled ? (configuration.isPressed ? 0.8 : 1) : 0.45)
.contentShape(Rectangle())
.onHover { hover = $0 }
} }
} }