Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Mac zoom Support? #4

Open
KunalKshatriya opened this issue Sep 29, 2023 · 2 comments
Open

Mac zoom Support? #4

KunalKshatriya opened this issue Sep 29, 2023 · 2 comments

Comments

@KunalKshatriya
Copy link

The pan and zoom doesnt work for Mac, I fixed zoom by creating the PlatformTouchEffect for Mac (used the same file as that of iOS).

To make zoom work,

  1. I added the following to the PlotController.cs,
    #if MACCATALYST
    this.BindMouseWheel(OxyPlot.PlotCommands.ZoomWheel);
    this.BindMouseWheel(OxyModifierKeys.Control, OxyPlot.PlotCommands.ZoomWheelFine);
    #endif

  2. added the Pan gesture recognizer, and raised the onTouchAction

                 CGPoint delta = panGestureRecognizer.TranslationInView(view);
                 CGPoint point =  panGestureRecognizer.LocationInView(view);
                 var touchArgs = new TouchActionEventArgs(1,
                    TouchActionType.MouseWheel,
                    new Point[] { new(point.X, point.Y) },
                    true)
                 {
                     ModifierKeys = OxyModifierKeys.None
                 };
                 touchArgs.MouseWheelDelta = (int)((1000 + delta.Y) / 1000);
                 onTouchAction(Element, touchArgs);
    

However, it didn't work. Is there something I am missing?

@iniceice88
Copy link
Owner

I don't think the iOS version of the PlatformTouchEffect will work on macOS because iPhones don't handle mouse-related events. For reference, you can take a look at the Xamarin version of the macOS PlatformTouchEffect implementation:PlatformTouchEffect ,and don't forget to add the mouse wheel event.

@KunalKshatriya
Copy link
Author

Thanks for the response, I will take a look at it. With the current code (which I provided in the question) does get me the mouse wheel events. However forwarding it to onTouchAction, doesnt seem to do anything.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants