changeset 76:21fa5c3ef5ad 1.1.3

Merge pull request #6 from denniscm190/lazybear-tests Lazybear tests committer: GitHub <noreply@github.com>
author Dennis C. M. <dennis@denniscm.com>
date Sat, 08 May 2021 19:15:32 +0200
parents 2b23d1f2d2d9 (current diff) b0eddc386535 (diff)
children 3d4c995845fd
files
diffstat 3 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/StockCharts/LineChart/Helpers/LinePath.swift	Sat May 08 18:07:43 2021 +0200
+++ b/Sources/StockCharts/LineChart/Helpers/LinePath.swift	Sat May 08 19:15:32 2021 +0200
@@ -15,6 +15,7 @@
     
     public func path(in rect: CGRect) -> Path {
         var path = Path()
+        var pathPoints = [CGPoint]()
         
         let normalizedData = normalize(data)
         let widthBetweenDataPoints = Double(width) / Double(normalizedData.count - 1)  // Remove first point
@@ -33,6 +34,10 @@
             pathPoints.append(path.currentPoint!)
         }
         
+        DispatchQueue.main.async {
+            self.pathPoints = pathPoints
+        }
+        
         return path
     }
     
--- a/Sources/StockCharts/LineChart/LineChartView.swift	Sat May 08 18:07:43 2021 +0200
+++ b/Sources/StockCharts/LineChart/LineChartView.swift	Sat May 08 19:15:32 2021 +0200
@@ -25,9 +25,11 @@
     
     public var body: some View {
         VStack {
-            ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition)
-                .opacity(showingIndicators ? 1: 0)
-                .padding(.vertical)
+            if dragGesture ?? true {
+                ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition)
+                    .opacity(showingIndicators ? 1: 0)
+                    .padding(.vertical)
+            }
 
             LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, showingIndicators: $showingIndicators, indexPosition: $indexPosition)
         }
Binary file StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed