Files
MapLibreParticleLab/platform/osx/src/MGLAnnotationImage.m
Minh Nguyễn f8c52d5d38 [osx] Observe annotation coordinates
MGLMapView observes changes to the coordinate property of each MGLAnnotation added to it. Changing the coordinate property in a KVO-compliant way causes the annotation to be relocated and its callout view, if present, to be dismissed. To avoid observing the same annotation twice yet also avoid expensive lookups when adding or removing annotations, MGLMapView indexes added point annotations in an NSMutableSet.
2016-04-19 14:24:59 -07:00

27 lines
718 B
Objective-C

#import "MGLAnnotationImage_Private.h"
@interface MGLAnnotationImage ()
@property (nonatomic) NSImage *image;
@property (nonatomic) NSString *reuseIdentifier;
@property (nonatomic, strong, nullable) NSString *styleIconIdentifier;
@end
@implementation MGLAnnotationImage
+ (instancetype)annotationImageWithImage:(NSImage *)image reuseIdentifier:(NSString *)reuseIdentifier {
return [[self alloc] initWithImage:image reuseIdentifier:reuseIdentifier];
}
- (instancetype)initWithImage:(NSImage *)image reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super init]) {
_image = image;
_reuseIdentifier = [reuseIdentifier copy];
_selectable = YES;
}
return self;
}
@end