Commit 5d898940 authored by Qiu Xiang's avatar Qiu Xiang

移除 Polyline opacity 接口

parent d68cec5a
......@@ -25,12 +25,6 @@ class AMapPolyline(context: ThemedReactContext) : ReactViewGroup(context) {
polyline?.color = value
}
var opacity: Float = 1f
set(value) {
field = value
polyline?.setTransparency(value)
}
var zIndex: Float = 0f
set(value) {
field = value
......@@ -75,7 +69,6 @@ class AMapPolyline(context: ThemedReactContext) : ReactViewGroup(context) {
.useGradient(gradient)
.geodesic(geodesic)
.setDottedLine(dashed)
.transparency(opacity)
.zIndex(zIndex))
}
}
......@@ -44,11 +44,6 @@ internal class AMapPolylineManager : ViewGroupManager<AMapPolyline>() {
polyline.zIndex = zIndex
}
@ReactProp(name = "opacity")
override fun setOpacity(polyline: AMapPolyline, opacity: Float) {
polyline.opacity = opacity
}
@ReactProp(name = "geodesic")
fun setGeodesic(polyline: AMapPolyline, geodesic: Boolean) {
polyline.geodesic = geodesic
......
......@@ -10,7 +10,6 @@ class Polyline extends Component {
width: PropTypes.number,
color: PropTypes.string,
zIndex: PropTypes.number,
opacity: PropTypes.number,
/**
* 多段颜色
......@@ -59,9 +58,9 @@ class Polyline extends Component {
...Platform.select({
android: {
width: PixelRatio.getPixelSizeForLayoutSize(this.props.width),
colors: this.props.colors.map(processColor),
},
}),
colors: this.props.colors.map(processColor),
onPolylineClick: this._handle('onPress'),
}
return <AMapPolyline {...props}/>
......
......@@ -10,14 +10,13 @@
CGFloat _width;
UIColor *_color;
NSArray *_colors;
CGFloat _opacity;
BOOL _dashed;
BOOL _gradient;
}
- (instancetype)init {
if (self = [super init]) {
_polyline = [MAMultiPolyline polylineWithCoordinates:NULL count:0 drawStyleIndexes:NULL];
_polyline = [MAMultiPolyline polylineWithCoordinates:nil count:0 drawStyleIndexes:nil];
}
return self;
......@@ -37,19 +36,14 @@
_renderer.lineWidth = width;
}
- (void)setOpacity:(CGFloat)opacity {
opacity = MAX(0.01, opacity); // 线段最低的opacity是0.01不能再小了,否则干掉多好。Android系统上默认为此逻辑。
_opacity = opacity;
_renderer.alpha = opacity;
}
- (void)setColor:(UIColor *)color {
_color = color;
_renderer.strokeColor = color;
}
- (void)setColors:(NSArray *)colors {
// process colors -> strokeColor |egg: [black, black, black, white, white, black] => [black, white, black] + [3, 5]|
// colors -> strokeColors
// egg: [black, black, black, white, white, black] => [black, white, black] + [3, 5]
NSMutableArray *strokeColors = [[NSMutableArray alloc] init];
NSMutableArray *indexs = [[NSMutableArray alloc] init];
......@@ -62,7 +56,6 @@
if (![color isEqual:lastColor]) {
[strokeColors addObject:color];
[indexs addObject:@(index)]; // index is the NEXT color
lastColor = color;
}
}
......@@ -106,7 +99,6 @@
_renderer.lineWidth = _width;
_renderer.strokeColor = _color;
_renderer.strokeColors = _colors;
_renderer.alpha = _opacity;
_renderer.lineDash = _dashed;
_renderer.gradient = _gradient;
return _renderer;
......
......@@ -18,7 +18,6 @@ RCT_EXPORT_MODULE()
RCT_EXPORT_VIEW_PROPERTY(coordinates, CoordinateArray)
RCT_EXPORT_VIEW_PROPERTY(width, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
RCT_EXPORT_VIEW_PROPERTY(dashed, BOOL)
RCT_EXPORT_VIEW_PROPERTY(gradient, BOOL)
......
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