Skip to content

Commit

Permalink
Implement == and hashCode in MapCamera
Browse files Browse the repository at this point in the history
This will ensure assertions like the one described in [this issue](fleaflet#1613)
work as intended.
  • Loading branch information
jjoelson committed Aug 14, 2023
1 parent 771d4c2 commit 0ee39be
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/src/map/camera/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,19 @@ class MapCamera {
final newCenter = unproject(mapCenter + newOffset);
return newCenter;
}

@override
int get hashCode => Object.hash(
crs, minZoom, maxZoom, center, zoom, rotation, nonRotatedSize);

@override
bool operator ==(Object other) =>
other is MapCamera &&
other.crs == crs &&
other.minZoom == minZoom &&
other.maxZoom == maxZoom &&
other.center == center &&
other.zoom == zoom &&
other.rotation == rotation &&
other.nonRotatedSize == nonRotatedSize;
}

0 comments on commit 0ee39be

Please sign in to comment.