diff --git a/samples/MapConductorSampleApp/Sources/pages/circle/AntennaHorizonsPage.swift b/samples/MapConductorSampleApp/Sources/pages/circle/AntennaHorizonsPage.swift index 978c204..1a3a4d6 100644 --- a/samples/MapConductorSampleApp/Sources/pages/circle/AntennaHorizonsPage.swift +++ b/samples/MapConductorSampleApp/Sources/pages/circle/AntennaHorizonsPage.swift @@ -115,12 +115,18 @@ struct AntennaHorizonsPage: View { return content }() } + .overlay { + if let adding { + DrawingOverlay(text: Text(adding.total == 0 ? "Drawing the map…" : "Adding to the map… \(adding.added) / \(adding.total)")) + } + } VStack(alignment: .leading, spacing: 8) { Text("US cell positions (MCC 310–314)").font(.headline) Text(error ?? (rows.isEmpty ? "Loading OpenCellID data…" : "\(circles.count) / \(rows.count) circles")) .accessibilityIdentifier("antenna-circle-count") if let adding { - Text("Adding to the map… \(adding.added) / \(adding.total)") + // total is 0 when nothing new is added: a filter that only hides cells, or the camera moving. + Text(adding.total == 0 ? "Drawing the map…" : "Adding to the map… \(adding.added) / \(adding.total)") .accessibilityIdentifier("antenna-add-progress") } HStack { Button("US overview") { moveCamera(39, -98, 4) }; Button("Alaska") { moveCamera(64, -150, 5) } } @@ -219,3 +225,34 @@ private struct CarrierToggle: View { .accessibilityIdentifier(icon) } } + +/// Over the map while circles are added or their tiles drawn (between onAddStart and +/// onAddEnd). Shown after 150 ms, as the web and Android samples' overlays are, so that a +/// short redraw does not flash; it does not take touches, so the map can still be moved +/// while it draws. +private struct DrawingOverlay: View { + let text: Text + @State private var visible = false + + var body: some View { + ZStack { + if visible { + Color(red: 0x0F / 255, green: 0x17 / 255, blue: 0x2A / 255).opacity(0.2) + VStack(spacing: 10) { + ProgressView() + text.font(.callout) + } + .padding(.horizontal, 20).padding(.vertical, 16) + .background(Color(UIColor.secondarySystemBackground)) + .clipShape(RoundedRectangle(cornerRadius: 12)) + .accessibilityElement(children: .combine) + .accessibilityIdentifier("antenna-drawing-overlay") + } + } + .allowsHitTesting(false) + .task { + try? await Task.sleep(nanoseconds: 150_000_000) + visible = true + } + } +}