Update: 2026-06-26 04:04:03

This commit is contained in:
Hamza-Ayed
2026-06-26 04:04:04 +03:00
parent aea0c8e44e
commit da9e6eb981
10 changed files with 325 additions and 112 deletions

View File

@@ -482,7 +482,19 @@ class LocationSearchController extends GetxController {
bool _pendingGeocode = true;
void updateCurrentLocationFromCamera(LatLng target) {
Log.print('📍 updateCurrentLocationFromCamera: $target');
// ✅ FIX P3: Guard — تجاهل التحديثات إذا كانت المسافة < 20 متر
final double distanceDelta = Geolocator.distanceBetween(
newMyLocation.latitude,
newMyLocation.longitude,
target.latitude,
target.longitude,
);
if (distanceDelta < 20.0) {
Log.print('📍 updateCurrentLocationFromCamera: Skipped (المسافة ${distanceDelta.toStringAsFixed(1)}م < 20م)');
return;
}
Log.print('📍 updateCurrentLocationFromCamera: $target (تغيير ${distanceDelta.toStringAsFixed(1)}م)');
newMyLocation = target;
if (_pendingGeocode) {
@@ -522,7 +534,16 @@ class LocationSearchController extends GetxController {
void onCameraMoveThrottled(CameraPosition pos) {
_camThrottle?.cancel();
_camThrottle = Timer(const Duration(milliseconds: 160), () {
Log.print('📸 onCameraMoveThrottled: ${pos.target}');
// ✅ FIX P3: Guard — تجاهل التحديث إذا كان التغيير ضئيلاً (< 20م)
final double distanceDelta = Geolocator.distanceBetween(
newMyLocation.latitude,
newMyLocation.longitude,
pos.target.latitude,
pos.target.longitude,
);
if (distanceDelta < 20.0) return;
Log.print('📸 onCameraMoveThrottled: ${pos.target} (تغيير ${distanceDelta.toStringAsFixed(1)}م)');
int waypointsLength = Get.find<WayPointController>().wayPoints.length;
int index = wayPointIndex;
if (waypointsLength > 0 && index < placesCoordinate.length) {