Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

longPressRecognizer send continuous messages to delegate #414

Closed
mohpor opened this issue Mar 5, 2014 · 3 comments
Closed

longPressRecognizer send continuous messages to delegate #414

mohpor opened this issue Mar 5, 2014 · 3 comments

Comments

@mohpor
Copy link

mohpor commented Mar 5, 2014

I recently switched from Route-me to Mapbox-ios-sdk (because it seems that Justin doesn't care about that fork anymore) and I noticed the longPressRecognizer doesn't check the recognizer's state and therefore sends unlimited amount of messages to the delegate. it can be easily fixed this way:

if(recognizer.state==UIGestureRecognizerStateBegan){
        [_delegate longPressOnMap:self at:[recognizer locationInView:self]];
  }

please note that delegate receives this event and doesn't know about user's intentions, and can't get informed when the user released the tap (to make it a single time thing).
My app uses longPressOnMap:at: to add custom annotations to map and the current implementation leaves the map with quite a lot of unwanted annotations.

@incanus
Copy link
Contributor

incanus commented Mar 5, 2014

The reason for this is re-architected drag and drop #181 I don't see a good way to kick off a drag with a long press, but then transition to a pan, and I think this is what -[UILongPressGestureRecognizer allowableMovement] is designed for.

Are you checking against the develop branch? I'm not sure I totally understand the problem you are seeing / your use of the gesture.

I recently switched from Route-me to Mapbox-ios-sdk (because it seems that Justin doesn't care about that fork anymore)

It doesn't look like @trasch is taking pull requests anymore: Outdooractive/route-me#131 I'm awaiting that before piling on subsequent pulls bringing things further up to our codebase.

@jokeruzzo
Copy link

maybe a fast solution will be this code in RMMapView.m:
.......
else if (_delegateHasLongPressOnMap)
{
// pass map long-press to delegate
//
if (recognizer.state == UIGestureRecognizerStateBegan)
[_delegate longPressOnMap:self at:[recognizer locationInView:self]];
}
.....

@incanus
Copy link
Contributor

incanus commented Mar 17, 2014

Ah, I understand now. The delegate advertises -longPressOnMap:at: but implementers don't care about anything but the beginning of that gesture being recognized. Will remedy.

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

3 participants