Commit c3fd9be0 authored by Qiu Xiang's avatar Qiu Xiang

添加地图旋转角度接口 rotation

parent 37717782
......@@ -171,5 +171,10 @@ internal class AMapViewManager : ViewGroupManager<AMapView>() {
view.map.moveCamera(CameraUpdateFactory.changeTilt(tilt))
}
@ReactProp(name = "rotation")
fun changeRotation(view: AMapView, rotation: Float) {
view.map.moveCamera(CameraUpdateFactory.changeBearing(rotation))
}
// todo: 自定义 locationStyle
}
......@@ -105,7 +105,12 @@ class MapView extends Component {
limitRegion: Region,
/**
* 设置倾斜角度,取值范围 [0, 60]
* 旋转角度,取值范围 [0, 360]
*/
rotation: PropTypes.number,
/**
* 倾斜角度,取值范围 [0, 60]
*/
tilt: PropTypes.number,
......@@ -158,7 +163,7 @@ class MapView extends Component {
/**
* 动画过渡到某个位置(坐标、缩放级别、倾斜度)
*
* @param {{zoomLevel: ?number, coordinate: ?LatLng, titl: ?number}} target
* @param {{zoomLevel: ?number, coordinate: ?LatLng, titl: ?number, rotation: ?number}} target
* @param duration
*/
animateTo(target, duration = 1000) {
......
......@@ -28,6 +28,10 @@
super.cameraDegree = degree;
}
- (void)setRotation:(CGFloat)degree {
super.rotationDegree = degree;
}
- (void)insertReactSubview:(id <RCTComponent>)subview atIndex:(NSInteger)atIndex {
[super insertReactSubview:(UIView *) subview atIndex:atIndex];
if ([subview isKindOfClass:[AMapMarker class]]) {
......@@ -49,7 +53,4 @@
}
}
- (void)didUpdateReactSubviews {
}
@end
......@@ -43,6 +43,7 @@ RCT_EXPORT_VIEW_PROPERTY(mapType, MAMapType)
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D)
RCT_EXPORT_VIEW_PROPERTY(limitRegion, MACoordinateRegion)
RCT_EXPORT_VIEW_PROPERTY(tilt, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(rotation, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment