Merge main: Live Activity CarPlay polish, direction-letter formatting, bubble pitch fix
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,15 +138,15 @@ struct AlignmentAssistantView: View {
|
||||
|
||||
private var readings: some View {
|
||||
HStack(spacing: 12) {
|
||||
reading("Längs", state.pitch)
|
||||
reading("Quer", state.roll)
|
||||
reading("Gesamt", assistant.current?.deviation)
|
||||
reading("Längs", LevelDirectionFormatting.pitchTile(state.pitch))
|
||||
reading("Quer", LevelDirectionFormatting.rollTile(state.roll))
|
||||
reading("Gesamt", LevelDirectionFormatting.magnitude(assistant.current?.deviation))
|
||||
}
|
||||
}
|
||||
|
||||
private func reading(_ title: String, _ value: Double?) -> some View {
|
||||
private func reading(_ title: String, _ text: String) -> some View {
|
||||
VStack(spacing: 4) {
|
||||
Text(value.map { String(format: "%.1f°", $0) } ?? "–")
|
||||
Text(text)
|
||||
.font(.title2.weight(.semibold).monospacedDigit())
|
||||
Text(title)
|
||||
.font(.caption)
|
||||
|
||||
@@ -13,6 +13,8 @@ struct DeviceCard: View {
|
||||
|
||||
if isShowingLastSettings, let snapshot {
|
||||
lastSettings(for: snapshot)
|
||||
} else if let snapshot, snapshot.primaryMetric != nil, device.role == .leveling {
|
||||
levelReadout(for: snapshot)
|
||||
} else if let snapshot, let primary = snapshot.primaryMetric {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 4) {
|
||||
Text(primary.formatted)
|
||||
@@ -115,6 +117,21 @@ struct DeviceCard: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Für die Nivellierung: Front/Heck und links/rechts nebeneinander, groß,
|
||||
/// ohne "Längsneigung"/"Querneigung"-Beschriftung – die Richtung steht ja
|
||||
/// schon im vorangestellten Buchstaben.
|
||||
private func levelReadout(for snapshot: DeviceSnapshot) -> some View {
|
||||
let pitch = snapshot.metrics.first(where: { $0.key == "pitch" })?.value
|
||||
let roll = snapshot.metrics.first(where: { $0.key == "roll" })?.value
|
||||
return HStack(spacing: 24) {
|
||||
Text(LevelDirectionFormatting.pitchTile(pitch))
|
||||
Text(LevelDirectionFormatting.rollTile(roll))
|
||||
}
|
||||
.font(.system(size: 36, weight: .semibold, design: .rounded))
|
||||
.contentTransition(.numericText())
|
||||
.foregroundStyle(snapshot.isStale ? .secondary : .primary)
|
||||
}
|
||||
|
||||
private func secondaryValues(for snapshot: DeviceSnapshot) -> some View {
|
||||
let others = snapshot.metrics
|
||||
.filter { $0.id != snapshot.primaryMetric?.id && $0.value != nil }
|
||||
|
||||
@@ -76,8 +76,9 @@ struct LevelBubble: View {
|
||||
.fill(bubbleColor)
|
||||
.frame(width: bubble, height: bubble)
|
||||
// Positiver Pitch heisst: das Heck steht höher, die Blase
|
||||
// wandert also nach oben – in der Ansicht nach hinten.
|
||||
.offset(x: offsetX, y: -offsetY)
|
||||
// wandert also nach unten – in der Ansicht nach hinten.
|
||||
// Muss zur "Fahrzeug"-Ansicht (VehicleTiltView) passen.
|
||||
.offset(x: offsetX, y: offsetY)
|
||||
.animation(.spring(duration: 0.35), value: offsetX)
|
||||
.animation(.spring(duration: 0.35), value: offsetY)
|
||||
.opacity(pitch == nil && roll == nil ? 0.25 : 1)
|
||||
@@ -138,8 +139,8 @@ struct LevelControls: View {
|
||||
}
|
||||
|
||||
HStack(spacing: 24) {
|
||||
reading("Längs", state.pitch)
|
||||
reading("Quer", state.roll)
|
||||
reading("Längs", LevelDirectionFormatting.pitchTile(state.pitch))
|
||||
reading("Quer", LevelDirectionFormatting.rollTile(state.roll))
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -239,9 +240,9 @@ struct LevelControls: View {
|
||||
state.isKnownUncalibrated ? "Nullpunkt fehlt" : device.sensorOrientation.summary
|
||||
}
|
||||
|
||||
private func reading(_ title: String, _ value: Double?) -> some View {
|
||||
private func reading(_ title: String, _ text: String) -> some View {
|
||||
VStack(spacing: 2) {
|
||||
Text(value.map { String(format: "%.1f°", $0) } ?? "–")
|
||||
Text(text)
|
||||
.font(.title2.weight(.semibold).monospacedDigit())
|
||||
Text(title)
|
||||
.font(.caption)
|
||||
|
||||
Reference in New Issue
Block a user