Skip to content

Commit

Permalink
Fixed missing self in piechartrow
Browse files Browse the repository at this point in the history
  • Loading branch information
AppPear committed Aug 1, 2020
1 parent 6c768ad commit 4699847
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>SwiftUICharts.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>3</integer>
</dict>
</dict>
</dict>
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftUICharts/PieChart/PieChartRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public struct PieChartRow : View {
ZStack{
ForEach(0..<self.slices.count){ i in
PieChartCell(rect: geometry.frame(in: .local), startDeg: self.slices[i].startDeg, endDeg: self.slices[i].endDeg, index: i, backgroundColor: self.backgroundColor,accentColor: self.accentColor)
.scaleEffect(currentTouchedIndex == i ? 1.1 : 1)
.scaleEffect(self.currentTouchedIndex == i ? 1.1 : 1)
.animation(Animation.spring())
}
}
Expand All @@ -53,13 +53,13 @@ public struct PieChartRow : View {
let isTouchInPie = isPointInCircle(point: value.location, circleRect: rect)
if isTouchInPie {
let touchDegree = degree(for: value.location, inCircleRect: rect)
currentTouchedIndex = slices.firstIndex(where: { $0.startDeg < touchDegree && $0.endDeg > touchDegree }) ?? -1
self.currentTouchedIndex = self.slices.firstIndex(where: { $0.startDeg < touchDegree && $0.endDeg > touchDegree }) ?? -1
} else {
currentTouchedIndex = -1
self.currentTouchedIndex = -1
}
})
.onEnded({ value in
currentTouchedIndex = -1
self.currentTouchedIndex = -1
}))
}
}
Expand Down

0 comments on commit 4699847

Please sign in to comment.