Skip to content

Commit 3c65551

Browse files
committed
click with two pointers to zoom out
1 parent 85c6856 commit 3c65551

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

maplibre/lib/src/map_state.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,20 @@ abstract class MapLibreMapState extends State<MapLibreMap>
249249
final firstEvent = _onScaleStartEvent;
250250
final secondToLastEvent = _secondToLastScaleUpdateDetails;
251251
final lastEvent = _lastScaleUpdateDetails;
252-
if (lastEvent == null || firstEvent == null || secondToLastEvent == null) {
252+
if (firstEvent == null) return;
253+
254+
// zoom out
255+
if (lastEvent == null || secondToLastEvent == null) {
256+
animateCamera(
257+
zoom: (camera.zoom - 1).clamp(options.minZoom, options.maxZoom),
258+
center: camera.center.intermediatePointTo(
259+
toLngLat(firstEvent.focalPoint),
260+
fraction: 0.2,
261+
),
262+
);
253263
return;
254264
}
265+
255266
// fling animation
256267
final velocity = details.velocity.pixelsPerSecond.distance;
257268
if (velocity >= 800) {

0 commit comments

Comments
 (0)