@@ -143,7 +143,7 @@ abstract class MapLibreMapState extends State<MapLibreMap>
143143 }
144144
145145 void _onDoubleTapCancel () {
146- _doubleTapDownDetails = null ;
146+ debugPrint ( 'Double tap cancelled' ) ;
147147 }
148148
149149 void _stopAnimation () {
@@ -182,14 +182,29 @@ abstract class MapLibreMapState extends State<MapLibreMap>
182182 final startEvent = _onScaleStartEvent;
183183 final pointerDownEvent = _pointerDownEvent;
184184 if (startEvent == null || pointerDownEvent == null ) return ;
185+ final doubleTapDown = _doubleTapDownDetails;
185186 final lastEvent = _lastScaleUpdateDetails;
186187 _secondToLastScaleUpdateDetails = _lastScaleUpdateDetails;
187188 _lastScaleUpdateDetails = details;
188189
190+ if (doubleTapDown != null ) {
191+ // double tap drag: zoom
192+ debugPrint ('Double tap drag zoom detected $doubleTapDown ' );
193+ final lastY = lastEvent? .focalPoint.dy ?? startEvent.focalPoint.dy;
194+ final iOS = Theme .of (context).platform == TargetPlatform .iOS;
195+ var deltaY = details.focalPoint.dy - lastY;
196+ if (iOS) deltaY = - deltaY;
197+ final newZoom = camera.zoom + deltaY * 0.01 ; // sensitivity
198+ moveCamera (
199+ zoom: newZoom.clamp (options.minZoom, options.maxZoom),
200+ );
201+ return ;
202+ }
203+
189204 final ctrlPressed = HardwareKeyboard .instance.isControlPressed;
190205 final buttons = pointerDownEvent.buttons;
191206 if ((buttons & kSecondaryMouseButton) != 0 || ctrlPressed) {
192- // secondary button (right)
207+ // secondary button: pitch and bearing
193208 final lastPointerOffset = lastEvent? .focalPoint ?? startEvent.focalPoint;
194209 final delta = details.focalPoint - lastPointerOffset;
195210
@@ -199,7 +214,7 @@ abstract class MapLibreMapState extends State<MapLibreMap>
199214 zoom: camera.zoom, // TODO adjust for globe projection
200215 );
201216 } else if ((buttons & kPrimaryMouseButton) != 0 ) {
202- // primary button (left)
217+ // primary button: pan and zoom
203218
204219 // zoom
205220 final lastScale = lastEvent? .scale ?? 1.0 ;
@@ -273,6 +288,7 @@ abstract class MapLibreMapState extends State<MapLibreMap>
273288 _onScaleStartEvent = null ;
274289 _lastScaleUpdateDetails = null ;
275290 _secondToLastScaleUpdateDetails = null ;
291+ _doubleTapDownDetails = null ;
276292 }
277293}
278294
0 commit comments