Adding the ability to subclass UIGestureRecognizer#1002
Conversation
|
Hi @pittmab, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! The agreement was validated by Microsoft and real humans are currently evaluating your PR. TTYL, MSBOT; |
| UIGestureRecognizer* activeGesture = nil; | ||
|
|
||
| int count = [g_currentlyTrackingGesturesList count]; | ||
| for (int i = count - 1; i >= 0; i--) { |
There was a problem hiding this comment.
nit: this could be converted into a for in loop
There was a problem hiding this comment.
@aballway I am guessing that you would prefer that we use a reverseObjectEnumerator to traverse in reverse order. I have noticed that the code in this file uses a mixture of old for counting loops and for in loops. Should all new code be for in when it can? I initially used the style I found in the existing code.
There was a problem hiding this comment.
I think it's better style to use for in loops unless the index is needed or the entire file is in counting style. Given this file is mixed either one would work, but I believe using for/in is clearer.
In reply to: 78584341 [](ancestors = 78584341)
There was a problem hiding this comment.
@aballway I agree that for in is quicker to read so I will make the changes. Just curious as to what your team prefers given the mix in this file. I will make the changes.
|
@davelamb, please take a look. |
| } | ||
| } | ||
|
|
||
| if ( activeGesture ) { |
There was a problem hiding this comment.
activeGesture [](start = 8, length = 15)
super-nit: several spots with inconsistent spacing; it may be beneficial to run pre_commit(.ps1) or pre_push(.ps1) which would run clang-format over your changes.
There was a problem hiding this comment.
@jaredhms I just ran it and it doesn't indicate that any changes are necessary. Is there something that I am missing? Thanks
There was a problem hiding this comment.
There was a problem hiding this comment.
I edited the file and ran the pre-commit check. The output was Performing pre-commit validation... Commit approved.
There was a problem hiding this comment.
Strange; it should have modified the file in place to remove the spacing inconsistencies. it might be worth trying .\tools\scripts\clang-format.ps1 -File to see if you get different results?
In reply to: 78604452 [](ancestors = 78604452)
There was a problem hiding this comment.
Yes. I have to run clang-format. Thanks
There was a problem hiding this comment.
Thanks - that's a bit unfortunate. Might be worth trying pre_push next time (after you commit, before you push)...
In reply to: 78605310 [](ancestors = 78605310)
08aa54c to
7269fc0
Compare
| // remove those gesturee | ||
| for ( UIGestureRecognizer* curGesture in gesturesToRemove ) { | ||
| [curGesture reset]; | ||
| TraceVerbose(TAG, L"Removing gesture %hs %x state=%d", object_getClassName(curGesture), curGesture ); |
There was a problem hiding this comment.
TraceVerbose(TAG, L"Removing gesture %hs %x state=%d", object_getClassName(curGesture), curGesture ); [](start = 9, length = 104)
can you please wrap this in an 'if (DEBUG_GESTURES) {}' ?
There was a problem hiding this comment.
@jaredhms Added and other changes have been made. Please take a look.
7269fc0 to
dc5fe0e
Compare
| for (UIGestureRecognizer* curGesture in [g_currentlyTrackingGesturesList reverseObjectEnumerator]) { | ||
| id curgestureClass = [curGesture class]; | ||
| if ([curgestureClass _fireGestures:@[ curGesture ]]) { | ||
| handled = false; |
There was a problem hiding this comment.
This should still be 'true', shouldn't it?
Also can we please add the old tracing back?
if (handled && DEBUG_GESTURES) {
TraceVerbose(TAG, L"Gesture (%hs) handled.", object_getClassName(curgestureClass));
}
There was a problem hiding this comment.
@jaredhms Fixed and the original debugging code put back. Thanks
- removing the hard coded preference of gestures - now enumerating the list of gestures in the order in which they are added - supporting some of the callbacks for UIGestureRecognizerDelegate - Adding a callback to check if the first active gesture can prevent other potential gestures in the gesture recognizer list. Fix: 489 Fix: 475
dc5fe0e to
1c72432
Compare
|
|
|
Seems like this would merit some sort of UT to validate. I know @davelamb mentioned not having UI automation yet but I don't think the test needs to be that extreme to prove out that the subclassing works and that the code you changed is operating correctly / not regressing things etc. |
|
🕐 |
|
As seen in the thread the pull request was incorporated into another pull request and checked in. This pull request is no longer needed. |
Fix: 489
Fix: 475
This change is