Commit 2d06a627 by Dmitriy Stepanets

Finished scrolling performance optimization

parent d735d7db
......@@ -12,7 +12,7 @@
<key>OneWeatherNotificationServiceExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>51</integer>
<integer>53</integer>
</dict>
<key>PG (Playground) 1.xcscheme</key>
<dict>
......
......@@ -54,8 +54,8 @@ struct GraphLine {
tintLineShape.path = nil
}
private mutating func linePath(from points:[CGPoint]) -> UIBezierPath {
let path = UIBezierPath()
private mutating func linePath(from points:[CGPoint]) -> CGPath {
let path = CGMutablePath()
let graphRect = self.onGetGraphRect()
let startPoint = CGPoint(x: graphRect.origin.x, y: points.first?.y ?? 0)
let endPoint = CGPoint(x: graphRect.width, y: points.last?.y ?? 0)
......@@ -80,8 +80,8 @@ struct GraphLine {
p3: pointsToAdd[index]))
path.addCurve(to: pointsToAdd[index],
controlPoint1: controlPoints[index - 1].controlPoint1,
controlPoint2: controlPoints[index - 1].controlPoint2)
control1: controlPoints[index - 1].controlPoint1,
control2: controlPoints[index - 1].controlPoint2)
}
return path
......@@ -134,6 +134,7 @@ struct GraphLine {
if tintPath.isEmpty { return }
tintLineShape.path = tintPath.cgPath
tintLineShape.shadowPath = tintPath.cgPath.copy(strokingWithWidth: settings.lineWidth, lineCap: .butt, lineJoin: .bevel, miterLimit: 1)
}
func tintDotAt(point:CGPoint) {
......@@ -175,6 +176,8 @@ struct GraphLine {
}
//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 {
}
}
override func layoutSubviews() {
super.layoutSubviews()
self.layer.shadowPath = UIBezierPath(roundedRect: self.bounds, cornerRadius: 12).cgPath
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
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