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

Commit

Permalink
fixes #421: no longer allow callouts for non-markers
Browse files Browse the repository at this point in the history
  • Loading branch information
incanus committed Mar 18, 2014
1 parent c08d08f commit cda3185
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion MapView/Map/RMMapLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
*
* If the value of this property is `NO`, the value of the title string is ignored and the annotation remains enabled by default. You can still disable the annotation explicitly using the enabled property.
*
* Note that callouts are not supported on cluster annotation layers. These annotations can be interacted with, but do not remain consistent visually during map pan and zoom events; thus, callout behavior would be inconsistent. */
* Note that callouts are not supported on non-marker or cluster annotation layers. These annotations can be interacted with, but do not remain consistent visually during map pan and zoom events; thus, callout behavior would be inconsistent. */
@property (nonatomic, assign) BOOL canShowCallout;

/** The offset (in pixels) at which to place the callout bubble.
Expand Down
10 changes: 8 additions & 2 deletions MapView/Map/RMMapLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "RMPixel.h"
#import "RMAnnotation.h"
#import "RMMapView.h"
#import "RMMarker.h"

@interface RMMapView (PrivateMethods)

Expand Down Expand Up @@ -74,8 +75,13 @@ - (id)initWithLayer:(id)layer

- (void)setCanShowCallout:(BOOL)canShowCallout
{
if ( ! self.annotation.isClusterAnnotation)
_canShowCallout = canShowCallout;
if (canShowCallout)
{
NSAssert([self isKindOfClass:[RMMarker class]], @"Callouts are not supported on non-marker annotation layers");
NSAssert( ! self.annotation.isClusterAnnotation, @"Callouts are not supported on cluster annotation layers");
}

_canShowCallout = canShowCallout;
}

- (void)setPosition:(CGPoint)position animated:(BOOL)animated
Expand Down
16 changes: 0 additions & 16 deletions MapView/Map/RMMapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1606,22 +1606,6 @@ - (void)observeValueForKeyPath:(NSString *)aKeyPath ofObject:(id)anObject change
{
[self correctPositionOfAllAnnotationsIncludingInvisibles:NO animated:(_mapScrollViewIsZooming && !_mapScrollView.zooming)];

if (_currentAnnotation && ! [_currentAnnotation.layer isKindOfClass:[RMMarker class]])
{
// adjust shape annotation callouts for frame changes during zoom
//
_currentCallout.delegate = nil;

_currentCallout.permittedArrowDirection = SMCalloutArrowDirectionDown;

[_currentCallout presentCalloutFromRect:_currentAnnotation.layer.bounds
inLayer:_currentAnnotation.layer
constrainedToLayer:self.layer
animated:NO];

_currentCallout.delegate = self;
}

_lastZoom = _zoom;
}

Expand Down

0 comments on commit cda3185

Please sign in to comment.