diff options
| -rw-r--r-- | lib/RoutingExample.dart | 20 | ||||
| -rw-r--r-- | lib/config/defaults.dart | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/RoutingExample.dart b/lib/RoutingExample.dart index 8aabb32..7f4444f 100644 --- a/lib/RoutingExample.dart +++ b/lib/RoutingExample.dart @@ -259,12 +259,15 @@ class RoutingExample { } // if address is double planned and there is a stop before this one. - bool shouldShowPinOnMap(DestinationPin taskToCheck) { - for (int i = _parcelNumberPins.length - 1; i >= 0; i--) { + bool shouldDoublePlannedAddressBeVisible(DestinationPin taskToCheck) { + if (!taskToCheck.isDoublePlannedAddress) return true; + for (int i = routeSectionCursor; i < _parcelNumberPins.length; i++) { var item = _parcelNumberPins[i]; - if (!item.isDoublePlannedAddress) continue; - if (item == taskToCheck) return true; - if (item.coords == taskToCheck.coords && item == taskToCheck) { + + if (item == taskToCheck) { + return true; // first one of the double planned addresses is visible. + } + if (item.coords == taskToCheck.coords) { return false; } } @@ -446,7 +449,6 @@ class RoutingExample { void updateHighlightedRouteSections({bool force = false}) { int maxPins = 300; - print('cursor ' + routeSectionCursor.toString()); for (int i = _parcelNumberPins.length - 1; i >= 0; i--) { DestinationPin pin = _parcelNumberPins.elementAt(i); @@ -461,6 +463,12 @@ class RoutingExample { bool forceUpdateThisPin = force && (i > routeSectionCursor - 3 && i < routeSectionCursor + 3); + if (!shouldDoublePlannedAddressBeVisible(pin)) { + pin.pin?.unpin(); + pin.pin = null; + continue; + } + if (i > routeSectionCursor + 1 && i < routeSectionCursor + maxPins) { if (forceUpdateThisPin) { pin.pin?.unpin(); diff --git a/lib/config/defaults.dart b/lib/config/defaults.dart index f629861..71e457e 100644 --- a/lib/config/defaults.dart +++ b/lib/config/defaults.dart @@ -1,4 +1,4 @@ -String program_version = '0.12 [08/02/2023]'; +String program_version = '0.13 [10/04/2023]'; bool debug_mode = false; class ShiftType { |
