mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 23:24:32 +00:00
Update Numeric Text transition
This commit is contained in:
parent
e58d995b05
commit
8942e1f8a5
3 changed files with 61 additions and 10 deletions
|
|
@ -73,11 +73,14 @@ struct VerticalHUDView: View {
|
|||
// Icon & Text overlay
|
||||
VStack {
|
||||
if showValue {
|
||||
Text("\(Int(state.value * 100))%")
|
||||
.font(.system(size: 10, weight: .bold))
|
||||
.foregroundStyle(state.value > 0.85 ? (useAccentColor ? .white : .black) : .secondary)
|
||||
.padding(.top, 8 + (stretchOffset < 0 ? abs(stretchOffset/4) : 0))
|
||||
.contentTransition(.numericText())
|
||||
HUDNumericLabel(
|
||||
value: state.value,
|
||||
font: .system(size: 10, weight: .bold),
|
||||
color: valueLabelColor,
|
||||
alignment: .center,
|
||||
width: hudWidth * 0.8
|
||||
)
|
||||
.padding(.top, 8 + (stretchOffset < 0 ? abs(stretchOffset/4) : 0))
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
|
@ -225,5 +228,12 @@ struct VerticalHUDView: View {
|
|||
|
||||
return AnyShapeStyle(useAccentColor ? Color.accentColor : Color.white)
|
||||
}
|
||||
|
||||
private var valueLabelColor: Color {
|
||||
if state.value > 0.85 {
|
||||
return useAccentColor ? .white : .black
|
||||
}
|
||||
return .secondary
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue