Commit 3b733415 by Dmitry Stepanets

IOS-210: Fix the temperature forecast widget (Blinking)

parent 1d41afe7
......@@ -84,6 +84,11 @@
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "CG_NUMERICS_SHOW_BACKTRACE"
value = ""
isEnabled = "NO">
</EnvironmentVariable>
<EnvironmentVariable
key = "_XCWidgetDefaultView"
value = "timeline"
isEnabled = "NO">
......
......@@ -33,7 +33,7 @@ struct HourlyTemperatureView: View {
}
)
if hourlyWeather.count >= 2 {
if hourlyWeather.count >= 2 && hourlyStackFrame.width > 0 && hourlyStackFrame.height > 55 {
TemperatureGraphView(hourlyWeather: hourlyWeather,
viewModel: .init(graphSize: .init(width: hourlyStackFrame.width,
height: hourlyStackFrame.height - 55),
......
......@@ -121,7 +121,10 @@ struct TemperatureGraphView: View {
let diff = maxTemp - minTemp
for index in 0..<hourlyWeather.count {
let multiply = CGFloat(maxTemp - hourlyWeather[index].temp) / CGFloat(diff)
var multiply: CGFloat = 0.5
if diff > 0 {
multiply = CGFloat(maxTemp - hourlyWeather[index].temp) / CGFloat(diff)
}
let space:CGFloat = index > 0 && index <= 3 ? graphViewModel.spacingPerItem : 0
if index == 0 {
......@@ -136,6 +139,8 @@ struct TemperatureGraphView: View {
}
private mutating func prepareSectionsAndLinePath() {
print("[DEBUG] graphInset: \(graphViewModel.graphInset) graphSize: \(graphViewModel.graphSize)")
let startPoint = CGPoint(x: graphViewModel.graphInset.leading, y: points.first?.y ?? 0)
let endPoint = CGPoint(x: graphViewModel.graphSize.width, y: points.last?.y ?? 0)
......
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