Skip to content

Commit

Permalink
Update supercluster dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbendebiene committed Aug 9, 2023
1 parent f7e553b commit 17abe52
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
25 changes: 9 additions & 16 deletions lib/widgets/osm_element_layer/osm_element_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -82,7 +83,7 @@ class _OsmElementLayerState extends State<OsmElementLayer> {
_superCluster.modifyPointData(change.element, change.element);
}
else {
_superCluster.insert(change.element);
_superCluster.add(change.element);
}
});
}
Expand Down Expand Up @@ -123,24 +124,16 @@ class _OsmElementLayerState extends State<OsmElementLayer> {
}
}
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;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 17abe52

Please sign in to comment.