-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Implement PointerGestureRecognizer #9592
Conversation
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.
Some minor code things mainly :)
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
src/Controls/src/Core/Platform/GestureManager/GestureManager.Windows.cs
Outdated
Show resolved
Hide resolved
be9a12f
to
467a2fa
Compare
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.
API seems fine and it works. just little comments on code style but shouldn't block the merge.
- Needs public api file changes
- Maybe add some xml doc comments
Good stuff Rachel
InitializeComponent(); | ||
} | ||
|
||
private void HoverBegan(object sender, PointerEventArgs e) |
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.
just little thing we don't use the "private" keyword because it's the default
} | ||
} | ||
|
||
Point? GetPosition(IElement? relativeTo, RoutedEventArgs e) |
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.
Is there a reason why there wouldn't be a Position?
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.
We're using Point from Maui.Graphics - to my knowledge, there's no Position there
ccing @PureWeen who implemented GetPosition in his other PR
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.
If the user passes an invalid element
The other option here would be to throw an exception
internal void SendPointerMoved(View sender, Func<IElement?, Point?>? getPosition) | ||
{ | ||
ICommand cmd = PointerMovedCommand; | ||
if (cmd != null && cmd.CanExecute(PointerMovedCommandParameter)) |
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.
if (cmd != null && cmd.CanExecute(PointerMovedCommandParameter)) | |
if (cmd?.CanExecute(PointerMovedCommandParameter)) |
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.
Intellisense tells me this won't work since it can't implicitly convert type bool? to bool, so I'll leave this one as is for now.
Alternatively, I can cast it as a bool, but I prefer to leave it as is. Let me know what you think!
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.
you can do it like this
cmd?.CanExecute(PointerMovedCommandParameter) == true
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.
ahh of course, fixed!
cmd.Execute(PointerMovedCommandParameter); | ||
|
||
EventHandler<PointerEventArgs>? handler = PointerMoved; | ||
if (handler != null) |
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.
i don't think you need this check since your are doing handler?.
bellow
PointerGestureRecognizer
Description
Implementation of PointerGestureRecognizer with PointerEntered, PointerExited, and PointerMoved events.
Windows implementation complete!
Mac implementation TBD
Implements part of #9139
API Changes
Maui.Controls
Scenario
Screenshots
aka quick home video since my screen record isn't working at the moment :p
IMG_5070.MOV