Add tank catalog with USDZ models and tank selection
Introduce TankDefinition/TankCatalog loaded from Tanks.json, bundle the Drachengas USDZ tank models, add tank selection and preview views, and update the AR experience, editor and project views to use the catalog. Includes tests for catalog loading and model selection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -16,18 +16,23 @@ struct MeasurementListView: View {
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Group {
|
||||
if controller.measurements.isEmpty {
|
||||
ContentUnavailableView {
|
||||
Label("Keine Strecken", systemImage: "ruler")
|
||||
} description: {
|
||||
Text("Füge eine Strecke hinzu und wähle dafür zwei Punkte im Raum.")
|
||||
} actions: {
|
||||
Button("Strecke hinzufügen", systemImage: "plus", action: onAddStrecke)
|
||||
.buttonStyle(.borderedProminent)
|
||||
List {
|
||||
Section("Tankmaße") {
|
||||
Toggle("Alle anzeigen", isOn: allDimensionsBinding)
|
||||
|
||||
ForEach(TankDimension.allCases) { dimension in
|
||||
Toggle(
|
||||
dimension.title,
|
||||
isOn: dimensionBinding(for: dimension)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
List {
|
||||
}
|
||||
|
||||
Section("Eigene Strecken") {
|
||||
if controller.measurements.isEmpty {
|
||||
Text("Noch keine eigenen Strecken angelegt.")
|
||||
.foregroundStyle(.secondary)
|
||||
} else {
|
||||
ForEach(controller.measurements) { measurement in
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
@ -56,4 +61,22 @@ struct MeasurementListView: View {
|
||||
}
|
||||
.presentationDetents([.medium, .large])
|
||||
}
|
||||
|
||||
private var allDimensionsBinding: Binding<Bool> {
|
||||
Binding(
|
||||
get: { TankDimension.allCases.allSatisfy { controller.visibleTankDimensions.contains($0) } },
|
||||
set: { isVisible in
|
||||
for dimension in TankDimension.allCases {
|
||||
controller.setTankDimension(dimension, visible: isVisible)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private func dimensionBinding(for dimension: TankDimension) -> Binding<Bool> {
|
||||
Binding(
|
||||
get: { controller.visibleTankDimensions.contains(dimension) },
|
||||
set: { controller.setTankDimension(dimension, visible: $0) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user