mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-24 18:59:36 +00:00
Fix timeline scroll buttons growing too large with Dynamic Type
CompoundIcon already scales its size with Dynamic Type, but the chevron was given a size that was itself a @ScaledMetric, so it scaled twice: the button reached about 202pt at the largest accessibility size, more than twice the composer's mic button. Pass the base icon size and scale the icon, its padding and the badge once, relative to headingLG like the composer buttons. The button now keeps its proportions at every size (72pt at the largest, mic 88pt) and is unchanged at the default size.
This commit is contained in:
@@ -23,8 +23,7 @@ struct TimelineScrollButton: View {
|
||||
let onLongPress: (() -> Void)?
|
||||
let callback: () -> Void
|
||||
|
||||
@ScaledMetric(relativeTo: .compound.bodyLG) private var iconSize: CGFloat = 24
|
||||
@ScaledMetric(relativeTo: .compound.bodyLG) private var badgeDotSize: CGFloat = 12
|
||||
@ScaledMetric(relativeTo: .compound.headingLG) private var badgeDotSize: CGFloat = 12
|
||||
@GestureState private var isPressing = false
|
||||
/// Set when a long-press is recognized so the trailing touch-up doesn't also fire `callback()`.
|
||||
@State private var consumedByLongPress = false
|
||||
@@ -103,10 +102,10 @@ struct TimelineScrollButton: View {
|
||||
@ViewBuilder
|
||||
private var icon: some View {
|
||||
let chevron = CompoundIcon(direction == .down ? \.chevronDown : \.chevronUp,
|
||||
size: .custom(iconSize),
|
||||
relativeTo: .compound.bodyLG)
|
||||
size: .medium,
|
||||
relativeTo: .compound.headingLG)
|
||||
.foregroundStyle(.compound.iconPrimary)
|
||||
.padding(iconPadding)
|
||||
.scaledPadding(iconPadding, relativeTo: .compound.headingLG)
|
||||
if #available(iOS 26, *) {
|
||||
chevron
|
||||
.glassEffect(.regular, in: Circle())
|
||||
|
||||
Reference in New Issue
Block a user