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
295ceaf9
Commit
295ceaf9
authored
Sep 13, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
android 新增 Marker#anchor 接口
相关: #65
parent
3e818a4a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
AMapMarker.kt
...src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarker.kt
+9
-0
AMapMarkerManager.kt
...n/java/cn/qiuxiang/react/amap3d/maps/AMapMarkerManager.kt
+7
-0
PropTypes.js
components/PropTypes.js
+6
-1
Marker.js
components/maps/Marker.js
+10
-2
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarker.kt
View file @
295ceaf9
...
@@ -26,6 +26,8 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
...
@@ -26,6 +26,8 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
private
var
icon
:
View
?
=
null
private
var
icon
:
View
?
=
null
private
var
bitmapDescriptor
:
BitmapDescriptor
?
=
null
private
var
bitmapDescriptor
:
BitmapDescriptor
?
=
null
private
var
anchorU
:
Float
=
0.5f
private
var
anchorV
:
Float
=
1f
var
infoWindow
:
AMapInfoWindow
?
=
null
var
infoWindow
:
AMapInfoWindow
?
=
null
var
infoWindowEnabled
:
Boolean
=
true
var
infoWindowEnabled
:
Boolean
=
true
...
@@ -108,6 +110,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
...
@@ -108,6 +110,7 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
.
alpha
(
opacity
)
.
alpha
(
opacity
)
.
draggable
(
draggable
)
.
draggable
(
draggable
)
.
position
(
position
)
.
position
(
position
)
.
anchor
(
anchorU
,
anchorV
)
.
title
(
title
)
.
title
(
title
)
.
infoWindowEnable
(
infoWindowEnabled
)
.
infoWindowEnable
(
infoWindowEnabled
)
.
snippet
(
snippet
)
.
snippet
(
snippet
)
...
@@ -148,4 +151,10 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
...
@@ -148,4 +151,10 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
bitmapDescriptor
=
BitmapDescriptorFactory
.
fromResource
(
drawable
)
bitmapDescriptor
=
BitmapDescriptorFactory
.
fromResource
(
drawable
)
marker
?.
setIcon
(
bitmapDescriptor
)
marker
?.
setIcon
(
bitmapDescriptor
)
}
}
fun
setAnchor
(
x
:
Double
,
y
:
Double
)
{
anchorU
=
x
.
toFloat
()
anchorV
=
y
.
toFloat
()
marker
?.
setAnchor
(
anchorU
,
anchorV
)
}
}
}
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarkerManager.kt
View file @
295ceaf9
...
@@ -110,4 +110,11 @@ internal class AMapMarkerManager : ViewGroupManager<AMapMarker>() {
...
@@ -110,4 +110,11 @@ internal class AMapMarkerManager : ViewGroupManager<AMapMarker>() {
fun
setZInex
(
marker
:
AMapMarker
,
zIndex
:
Float
)
{
fun
setZInex
(
marker
:
AMapMarker
,
zIndex
:
Float
)
{
marker
.
zIndex
=
zIndex
marker
.
zIndex
=
zIndex
}
}
@ReactProp
(
name
=
"anchor"
)
fun
setAnchor
(
view
:
AMapMarker
,
coordinate
:
ReadableMap
)
{
view
.
setAnchor
(
coordinate
.
getDouble
(
"x"
),
coordinate
.
getDouble
(
"y"
))
}
}
}
components/PropTypes.js
View file @
295ceaf9
...
@@ -12,5 +12,10 @@ const Region = PropTypes.shape({
...
@@ -12,5 +12,10 @@ const Region = PropTypes.shape({
longitudeDelta
:
PropTypes
.
number
.
isRequired
,
longitudeDelta
:
PropTypes
.
number
.
isRequired
,
})
})
export
{
LatLng
,
Region
}
const
Point
=
PropTypes
.
shape
({
x
:
PropTypes
.
number
.
isRequired
,
y
:
PropTypes
.
number
.
isRequired
,
})
export
{
LatLng
,
Region
,
Point
}
components/maps/Marker.js
View file @
295ceaf9
import
React
,
{
PropTypes
}
from
'react'
import
React
,
{
PropTypes
}
from
'react'
import
{
Platform
,
requireNativeComponent
,
StyleSheet
,
View
,
ViewPropTypes
}
from
'react-native'
import
{
Platform
,
requireNativeComponent
,
StyleSheet
,
View
PropTypes
,
View
}
from
'react-native'
import
InfoWindow
from
'./InfoWindow'
import
InfoWindow
from
'./InfoWindow'
import
{
LatLng
}
from
'../PropTypes'
import
{
LatLng
,
Point
}
from
'../PropTypes'
import
BaseComponent
from
'../BaseComponent'
import
BaseComponent
from
'../BaseComponent'
export
default
class
Marker
extends
BaseComponent
{
export
default
class
Marker
extends
BaseComponent
{
...
@@ -81,6 +81,14 @@ export default class Marker extends BaseComponent {
...
@@ -81,6 +81,14 @@ export default class Marker extends BaseComponent {
*/
*/
zIndex
:
PropTypes
.
number
,
zIndex
:
PropTypes
.
number
,
/**
* 设置覆盖物的锚点比例
*
* @link http://a.amap.com/lbs/static/unzip/Android_Map_Doc/3D/com/amap/api/maps/model/Marker.html#setAnchor-float-float-
* @platform android
*/
anchor
:
Point
,
/**
/**
* 是否选中,选中时将显示信息窗体,一个地图只能有一个正在选中的 marker
* 是否选中,选中时将显示信息窗体,一个地图只能有一个正在选中的 marker
*/
*/
...
...
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