Ivan Valkou 5 лет назад
Родитель
Сommit
d2091f8eee

+ 16 - 6
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -42,6 +42,7 @@ struct MainChartView: View {
     @Binding var basalProfile: [BasalProfileEntry]
     @Binding var tempTargets: [TempTarget]
     @Binding var carbs: [CarbsEntry]
+    @Binding var timerDate: Date
     let units: GlucoseUnits
 
     @State var didAppearTrigger = false
@@ -196,16 +197,25 @@ struct MainChartView: View {
     }
 
     private func xGridView(fullSize: CGSize) -> some View {
-        Path { path in
-            for hour in 0 ..< hours + hours {
-                let x = firstHourPosition(viewWidth: fullSize.width) +
-                    oneSecondStep(viewWidth: fullSize.width) *
-                    CGFloat(hour) * CGFloat(1.hours.timeInterval)
+        ZStack {
+            Path { path in
+                for hour in 0 ..< hours + hours {
+                    let x = firstHourPosition(viewWidth: fullSize.width) +
+                        oneSecondStep(viewWidth: fullSize.width) *
+                        CGFloat(hour) * CGFloat(1.hours.timeInterval)
+                    path.move(to: CGPoint(x: x, y: 0))
+                    path.addLine(to: CGPoint(x: x, y: fullSize.height - 20))
+                }
+            }
+            .stroke(Color.secondary, lineWidth: 0.2)
+
+            Path { path in
+                let x = timeToXCoordinate(timerDate.timeIntervalSince1970, fullSize: fullSize)
                 path.move(to: CGPoint(x: x, y: 0))
                 path.addLine(to: CGPoint(x: x, y: fullSize.height - 20))
             }
+            .stroke(Color.secondary, style: StrokeStyle(lineWidth: 0.2, dash: [5]))
         }
-        .stroke(Color.secondary, lineWidth: 0.2)
     }
 
     private func timeLabelsView(fullSize: CGSize) -> some View {

+ 1 - 0
FreeAPS/Sources/Modules/Home/View/HomeRootView.swift

@@ -175,6 +175,7 @@ extension Home {
                         basalProfile: $viewModel.basalProfile,
                         tempTargets: $viewModel.tempTargets,
                         carbs: $viewModel.carbs,
+                        timerDate: $viewModel.timerDate,
                         units: viewModel.units
                     )
                     .padding(.bottom)