subrascasse

Sub Rascasse: an iPhone dive log for Subsurface cloud storage, with a pure-Swift git client (GPL-2.0)
git clone https://git.schurger.org/subrascasse.git
Log | Files | Refs | README | LICENSE

commit bca2060a3d80d012c795c510e9e8e535691f8128
parent 63204ede9da9be73bfbb07511055dee1da7303d7
Author: Jean Schurger <jean@schurger.org>
Date:   Sun, 15 Nov 2026 22:31:46 -0500

Plan profile: the fill follows the dive; stop rows hold at any text size

The plan has several points at the same instant (a gas switch, the end of a
stop) and area marks sharing an x are stacked: the fill went twice as deep as
the dive. One point per instant, and an explicit baseline. The stop rows are
on two lines so that nothing wraps with large text.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYG3yp7VDUZJzSBkvTc

Diffstat:
MApp/Views/TechPlanView.swift | 51++++++++++++++++++++++++++++++++++-----------------
1 file changed, 34 insertions(+), 17 deletions(-)

diff --git a/App/Views/TechPlanView.swift b/App/Views/TechPlanView.swift @@ -34,6 +34,7 @@ struct TechPlanView: View { var body: some View { let units = model.units + ScrollViewReader { proxy in Form { Section { Picker("Circuit", selection: $plan.mode) { @@ -173,6 +174,12 @@ struct TechPlanView: View { } } } + .onChange(of: result.runtime) { + // Screenshot option: bring the results into view. + guard LaunchOptions.flag("-planScroll") else { return } + DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) { proxy.scrollTo("stops", anchor: .center) } + } + } .confirmationDialog("Start a new plan?", isPresented: $confirmingReset, titleVisibility: .visible) { Button("Start over", role: .destructive) { plan = Self.starter } } @@ -242,30 +249,35 @@ struct TechPlanView: View { .foregroundStyle(.secondary) } ForEach(Array(result.stops.enumerated()), id: \.offset) { _, stop in - HStack { - Text(units.depth(stop.depth)) - .font(.body.monospacedDigit().weight(.medium)) - .frame(width: 64, alignment: .leading) - VStack(alignment: .leading, spacing: 2) { + // Two lines, so that nothing has to break whatever the text size: depth and time, then the details. + VStack(alignment: .leading, spacing: 3) { + HStack(alignment: .firstTextBaseline) { + Text(units.depth(stop.depth)) + .font(.body.monospacedDigit().weight(.medium)) + Spacer(minLength: 8) Text(String(localized: "\(Int((stop.seconds / 60).rounded())) min")) - .monospacedDigit() + .font(.body.monospacedDigit().weight(.medium)) + } + .lineLimit(1) + HStack(alignment: .firstTextBaseline, spacing: 6) { + Text(verbatim: plan.cylinders.indices.contains(stop.cylinder) ? plan.cylinders[stop.cylinder].gas.name : "") + .foregroundStyle(.green) if stop.kind != .deco { Text(stop.kind == .safety ? String(localized: "Safety stop") : String(localized: "Gas switch")) - .font(.caption) .foregroundStyle(.secondary) } + Spacer(minLength: 8) + Text(String(localized: "at \(Int((stop.endTime / 60).rounded())) min")) + .monospacedDigit() + .foregroundStyle(.secondary) } - Spacer() - Text(verbatim: plan.cylinders.indices.contains(stop.cylinder) ? plan.cylinders[stop.cylinder].gas.name : "") - .foregroundStyle(.green) - Text(String(localized: "at \(Int((stop.endTime / 60).rounded())) min")) - .font(.caption.monospacedDigit()) - .foregroundStyle(.secondary) - .frame(width: 78, alignment: .trailing) + .font(.caption) + .lineLimit(1) + .minimumScaleFactor(0.8) } } } header: { - Text("Stops") + Text("Stops").id("stops") } footer: { if !result.stops.isEmpty { Text("On the right: the run time when each stop ends.") } } @@ -401,9 +413,14 @@ private struct PlanChart: View { let switches = result.points.enumerated().compactMap { index, point -> PlanPoint? in index > 0 && result.points[index - 1].cylinder != point.cylinder ? point : nil } + // One point per instant: the plan has several at the same time (a gas switch, the end of a stop), and area + // marks sharing an x are stacked on top of each other, which drew a fill twice as deep as the dive. + let outline = result.points.reduce(into: [PlanPoint]()) { kept, point in + if let last = kept.last, last.time == point.time { kept[kept.count - 1] = point } else { kept.append(point) } + } Chart { - ForEach(Array(result.points.enumerated()), id: \.offset) { _, point in - AreaMark(x: .value("Time", point.time / 60), y: .value("Depth", -units.depthValue(point.depth))) + ForEach(Array(outline.enumerated()), id: \.offset) { _, point in + AreaMark(x: .value("Time", point.time / 60), yStart: .value("Surface", 0), yEnd: .value("Depth", -units.depthValue(point.depth))) .foregroundStyle(Color.accentColor.opacity(0.18)) LineMark(x: .value("Time", point.time / 60), y: .value("Depth", -units.depthValue(point.depth))) .foregroundStyle(Color.accentColor)