Skip to content

Commit

Permalink
fix: minor clustering fixes (#2845)
Browse files Browse the repository at this point in the history
* fix: fixed clustering disabling of pois and favorites

* set default values for zoom levels
  • Loading branch information
davidejensen authored Nov 21, 2024
1 parent d765283 commit 7df9776
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ internal delegate IClusterMarker ClusterMarkerBuilder(

private Vector2Int decodePointer;
private bool isEnabled;
private int zoomLevel;
private float baseZoom;
private float zoom;
private int zoomLevel = 1;
private float baseZoom = 1;
private float zoom = 1;
private bool arePlacesLoaded;

public CategoryMarkersController(
Expand Down Expand Up @@ -101,7 +101,7 @@ public void ApplyCameraZoom(float baseZoom, float zoom, int zoomLevel)
this.zoom = zoom;
this.zoomLevel = zoomLevel;

if(isEnabled)
if (isEnabled)
clusterController.UpdateClusters(zoomLevel, baseZoom, zoom, markers);

foreach (ICategoryMarker marker in markers.Values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ internal delegate IFavoritesMarker FavoritesMarkerBuilder(
private readonly Dictionary<Vector2Int, IClusterableMarker> markers = new ();

private bool isEnabled;
private int zoomLevel;
private float baseZoom;
private float zoom;
private int zoomLevel = 1;
private float baseZoom = 1;
private float zoom = 1;

public FavoritesMarkerController(
IPlacesAPIService placesAPIService,
Expand Down Expand Up @@ -83,7 +83,7 @@ public void ApplyCameraZoom(float baseZoom, float zoom, int zoomLevel)
foreach (IFavoritesMarker marker in markers.Values)
marker.SetZoom(coordsUtils.ParcelSize, baseZoom, zoom);

if(isEnabled)
if (isEnabled)
clusterController.UpdateClusters(zoomLevel, baseZoom, zoom, markers);

clusterController.ApplyCameraZoom(baseZoom, zoom);
Expand Down Expand Up @@ -161,6 +161,7 @@ public UniTask Disable(CancellationToken cancellationToken)
mapCullingController.StopTracking(marker);
marker.OnBecameInvisible();
}
clusterController.Disable();

isEnabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ internal delegate ISceneOfInterestMarker SceneOfInterestMarkerBuilder(
private Vector2Int decodePointer;

private bool isEnabled;
private int zoomLevel;
private float baseZoom;
private float zoom;
private int zoomLevel = 1;
private float baseZoom = 1;
private float zoom = 1;

public ScenesOfInterestMarkersController(
IPlacesAPIService placesAPIService,
Expand Down Expand Up @@ -155,7 +155,7 @@ public void ApplyCameraZoom(float baseZoom, float zoom, int zoomLevel)
foreach (ISceneOfInterestMarker marker in markers.Values)
marker.SetZoom(coordsUtils.ParcelSize, baseZoom, zoom);

if(isEnabled)
if (isEnabled)
clusterController.UpdateClusters(zoomLevel, baseZoom, zoom, markers);

clusterController.ApplyCameraZoom(baseZoom, zoom);
Expand All @@ -176,6 +176,7 @@ public UniTask Disable(CancellationToken cancellationToken)
marker.OnBecameInvisible();
}

clusterController.Disable();
isEnabled = false;

return UniTask.CompletedTask;
Expand Down

0 comments on commit 7df9776

Please sign in to comment.