mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
When the user drags the elevation chart it runs chart's `selected point` update mechanism by calling the `onSelectedPointChanged` inside the `ChartView`'s ` func chartPreviewView(_ view: ChartPreviewView, didChangeMinX minX: Int, maxX: Int)`. This updates may be quite often (tens/hundreds per sec) and may cause the `on point update` callback **recursion** and overloads the `layoutSubviews` method on the _short track_ because the ChartView doesnt have mechanism to skip excessive updates when the parameters the same. This situation produces fail with internal error `(null) in -[NSISEngine _flushPendingRemovals] ().` The fix include: 1. skip updates when the current point isn't changed 2. remove layoutSubviews overloading (this method should recalc the layout immediately and should not be called too frequent, the `setNeedsLayout` allows to batch the layout updates and redraw the view on the next runtime cycle) Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>