Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Make tap gesture recognizer fail if it doesn’t do anything - #7246

Merged
1ec5 merged 7 commits into
mapbox:release-ios-v3.4.0from
trailbehind:tap-gesture-fail
Dec 1, 2016
Merged

1ec5 merged 7 commits into
mapbox:release-ios-v3.4.0from
trailbehind:tap-gesture-fail

Conversation

@JesseCrocker

Copy link
Copy Markdown
Contributor

I couldn't tell from the discussion on #2278 and #7194 if implementation of this was already in progress or not, but i needed this functionality to be able to continue with a progress. If this is already is progress, please ignore this PR.

@mention-bot

Copy link
Copy Markdown

@JesseCrocker, thanks for your PR! By analyzing this pull request, we identified @1ec5, @friedbunny and @incanus to be potential reviewers.

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great solution to #2278. I have some questions about edge cases below that you probably understand better than I do.

Is any of this relevant to the macOS implementation of MGLMapView, which also has a built-in single tap gesture recognizer?

Would you do the honors and update the changelogs?

Comment thread platform/ios/src/MGLMapView.mm Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: use the nullable keyword.

Comment thread platform/ios/src/MGLMapView.mm Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if an annotation is selected and tapping would ordinarily deselect it? Wouldn't this prevent the single tap gesture recognizer from firing to deselect the annotation?

@JesseCrocker JesseCrocker Dec 1, 2016 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is false, it returns YES from the last line of the method, so the recognizer runs

Comment thread platform/ios/src/MGLMapView.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough for the application's gesture recognizers to avoid conflicts with this one gesture recognizer, or is it also necessary to avoid conflicts with, say, the double-tap gesture recognizer? Would it make sense for the application's gesture recognizer to require all the map view gesture recognizers (via the gestureRecognizers property) to fail? Or would those other gesture recognizers need to defer to the application's single tap gesture recognizer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case im not actually using this property, and instead im requiring all other gesture recognizers to fail. So maybe this property is not needed. Do you think i should remove it?

    for(UIGestureRecognizer *r in self.glMapView.gestureRecognizers) {
      [self.tapGestureRecognizer requireGestureRecognizerToFail:r];
    }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let’s leave out the property for now. If someone really needs it, they can filter the array for UITapGestureRecognizers as a workaround. That leaves MGLMapView free to install additional gesture recognizers in the future for other purposes.

@JesseCrocker JesseCrocker changed the title [ios] Make tap gesture recognizer fail if it doesn’t do anything. [iOS, macoOS] Make tap gesture recognizer fail if it doesn’t do anything. Dec 1, 2016
@1ec5 1ec5 added annotations Annotations on iOS and macOS or markers on Android feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS labels Dec 1, 2016
@1ec5 1ec5 modified the milestone: ios-3.4.1 Dec 1, 2016
Comment thread platform/macos/CHANGELOG.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: it’s a click, not a tap. 🖱

Comment thread platform/ios/src/MGLMapView.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let’s leave out the property for now. If someone really needs it, they can filter the array for UITapGestureRecognizers as a workaround. That leaves MGLMapView free to install additional gesture recognizers in the future for other purposes.

@1ec5

1ec5 commented Dec 1, 2016 •

Copy link
Copy Markdown
Contributor

Thanks again for this PR – it’s looking solid. By the way, it’d be nice to get this feature into the v3.4.0 or v3.4.1 release. We’re developing the v3.4.x series on the release-ios-v3.4.0 branch. Would you mind retargeting this PR and rebasing this branch on release-ios-v3.4.0? (There’s an option to retarget the PR when editing the PR’s title.) We’ll periodically merge this branch to master as prereleases and releases go out.

@1ec5 1ec5 changed the title [iOS, macoOS] Make tap gesture recognizer fail if it doesn’t do anything. Make tap gesture recognizer fail if it doesn’t do anything Dec 1, 2016
@JesseCrocker
JesseCrocker changed the base branch from master to release-ios-v3.4.0 December 1, 2016 19:08
@JesseCrocker

Copy link
Copy Markdown
Contributor Author

Rebased, and re-targeted

@1ec5 1ec5 added this to the ios-v3.4.0 milestone Dec 1, 2016
@1ec5
1ec5 merged commit 5dd71d3 into mapbox:release-ios-v3.4.0 Dec 1, 2016
@1ec5 1ec5 mentioned this pull request Jan 8, 2017
@JesseCrocker
JesseCrocker deleted the tap-gesture-fail branch March 3, 2017 13:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

annotations Annotations on iOS and macOS or markers on Android feature iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants