Files
comaps/iphone/Maps/UI/PlacePage/Components/ElevationProfile/ElevationProfileBuilder.swift
Kiryl Kaveryn aec82794ac [ios] Fix track selection point updates on every new selection
On the every new tap on the `Track` or during the `Elevation chart` dragging, the track `Active point` will be updated now. It allows to keep the current selected track point coordinates up to date and fix the bug when the `route to/route from` buttons use only the initial coordinates.
Key changes:
1. the `Active point` and `My position` points are moved from the `Elevation profile` to the `PlacePageTrackData` because this properties are related to the whole track. Not only chart. The chart is only one of the consumers of this data updates.
2. The subscription to the active point updates is moved from the `Elevation profile` to the `PlacePagePresenter`. The reason - see 1.
2. The callback `onActivePointChanged` is added to notify that the active point is updated
3. When the callback is triggered the `PlacePageTrackData` fetches the new coordinates from the core and saves it. This coordinates are used by the `route to/from` buttons.

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
2025-07-04 11:42:44 +02:00

14 lines
540 B
Swift

import CoreApi
class ElevationProfileBuilder {
static func build(trackData: PlacePageTrackData,
delegate: ElevationProfileViewControllerDelegate?) -> ElevationProfileViewController {
let viewController = ElevationProfileViewController();
let presenter = ElevationProfilePresenter(view: viewController,
trackData: trackData,
delegate: delegate)
viewController.presenter = presenter
return viewController
}
}