File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed
Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,17 @@ class TileCoordinates extends Point<int> {
6161/// simplify the tile coordinates: we just return the same value.
6262class TileCoordinatesResolver {
6363 /// Resolves coordinates in the context of world replications.
64- const TileCoordinatesResolver (this .replicatesWorldLongitude);
64+ const TileCoordinatesResolver (
65+ this .replicatesWorldLongitude, {
66+ this .zoomOffset = 0 ,
67+ });
6568
6669 /// True if we simplify the coordinates according to the world replications.
6770 final bool replicatesWorldLongitude;
6871
72+ /// The zoom number used for modulus will be offset with this value.
73+ final int zoomOffset;
74+
6975 /// Returns the simplification of the coordinates.
7076 TileCoordinates get (TileCoordinates positionCoordinates) {
7177 if (! replicatesWorldLongitude) {
@@ -74,7 +80,7 @@ class TileCoordinatesResolver {
7480 if (positionCoordinates.z < 0 ) {
7581 return positionCoordinates;
7682 }
77- final modulo = 1 << positionCoordinates.z;
83+ final modulo = 1 << ( positionCoordinates.z + zoomOffset) ;
7884 int x = positionCoordinates.x;
7985 while (x < 0 ) {
8086 x += modulo;
Original file line number Diff line number Diff line change @@ -30,11 +30,17 @@ class TileImageManager {
3030 TileCoordinatesResolver _resolver = const TileCoordinatesResolver (false );
3131
3232 /// Sets if we replicate the world longitude in several worlds.
33- void setReplicatesWorldLongitude (bool replicatesWorldLongitude) {
34- if (_resolver.replicatesWorldLongitude == replicatesWorldLongitude) {
35- return ;
33+ void setReplicatesWorldLongitude (
34+ bool replicatesWorldLongitude,
35+ int zoomOffset,
36+ ) {
37+ if (_resolver.replicatesWorldLongitude != replicatesWorldLongitude ||
38+ _resolver.zoomOffset != zoomOffset) {
39+ _resolver = TileCoordinatesResolver (
40+ replicatesWorldLongitude,
41+ zoomOffset: zoomOffset,
42+ );
3643 }
37- _resolver = TileCoordinatesResolver (replicatesWorldLongitude);
3844 }
3945
4046 /// Filter tiles to only tiles that would be visible on screen. Specifically:
Original file line number Diff line number Diff line change @@ -384,6 +384,7 @@ class _TileLayerState extends State<TileLayer> with TickerProviderStateMixin {
384384
385385 _tileImageManager.setReplicatesWorldLongitude (
386386 camera.crs.replicatesWorldLongitude,
387+ widget.zoomOffset.round (),
387388 );
388389
389390 if (_mapControllerHashCode != mapController.hashCode) {
You can’t perform that action at this time.
0 commit comments