Skip to content

Commit 9641daa

Browse files
authored
Merge branch 'master' into fix/fling-rebound
2 parents 1424418 + 8be2db8 commit 9641daa

6 files changed

Lines changed: 59 additions & 7 deletions

File tree

‎.github/workflows/branch.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
run: flutter build apk --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
9595
- name: Archive Artifact
9696
if: ${{ matrix.sdk == '' }}
97-
uses: actions/upload-artifact@v5
97+
uses: actions/upload-artifact@v6
9898
with:
9999
name: apk-build
100100
path: example/build/app/outputs/apk/release
@@ -129,7 +129,7 @@ jobs:
129129
working-directory: .
130130
- name: Archive Artifact
131131
if: ${{ matrix.sdk == '' }}
132-
uses: actions/upload-artifact@v5
132+
uses: actions/upload-artifact@v6
133133
with:
134134
name: exe-build
135135
path: windowsTemp/WindowsApplication.exe
@@ -156,7 +156,7 @@ jobs:
156156
- name: Build Web Application
157157
run: flutter build web --wasm --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
158158
- name: Archive Artifact
159-
uses: actions/upload-artifact@v5
159+
uses: actions/upload-artifact@v6
160160
if: ${{ matrix.sdk == '' }}
161161
with:
162162
name: web-build

‎.github/workflows/master.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Build Android Application
5454
run: flutter build apk --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
5555
- name: Archive Artifact
56-
uses: actions/upload-artifact@v5
56+
uses: actions/upload-artifact@v6
5757
with:
5858
name: apk-build
5959
path: example/build/app/outputs/apk/release
@@ -82,7 +82,7 @@ jobs:
8282
run: iscc "windowsApplicationInstallerSetup.iss"
8383
working-directory: .
8484
- name: Archive Artifact
85-
uses: actions/upload-artifact@v5
85+
uses: actions/upload-artifact@v6
8686
with:
8787
name: exe-build
8888
path: windowsTemp/WindowsApplication.exe
@@ -107,7 +107,7 @@ jobs:
107107
- name: Build Web Application
108108
run: flutter build web --wasm --dart-define=COMMIT_SHA=${{ github.sha }} --dart-define=flutter.flutter_map.unblockOSM="${{ secrets.UNBLOCK_OSM }}"
109109
- name: Archive Artifact
110-
uses: actions/upload-artifact@v5
110+
uses: actions/upload-artifact@v6
111111
with:
112112
name: web-build
113113
path: example/build/web

‎lib/src/gestures/map_interactive_viewer.dart‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ class MapInteractiveViewerState extends State<MapInteractiveViewer>
421421
}
422422

423423
void _onPointerMove(PointerMoveEvent event) {
424+
if (_options.onPointerMove != null) {
425+
final latLng = _camera.offsetToCrs(event.localPosition);
426+
_options.onPointerMove!(event, latLng);
427+
}
424428
if (!_ckrTriggered.value) return;
425429

426430
final baseSetNorth =

‎lib/src/layer/tile_layer/tile_image_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ final class TileImageView {
183183
}
184184

185185
if (z + 1 < maxZoom) {
186-
_retainChildren(retain, i, j, z + 1, maxZoom);
186+
_retainChildren(retain, 2 * x + i, 2 * y + j, z + 1, maxZoom);
187187
}
188188
}
189189
}

‎lib/src/map/options/options.dart‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ typedef PointerHoverCallback = void Function(
4040
LatLng point,
4141
);
4242

43+
/// Callback to notify when the map registers a pointer move event.
44+
typedef PointerMoveCallback = void Function(
45+
PointerMoveEvent event,
46+
LatLng point,
47+
);
48+
4349
/// Callback that gets called when the viewport of the map changes.
4450
///
4551
/// {@macro map_position.has_gesture}
@@ -109,6 +115,16 @@ class MapOptions {
109115
/// down (e.g. mouse pointers, but not most touch pointers)
110116
final PointerHoverCallback? onPointerHover;
111117

118+
/// Called when a pointer is down and moves.
119+
///
120+
/// If used while dragging the map, this may emit the same point as by
121+
/// [onPositionChanged], but might not due to map pixel snapping or a slight
122+
/// delay, or any other disconnect between the pointer and map camera.
123+
///
124+
/// Prefer using [onPositionChanged], unless this is specifically required,
125+
/// such as obtaining the pointer position while the map camera is 'locked'.
126+
final PointerMoveCallback? onPointerMove;
127+
112128
/// This callback fires when the [MapCamera] data has changed. This gets
113129
/// called if the zoom level, or map center changes.
114130
final PositionCallback? onPositionChanged;
@@ -158,6 +174,7 @@ class MapOptions {
158174
this.onPointerUp,
159175
this.onPointerCancel,
160176
this.onPointerHover,
177+
this.onPointerMove,
161178
this.onPositionChanged,
162179
this.onMapEvent,
163180
this.onMapReady,

‎test/layer/tile_layer/tile_image_view_test.dart‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,37 @@ void main() {
138138
}
139139
});
140140

141+
group('renderTiles', () {
142+
test('%.retainChildren uses correct coordinates for z+2 fallback', () {
143+
// This test verifies that _retainChildren correctly calculates
144+
// descendant coordinates when recursing to z+2 level.
145+
// Using large coordinates (100, 200) to catch the bug where
146+
// i,j (0-1) was passed instead of 2*x+i, 2*y+j.
147+
const baseZoom = 10;
148+
final tileImages = tileImagesMappingFrom([
149+
// z=10 tile not ready
150+
MockTileImage(100, 200, baseZoom,
151+
loadFinished: false, readyToDisplay: false),
152+
// z=11 tiles don't exist
153+
// z=12 tile exists and is ready (this is what we want to fall back to)
154+
MockTileImage(400, 800, baseZoom + 2),
155+
]);
156+
157+
final tileImageView = TileImageView(
158+
tileImages: tileImages,
159+
positionCoordinates: Set<TileCoordinates>.from(tileImages.keys),
160+
visibleRange: discreteTileRange(100, 200, 100, 200, zoom: baseZoom),
161+
keepRange: discreteTileRange(100, 200, 100, 200, zoom: baseZoom),
162+
);
163+
164+
final renderTiles = tileImageView.renderTiles.toList();
165+
expect(
166+
renderTiles,
167+
contains(const TileCoordinates(400, 800, baseZoom + 2)),
168+
);
169+
});
170+
});
171+
141172
test('errorTilesNotVisible', () {
142173
const zoom = 10;
143174
final tileImages = tileImagesMappingFrom([

0 commit comments

Comments
 (0)