Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-amap3d
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-amap3d
Commits
5d898940
Commit
5d898940
authored
Jul 06, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除 Polyline opacity 接口
parent
d68cec5a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
35 deletions
+13
-35
AMapPolyline.kt
...id/src/main/java/cn/qiuxiang/react/amap3d/AMapPolyline.kt
+0
-7
AMapPolylineManager.kt
...main/java/cn/qiuxiang/react/amap3d/AMapPolylineManager.kt
+0
-5
Polyline.js
components/Polyline.js
+1
-2
AMapPolyline.m
ios/AMapPolyline.m
+12
-20
AMapPolylineManager.m
ios/AMapPolylineManager.m
+0
-1
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/AMapPolyline.kt
View file @
5d898940
...
...
@@ -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
))
}
}
android/src/main/java/cn/qiuxiang/react/amap3d/AMapPolylineManager.kt
View file @
5d898940
...
...
@@ -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
...
...
components/Polyline.js
View file @
5d898940
...
...
@@ -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
}
/
>
...
...
ios/AMapPolyline.m
View file @
5d898940
...
...
@@ -6,20 +6,19 @@
@implementation
AMapPolyline
{
MAMultiPolyline
*
_polyline
;
MAMultiColoredPolylineRenderer
*
_renderer
;
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
;
}
...
...
@@ -28,7 +27,7 @@
for
(
NSUInteger
i
=
0
;
i
<
coordinates
.
count
;
i
++
)
{
coords
[
i
]
=
coordinates
[
i
].
coordinate
;
}
[
_polyline
setPolylineWithCoordinates
:
coords
count
:
coordinates
.
count
];
}
...
...
@@ -37,44 +36,38 @@
_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
];
if
(
colors
.
count
>
0
)
{
UIColor
*
lastColor
=
[
colors
firstObject
];
[
strokeColors
addObject
:
lastColor
];
for
(
NSUInteger
index
=
1
;
index
<
colors
.
count
;
index
++
)
{
UIColor
*
color
=
colors
[
index
];
if
(
!
[
color
isEqual
:
lastColor
])
{
[
strokeColors
addObject
:
color
];
[
indexs
addObject
:
@
(
index
)];
// index is the NEXT color
lastColor
=
color
;
}
}
if
(
strokeColors
.
count
==
1
)
{
[
indexs
addObject
:
@
(
colors
.
count
)];
}
}
_colors
=
strokeColors
;
_renderer
.
strokeColors
=
strokeColors
;
// change polyline
[
_polyline
setDrawStyleIndexes
:@[
@
(
1
),
@
(
2
)]];
}
...
...
@@ -101,12 +94,11 @@
if
(
_color
==
nil
)
{
_color
=
UIColor
.
blackColor
;
}
_renderer
=
[[
MAMultiColoredPolylineRenderer
alloc
]
initWithMultiPolyline
:
_polyline
];
_renderer
.
lineWidth
=
_width
;
_renderer
.
strokeColor
=
_color
;
_renderer
.
strokeColors
=
_colors
;
_renderer
.
alpha
=
_opacity
;
_renderer
.
lineDash
=
_dashed
;
_renderer
.
gradient
=
_gradient
;
return
_renderer
;
...
...
ios/AMapPolylineManager.m
View file @
5d898940
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment