Skip to content

Commit

Permalink
fix issue with map rotation in raster mode
Browse files Browse the repository at this point in the history
avoid double-rotating raster map layer

fixes #188
  • Loading branch information
greensopinion committed Dec 9, 2023
1 parent e63982a commit 23bcd47
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 7.0.1

* fix [issue 188](https://github.com/greensopinion/flutter-vector-map-tiles/issues/188) where raster mode map would be rotated incorrectly

## 7.0.0

* update `flutter_map` dependency to 6.1.0
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ packages:
path: ".."
relative: true
source: path
version: "6.0.2"
version: "7.0.0"
vector_math:
dependency: transitive
description:
Expand Down
66 changes: 32 additions & 34 deletions lib/src/grid/grid_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ class _VectorTileCompositeLayerState extends State<VectorTileCompositeLayer>
Widget build(BuildContext context) {
final options = widget.options;
final backgroundTheme = options.backgroundTheme;
final layers = <Widget>[];
if (options.layerMode == VectorTileLayerMode.raster) {
final maxZoom = options.maximumZoom ?? 18;

Expand All @@ -138,52 +137,51 @@ class _VectorTileCompositeLayerState extends State<VectorTileCompositeLayer>
options.tileDelay,
options.concurrency);
_tileProvider = tileProvider;
layers.add(TileLayer(
return TileLayer(
key: Key("${theme.id}_v${theme.version}_VectorTileLayer"),
maxZoom: maxZoom,
maxNativeZoom: maxZoom.ceil(),
evictErrorTileStrategy: EvictErrorTileStrategy.notVisible,
tileProvider: tileProvider));
tileProvider: tileProvider);
}
if (options.layerMode == VectorTileLayerMode.vector) {
layers.add(_VectorTileLayer(
Key("${theme.id}_v${theme.version}_VectorTileLayer"),
_LayerOptions(theme,
final layers = <Widget>[];
if (backgroundTheme != null) {
final background = _VectorTileLayer(
Key(
"${backgroundTheme.id}_v${theme.version}_background_VectorTileLayer"),
_LayerOptions(backgroundTheme,
caches: _caches,
symbolTheme: symbolTheme,
sprites: options.sprites,
showTileDebugInfo: options.showTileDebugInfo,
paintBackground: backgroundTheme == null,
maxSubstitutionDifference:
options.maximumTileSubstitutionDifference,
paintNoDataTiles: false,
paintBackground: true,
maxSubstitutionDifference: 0,
paintNoDataTiles: true,
tileOffset: widget.options.tileOffset,
tileZoomSubstitutionOffset: 0,
tileZoomSubstitutionOffset: 4,
mapZoom: _zoom,
rotation: _rotation),
widget.mapCamera,
_mapChanged.stream,
_tileSupplier));
if (backgroundTheme != null) {
final background = _VectorTileLayer(
Key(
"${backgroundTheme.id}_v${theme.version}_background_VectorTileLayer"),
_LayerOptions(backgroundTheme,
caches: _caches,
showTileDebugInfo: options.showTileDebugInfo,
paintBackground: true,
maxSubstitutionDifference: 0,
paintNoDataTiles: true,
tileOffset: widget.options.tileOffset,
tileZoomSubstitutionOffset: 4,
mapZoom: _zoom,
rotation: _rotation),
widget.mapCamera,
_mapChanged.stream,
_tileSupplier);
layers.insert(0, background);
}
_tileSupplier);
layers.add(background);
}
layers.add(_VectorTileLayer(
Key("${theme.id}_v${theme.version}_VectorTileLayer"),
_LayerOptions(theme,
caches: _caches,
symbolTheme: symbolTheme,
sprites: options.sprites,
showTileDebugInfo: options.showTileDebugInfo,
paintBackground: backgroundTheme == null,
maxSubstitutionDifference:
options.maximumTileSubstitutionDifference,
paintNoDataTiles: false,
tileOffset: widget.options.tileOffset,
tileZoomSubstitutionOffset: 0,
mapZoom: _zoom,
rotation: _rotation),
widget.mapCamera,
_mapChanged.stream,
_tileSupplier));
return MobileLayerTransformer(child: Stack(children: layers));
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: vector_map_tiles
description: A plugin for `flutter_map` that enables the use of vector tiles.
version: 7.0.0
version: 7.0.1
homepage: https://github.com/greensopinion/flutter-vector-map-tiles

environment:
Expand Down

0 comments on commit 23bcd47

Please sign in to comment.