Commit 2d06a627 by Dmitriy Stepanets

Finished scrolling performance optimization

parent d735d7db
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key> <key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>51</integer> <integer>53</integer>
</dict> </dict>
<key>PG (Playground) 1.xcscheme</key> <key>PG (Playground) 1.xcscheme</key>
<dict> <dict>
......
...@@ -54,8 +54,8 @@ struct GraphLine { ...@@ -54,8 +54,8 @@ struct GraphLine {
tintLineShape.path = nil tintLineShape.path = nil
} }
private mutating func linePath(from points:[CGPoint]) -> UIBezierPath { private mutating func linePath(from points:[CGPoint]) -> CGPath {
let path = UIBezierPath() let path = CGMutablePath()
let graphRect = self.onGetGraphRect() let graphRect = self.onGetGraphRect()
let startPoint = CGPoint(x: graphRect.origin.x, y: points.first?.y ?? 0) let startPoint = CGPoint(x: graphRect.origin.x, y: points.first?.y ?? 0)
let endPoint = CGPoint(x: graphRect.width, y: points.last?.y ?? 0) let endPoint = CGPoint(x: graphRect.width, y: points.last?.y ?? 0)
...@@ -80,8 +80,8 @@ struct GraphLine { ...@@ -80,8 +80,8 @@ struct GraphLine {
p3: pointsToAdd[index])) p3: pointsToAdd[index]))
path.addCurve(to: pointsToAdd[index], path.addCurve(to: pointsToAdd[index],
controlPoint1: controlPoints[index - 1].controlPoint1, control1: controlPoints[index - 1].controlPoint1,
controlPoint2: controlPoints[index - 1].controlPoint2) control2: controlPoints[index - 1].controlPoint2)
} }
return path return path
...@@ -134,6 +134,7 @@ struct GraphLine { ...@@ -134,6 +134,7 @@ struct GraphLine {
if tintPath.isEmpty { return } if tintPath.isEmpty { return }
tintLineShape.path = tintPath.cgPath tintLineShape.path = tintPath.cgPath
tintLineShape.shadowPath = tintPath.cgPath.copy(strokingWithWidth: settings.lineWidth, lineCap: .butt, lineJoin: .bevel, miterLimit: 1)
} }
func tintDotAt(point:CGPoint) { func tintDotAt(point:CGPoint) {
...@@ -175,6 +176,8 @@ struct GraphLine { ...@@ -175,6 +176,8 @@ struct GraphLine {
} }
//Refresh line path //Refresh line path
lineShape.path = self.linePath(from: points).cgPath let linePath = self.linePath(from: points)
lineShape.path = linePath
lineShape.shadowPath = linePath.copy(strokingWithWidth: settings.lineWidth, lineCap: .butt, lineJoin: .bevel, miterLimit: 1)
} }
} }
...@@ -56,6 +56,11 @@ class PrecipButton: UIControl { ...@@ -56,6 +56,11 @@ class PrecipButton: UIControl {
} }
} }
override func layoutSubviews() {
super.layoutSubviews()
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: 12).cgPath
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
updateUI() updateUI()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment