Initial commit for first version of project
This commit is contained in:
83
GasTankAR/Views/TankAR/ARControlOverlay.swift
Normal file
83
GasTankAR/Views/TankAR/ARControlOverlay.swift
Normal file
@ -0,0 +1,83 @@
|
||||
//
|
||||
// ARControlOverlay.swift
|
||||
// GasTankAR
|
||||
//
|
||||
// Created by Dennis Nemec on 27.08.26.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// Runde Werkzeug-Buttons oben rechts über der AR-View. Untereinander angeordnet;
|
||||
/// weitere Funktionen lassen sich als zusätzliche `roundButton` ergänzen.
|
||||
struct ARControlOverlay: View {
|
||||
let controller: ARSessionController
|
||||
/// Öffnet die Strecken-Liste (Ausmessen).
|
||||
let onMeasure: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
HStack {
|
||||
Spacer()
|
||||
VStack(spacing: 12) {
|
||||
roundButton(
|
||||
systemImage: "shield.lefthalf.filled",
|
||||
isActive: controller.showSafetyZones,
|
||||
label: "Sicherheitsabstand"
|
||||
) {
|
||||
controller.toggleSafetyZones()
|
||||
}
|
||||
|
||||
roundButton(
|
||||
systemImage: "ruler",
|
||||
isActive: controller.measurementPhase != .idle,
|
||||
label: "Ausmessen"
|
||||
) {
|
||||
onMeasure()
|
||||
}
|
||||
|
||||
roundButton(
|
||||
systemImage: "point.3.connected.trianglepath.dotted",
|
||||
isActive: controller.pipeRoutingPhase != .idle,
|
||||
label: "Rohrführung"
|
||||
) {
|
||||
if controller.pipeRoutingPhase == .idle {
|
||||
controller.startPipeRouting()
|
||||
}
|
||||
}
|
||||
|
||||
roundButton(
|
||||
systemImage: "camera.fill",
|
||||
isActive: false,
|
||||
label: "Foto aufnehmen"
|
||||
) {
|
||||
controller.captureSnapshot()
|
||||
}
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
private func roundButton(
|
||||
systemImage: String,
|
||||
isActive: Bool,
|
||||
label: String,
|
||||
action: @escaping () -> Void
|
||||
) -> some View {
|
||||
Button(action: action) {
|
||||
Image(systemName: systemImage)
|
||||
.font(.title3)
|
||||
.frame(width: 52, height: 52)
|
||||
.foregroundStyle(isActive ? Color.white : Color.primary)
|
||||
.background(
|
||||
isActive ? AnyShapeStyle(Color.accentColor) : AnyShapeStyle(.ultraThinMaterial),
|
||||
in: .circle
|
||||
)
|
||||
.shadow(radius: 3)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityLabel(label)
|
||||
.accessibilityAddTraits(isActive ? .isSelected : [])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user