flame-engine / flame

A Flutter based game engine.
https://flame-engine.org
MIT License
9.23k stars 902 forks source link

Add support for trackpad gestures #2631

Open keithjohnston opened 1 year ago

keithjohnston commented 1 year ago

Problem to solve

Flutter recently added trackpad gestures: https://docs.flutter.dev/release/breaking-changes/trackpad-gestures Scrolling with two fingers on a trackpad does not work on mac osx

Proposal

This fix allows you to detect two finger scrolling See PR https://github.com/keithjohnston/flame/pull/1

More information

Example usage:

@override
 void onPointerPanZoom(PointerPanZoomUpdateInfo info) {
    cameraComponent.viewfinder.zoom = clampZoom(cameraComponent.viewfinder.zoom +
        info.scrollDelta.game.y.sign * zoomPerScrollUnit);
  }
spydon commented 1 year ago

Hi, can you please add your PR to the Flame repo instead of your clone. :)