-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Secondary ButtonMask #9589
Secondary ButtonMask #9589
Conversation
} | ||
|
||
/// <include file="../../docs/Microsoft.Maui.Controls/ClickGestureRecognizer.xml" path="Type[@FullName='Microsoft.Maui.Controls.ClickGestureRecognizer']/Docs" /> | ||
public sealed class ClickGestureRecognizer : GestureRecognizer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was only wired up to GTK
and macOS
in XF. Currently in .NET MAUI this gesture does nothing anywhere. I think just condensing down into the TapGestureRecognizer
here makes the most sense.
f52c024
to
cfc17c5
Compare
@@ -563,5 +599,51 @@ void OnElementChanged(object sender, VisualElementChangedEventArgs e) | |||
} | |||
} | |||
} | |||
|
|||
ButtonsMask AddFakeRightClickForMacCatalyst(IGestureRecognizer recognizer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most the changes in this file are organizational. There seemed to be a lot of duplicated code added to process spans. I needed that same code generalized so I could use it from a UIContextMenu
.
The code here is the main code required to make right click fire an event on catalyst.
// it only works when you have a mouse connected to an iPad | ||
// so we just ignore setting the mask if the user is running catalyst | ||
// right click is handled by adding a UIContextMenu interaction | ||
if (OperatingSystem.IsIOSVersionAtLeast(13, 4) && !OperatingSystem.IsMacCatalyst()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the other functional addition to the code. Most of the other changes in this file are organizational
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, a few small things.
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
|
||
internal void SendTapped(View sender) | ||
internal void SendTapped(View sender, Func<IElement?, Point?>? getPosition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can getPosition
default to null
and reduce the noise of all the SendTapped(..., null)
calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Also @rookiejava FYI if you want to extend your usages of "SendTapped" to provide location data.
|
||
bool CheckButtonMask(TapGestureRecognizer tapGestureRecognizer, MotionEvent? motionEvent) | ||
{ | ||
if (tapGestureRecognizer.Buttons == ButtonsMask.Secondary) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set { SetValue(ButtonsProperty, value); } | ||
} | ||
|
||
public event EventHandler<TappedEventArgs>? Tapped; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So @PureWeen was this meant to be a breaking change hosing any .NET 6 components?
Description of Change
This adds
ButtonMask
toTapGestureRecognizer
which allows users to indicate if they wantsecondary
and/orprimary
to trigger the gesture.ClickGestureRecognizer
. This wasn't hooked up to anything in .NET MAUI so we're not removing any behavior by deleting this recognizer. It seems a bit excessive and confusing to have a separate recognizer here. Once we get to a point where a user will need to determinate the type of device triggering aTap
we can just add anenum
or similar.Status
API Changes
Maui.Controls
Issues Fixed
Fixes #9140