amap_map/ios/Classes/Category/MAAnnotationView+Flutter.m

41 lines
1.4 KiB
Mathematica
Raw Permalink Normal View History

2023-12-22 21:23:24 +08:00
//
// MAAnnotationView+Flutter.m
// amap_map
//
// Created by lly on 2020/11/5.
//
#import "MAAnnotationView+Flutter.h"
#import "AMapMarker.h"
#import "AMapInfoWindow.h"
@implementation MAAnnotationView (Flutter)
- (void)updateViewWithMarker:(AMapMarker *)marker {
if (marker == nil) {
return;
}
self.alpha = marker.alpha;
self.image = marker.image;
//anchorcenterOffset
if (self.image) {
CGSize imageSize = self.image.size;
//iOSannotationViewannotation,0.50.5
CGFloat offsetW = imageSize.width * (0.5 - marker.anchor.x);
CGFloat offsetH = imageSize.height * (0.5 - marker.anchor.y);
self.centerOffset = CGPointMake(offsetW, offsetH);
}
self.enabled = marker.clickable;
self.draggable = marker.draggable;
// marker.flat;//flatiOS
self.canShowCallout = marker.infoWindowEnable;
// TODO: iOScalloutOffset
// self.calloutOffset = marker.infoWindow.anchor;
//
self.imageView.transform = CGAffineTransformMakeRotation(marker.rotation / 180.f * M_PI);
self.hidden = (!marker.visible);
self.zIndex = marker.zIndex;
}
@end