There were two AYE's and zero NAYE's.
I've just committed code related to the "doubletap -> [delegate afterMapMove]" problem. I probably should have branched and not committed to the trunk yet, but oh well. It wasn't so trivial after all, so I'd really appreciate if someone could review the code. I'm sure it's not the most elegant code, and in the process I've probably rendered some old code into cruft. I do hope I didn't break anything.
Anyway, the problem was that this:
if (delegateHasDoubleTapOnMap) {
[delegate doubleTapOnMap: self At: lastGesture.center];
} else {
// Default behaviour matches built in maps.app
### CALL DELEGATE BEFOREMAPZOOM ###
[[self contents] zoomInToNextNativeZoomAt: [touch locationInView:self] animated:YES];
### CALL DELEGATE AFTERMAPZOOM ###
}
wasn't gonna work, because of the animation - what we really want is the delegate's method to be called after the animation is complete. I didn't want to pass the delegate through to the RMMapContents, because I was assuming that would violate too much encapsulation. So, I created another protocol in RMMapContents.h:
@protocol RMMapContentsAnimationCallback <NSObject>
@optional
- (void)animationFinishedWithZoomFactor:(float)zoomFactor near:(CGPoint)p;
@end
...and made RMMapView implement it. RMMapView now calls
if (delegateHasDoubleTapOnMap) {
[delegate doubleTapOnMap: self At: lastGesture.center];
} else {
// Default behaviour matches built in maps.app
float nextZoomFactor = [[self contents] getNextNativeZoomFactor];
if (nextZoomFactor != 0)
[self zoomByFactor:nextZoomFactor near:[touch locationInView:self] animated:YES];
}
...so, I added the getNextNativeZoomFactor to RMMapContents, and zoomByFactor:...animated: to RMMapView. The latter calls [contents zoomByFactor:...withCallback:self], which in turn puts the callback into the timer's userInfo dictionary. When the timer finishes, it calls the callback, which then calls the delegate.
Er, not so nice, I'm guessing.
Is there anyone besides Joseph who's familiar with all the code now? Has Mr. Gentle successfully turned over the project to anyone?
thanks,
Colin