[ios] Skip zoom/pinch gesture when the lower/upper is out of bounds

The previous check `if upper - lower < chartData.labels.count / 10 return` produces invalid state for drawing and fails when the upper == lower.

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn
2025-07-29 20:52:38 +04:00
committed by Yannik Bloscheck
parent ef2dea20fe
commit 38406b149a

View File

@@ -244,10 +244,10 @@ public class ChartView: UIView {
let lower = max(pinchStartLower + dx, 0)
let upper = min(pinchStartUpper - dx, chartData.labels.count - 1)
if upper - lower < chartData.labels.count / 10 {
guard upper - lower > max(1, chartData.labels.count / 10) else {
return
}
chartPreviewView.setX(min: lower, max: upper)
xAxisView.setBounds(lower: lower, upper: upper)
updateCharts(animationStyle: .none)