add check in gesture detector for MacOS

This commit is contained in:
Nick Fisher
2023-09-14 09:54:18 +08:00
parent b8c418f537
commit c0421af1db

View File

@@ -92,7 +92,7 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
_scrollTimer?.cancel(); _scrollTimer?.cancel();
widget.controller.zoomBegin(); widget.controller.zoomBegin();
widget.controller widget.controller
.zoomUpdate(pointerSignal.scrollDelta.dy > 0 ? 10 : -10); .zoomUpdate(pointerSignal.scrollDelta.dy > 0 ? 1 : -1);
_scrollTimer = Timer(Duration(milliseconds: 100), () { _scrollTimer = Timer(Duration(milliseconds: 100), () {
widget.controller.zoomEnd(); widget.controller.zoomEnd();
_scrollTimer = null; _scrollTimer = null;
@@ -205,8 +205,9 @@ class _FilamentGestureDetectorState extends State<FilamentGestureDetector> {
// couldn't find any equivalent for pointerCount in Listener so we use two widgets: // couldn't find any equivalent for pointerCount in Listener so we use two widgets:
// - outer is a GestureDetector only for pinch zoom // - outer is a GestureDetector only for pinch zoom
// - inner is a Listener for all other gestures (including scroll zoom on desktop) // - inner is a Listener for all other gestures (including scroll zoom on desktop)
child: child: Platform.isLinux || Platform.isWindows || Platform.isMacOS
Platform.isLinux || Platform.isWindows ? _desktop() : _mobile()), ? _desktop()
: _mobile()),
widget.showControlOverlay widget.showControlOverlay
? Align( ? Align(
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,