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
0021b3fa
Commit
0021b3fa
authored
Jul 06, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 iOS animated 实现
parent
d68065ec
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
MapView.js
components/MapView.js
+1
-1
animated.js
example/src/examples/animated.js
+2
-0
AMapViewManager.m
ios/AMapViewManager.m
+10
-6
No files found.
components/MapView.js
View file @
0021b3fa
...
...
@@ -175,7 +175,7 @@ class MapView extends Component {
)
break
;
case
'ios'
:
NativeModules
.
AMapViewManager
[
command
](
findNodeHandle
(
this
),
params
)
NativeModules
.
AMapViewManager
[
command
](
findNodeHandle
(
this
),
...
params
)
break
;
}
}
...
...
example/src/examples/animated.js
View file @
0021b3fa
...
...
@@ -16,6 +16,7 @@ export default class AnimatedExample extends Component {
_animatedToZGC
()
{
this
.
mapView
.
animateTo
({
tilt
:
45
,
rotation
:
90
,
zoomLevel
:
18
,
coordinate
:
{
latitude
:
39.97837
,
...
...
@@ -27,6 +28,7 @@ export default class AnimatedExample extends Component {
_animatedToTAM
()
{
this
.
mapView
.
animateTo
({
tilt
:
0
,
rotation
:
0
,
zoomLevel
:
16
,
coordinate
:
{
latitude
:
39.90864
,
...
...
ios/AMapViewManager.m
View file @
0021b3fa
...
...
@@ -48,22 +48,26 @@ RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY
(
onLongPress
,
RCTBubblingEventBlock
)
RCT_EXPORT_VIEW_PROPERTY
(
onLocation
,
RCTBubblingEventBlock
)
RCT_EXPORT_METHOD
(
animateTo
:
(
nonnull
NSNumber
*
)
reactTag
data
:
(
NSArray
*
)
data
)
{
RCT_EXPORT_METHOD
(
animateTo
:
(
nonnull
NSNumber
*
)
reactTag
params
:
(
NSDictionary
*
)
params
duration
:
(
NSInteger
)
duration
)
{
[
self
.
bridge
.
uiManager
addUIBlock
:
^
(
__unused
RCTUIManager
*
uiManager
,
NSDictionary
<
NSNumber
*
,
UIView
*>
*
viewRegistry
)
{
AMapView
*
mapView
=
(
AMapView
*
)
viewRegistry
[
reactTag
];
NSDictionary
*
params
=
data
[
0
]
;
MAMapStatus
*
mapStatus
=
mapView
.
getMapStatus
;
if
(
params
[
@"zoomLevel"
])
{
[
mapView
setZoomLevel
:[
params
[
@"zoomLevel"
]
floatValue
]
animated
:
YES
];
mapStatus
.
zoomLevel
=
[
params
[
@"zoomLevel"
]
floatValue
];
}
if
(
params
[
@"coordinate"
])
{
NSDictionary
*
coordinate
=
params
[
@"coordinate"
];
[
mapView
setCenterCoordinate
:
CLLocationCoordinate2DMake
(
mapStatus
.
centerCoordinate
=
CLLocationCoordinate2DMake
(
[
coordinate
[
@"latitude"
]
doubleValue
],
[
coordinate
[
@"longitude"
]
doubleValue
])
animated
:
YES
]
;
[
coordinate
[
@"longitude"
]
doubleValue
]);
}
if
(
params
[
@"tilt"
])
{
[
mapView
setCameraDegree
:[
params
[
@"tilt"
]
floatValue
]
animated
:
YES
duration
:
0
.
3
];
mapStatus
.
cameraDegree
=
[
params
[
@"tilt"
]
floatValue
];
}
if
(
params
[
@"rotation"
])
{
mapStatus
.
rotationDegree
=
[
params
[
@"rotation"
]
floatValue
];
}
[
mapView
setMapStatus
:
mapStatus
animated
:
YES
duration
:
duration
/
1000
];
}];
}
...
...
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