Kaynağa Gözat

Draw temp targets at the BG level they target instead of in the override strip (#720)

Jonas Björkert 1 hafta önce
ebeveyn
işleme
9093e74de6
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      LoopFollow/Charts/BGChartModel.swift

+ 5 - 2
LoopFollow/Charts/BGChartModel.swift

@@ -537,11 +537,14 @@ final class BGChartModel: ObservableObject {
         }
         tempTargets = vc.tempTargetGraphData.map {
             let target = $0.correctionRange.first.map { String($0) } ?? ""
+            // Temp targets render at the BG level they target (±5 mg/dL);
+            // only overrides live in the top strip.
+            let yCenter = Double($0.correctionRange.first ?? 0)
             return BandRect(
                 start: Date(timeIntervalSince1970: $0.date),
                 end: Date(timeIntervalSince1970: $0.endDate),
-                yBottom: yBottom,
-                yTop: yTop,
+                yBottom: yCenter - 5,
+                yTop: yCenter + 5,
                 label: "Temp Target",
                 pillText: "Temp Target\n\(Localizer.toDisplayUnits(target))\n\(pillTimeString(for: Date(timeIntervalSince1970: $0.date)))"
             )