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
af84a2c9
Commit
af84a2c9
authored
May 28, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加倾斜角度和中心坐标的设置接口
parent
be9d91e9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
4 deletions
+41
-4
AMapViewManager.java
...c/main/java/cn/qiuxiang/react/amap3d/AMapViewManager.java
+18
-2
indoor.js
example/src/indoor.js
+5
-1
layers.js
example/src/layers.js
+1
-0
index.js
index.js
+17
-1
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/AMapViewManager.java
View file @
af84a2c9
...
...
@@ -2,8 +2,10 @@ package cn.qiuxiang.react.amap3d;
import
com.amap.api.maps.AMap
;
import
com.amap.api.maps.CameraUpdateFactory
;
import
com.amap.api.maps.model.MyLocationStyle
;
import
com.amap.api.maps.model.LatLng
;
import
com.facebook.react.bridge.ReadableMap
;
import
com.facebook.react.common.MapBuilder
;
import
com.facebook.react.module.annotations.ReactModule
;
import
com.facebook.react.uimanager.SimpleViewManager
;
import
com.facebook.react.uimanager.ThemedReactContext
;
import
com.facebook.react.uimanager.annotations.ReactProp
;
...
...
@@ -90,7 +92,7 @@ class AMapViewManager extends SimpleViewManager<AMapView> {
@ReactProp
(
name
=
"zoomLevel"
)
public
void
setZoomLevel
(
AMapView
view
,
float
zoomLevel
)
{
view
.
map
.
animat
eCamera
(
CameraUpdateFactory
.
zoomTo
(
zoomLevel
));
view
.
map
.
mov
eCamera
(
CameraUpdateFactory
.
zoomTo
(
zoomLevel
));
}
@ReactProp
(
name
=
"mapType"
)
...
...
@@ -117,4 +119,18 @@ class AMapViewManager extends SimpleViewManager<AMapView> {
public
void
setTiltGesturesEnabled
(
AMapView
view
,
boolean
enabled
)
{
view
.
ui
.
setTiltGesturesEnabled
(
enabled
);
}
@ReactProp
(
name
=
"coordinate"
)
public
void
moveToCoordinate
(
AMapView
view
,
ReadableMap
coordinate
)
{
view
.
map
.
moveCamera
(
CameraUpdateFactory
.
changeLatLng
(
new
LatLng
(
coordinate
.
getDouble
(
"latitude"
),
coordinate
.
getDouble
(
"longitude"
))));
}
@ReactProp
(
name
=
"tilt"
)
public
void
changeTilt
(
AMapView
view
,
float
tilt
)
{
view
.
map
.
moveCamera
(
CameraUpdateFactory
.
changeTilt
(
tilt
));
}
// todo: 自定义 locationStyle
}
example/src/indoor.js
View file @
af84a2c9
...
...
@@ -9,8 +9,12 @@ export default class Indoor extends Component {
render
()
{
return
<
MapView
coordinate
=
{{
latitude
:
39.91095
,
longitude
:
116.37296
,
}}
zoomLevel
=
{
18
}
showsIndoorMap
=
{
true
}
showsIndoorSwitch
=
{
true
}
style
=
{
StyleSheet
.
absoluteFill
}
/
>
}
}
example/src/layers.js
View file @
af84a2c9
...
...
@@ -37,6 +37,7 @@ export default class Layers extends Component {
<
/View
>
<
MapView
zoomLevel
=
{
17
}
tilt
=
{
60
}
showsLabels
=
{
this
.
state
.
showsLabels
}
showsTraffic
=
{
this
.
state
.
showsTraffic
}
showsBuildings
=
{
this
.
state
.
showsBuildings
}
...
...
index.js
View file @
af84a2c9
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
}
from
'react-native'
const
CoordinateProType
=
PropTypes
.
shape
({
latitude
:
PropTypes
.
number
.
isRequired
,
longitude
:
PropTypes
.
number
.
isRequired
,
})
class
MapView
extends
Component
{
static
propTypes
=
{
...
View
.
propTypes
,
...
...
@@ -76,10 +81,20 @@ class MapView extends Component {
minZoomLevel
:
PropTypes
.
number
,
/**
* 设置当前缩放级别
* 设置当前缩放级别
,取值范围 [3, 20]
*/
zoomLevel
:
PropTypes
.
number
,
/**
* 设置中心坐标
*/
coordinate
:
CoordinateProType
,
/**
* 设置倾斜角度,取值范围 [0, 60]
*/
tilt
:
PropTypes
.
number
,
/**
* 是否启用缩放手势,用于放大缩小
*/
...
...
@@ -110,3 +125,4 @@ AMapView = requireNativeComponent('AMapView', MapView)
export
default
MapView
export
{
MapView
}
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