diff --git a/android/build.gradle b/android/build.gradle index 58a8c74b..713d7f6e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/widgets/osm_element_layer/osm_element_layer.dart b/lib/widgets/osm_element_layer/osm_element_layer.dart index 7349cdf3..237b9495 100644 --- a/lib/widgets/osm_element_layer/osm_element_layer.dart +++ b/lib/widgets/osm_element_layer/osm_element_layer.dart @@ -35,6 +35,7 @@ class OsmElementLayer extends StatefulWidget { this.selectedElement, this.onOsmElementTap, this.durationOffsetRange = const Duration(milliseconds: 300), + // TODO: currently changes to this won't update the super cluster this.zoomLowerLimit = 16, Key? key }) : super(key: key); @@ -82,7 +83,7 @@ class _OsmElementLayerState extends State { _superCluster.modifyPointData(change.element, change.element); } else { - _superCluster.insert(change.element); + _superCluster.add(change.element); } }); } @@ -123,24 +124,16 @@ class _OsmElementLayerState extends State { } } else { - // loop over elements so that only the last one is a marker and not a placeholder - // this is required because the cluster update method changes the ordering - // which therefore affects which element is shown from the cluster. - // if we would always show the first one then it would be minimized after update since it becomes the last one - var hasNext = elements.moveNext(); - while(hasNext) { - final current = elements.current; - if (elements.moveNext()) { + // loop over elements so that only the first one is a marker and not a placeholder + if (elements.moveNext()) { + visibleMarkers.add( + _createMarker(elements.current), + ); + while(elements.moveNext()) { suppressedMarkers.add( - _createMinimizedMarker(current) + _createMinimizedMarker(elements.current) ); } - else { - visibleMarkers.add( - _createMarker(current), - ); - hasNext = false; - } } } } diff --git a/pubspec.lock b/pubspec.lock index 829f7e1a..b8af2476 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -962,10 +962,10 @@ packages: dependency: "direct main" description: name: supercluster - sha256: b956072ae2e5f9430c227a0b6a5863b261abd6eb7488411c042bd620a203aab9 + sha256: "9301624d8eee0045c3623b7d9816a51e3a392fbcde65a4c3206023ce968a8cd3" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "3.0.0" temaki_flutter: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 5d4df9cc..de634112 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,7 +24,7 @@ dependencies: latlong2: ^0.9.0 vector_math: ^2.1.4 polylabel: ^1.0.1 - supercluster: ^2.4.0 + supercluster: ^3.0.0 animated_location_indicator: git: url: https://github.com/OPENER-next/animated_location_indicator.git