修复位置上报解析并立即居中到用户位置

This commit is contained in:
2026-07-07 12:01:46 +08:00
parent 8a4a30111c
commit 90ba28e61f
4 changed files with 80 additions and 3 deletions

View File

@ -82,8 +82,8 @@ final class LocationReportViewController: BaseViewController {
mapControls.onZoomIn = { [weak self] in self?.mapContainer.zoomIn() }
mapControls.onZoomOut = { [weak self] in self?.mapContainer.zoomOut() }
mapControls.onRelocate = { [weak self] in
self?.viewModel.startLocation()
self?.mapContainer.centerOnUserLocation()
self?.viewModel.startLocation()
}
mapContainer.onMapTap = { [weak self] coordinate in
self?.viewModel.setMarkerLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)
@ -105,6 +105,7 @@ final class LocationReportViewController: BaseViewController {
onlineButton.addTarget(self, action: #selector(onlineTapped), for: .touchUpInside)
viewModel.restoreStateIfNeeded()
mapContainer.enableInitialUserLocationCentering()
requestLocationIfNeeded()
applyViewModel()
}
@ -113,6 +114,7 @@ final class LocationReportViewController: BaseViewController {
Task {
do {
try await LocationProvider.shared.ensureLocationPermission()
mapContainer.enableInitialUserLocationCentering()
viewModel.startLocation()
} catch {
showToast((error as? LocalizedError)?.errorDescription ?? error.localizedDescription)