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
949816bb
Commit
949816bb
authored
Jun 21, 2017
by
Qiu Xiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 Overlay 的实现方式
parent
3c5fe80e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
31 additions
and
75 deletions
+31
-75
README.md
README.md
+5
-5
AMap3DPackage.kt
...d/src/main/java/cn/qiuxiang/react/amap3d/AMap3DPackage.kt
+0
-1
AMapInfoWindow.kt
.../src/main/java/cn/qiuxiang/react/amap3d/AMapInfoWindow.kt
+0
-6
AMapInfoWindowManager.kt
...in/java/cn/qiuxiang/react/amap3d/AMapInfoWindowManager.kt
+0
-25
AMapMarker.kt
android/src/main/java/cn/qiuxiang/react/amap3d/AMapMarker.kt
+1
-1
AMapMarkerManager.kt
...c/main/java/cn/qiuxiang/react/amap3d/AMapMarkerManager.kt
+5
-3
AMapView.kt
android/src/main/java/cn/qiuxiang/react/amap3d/AMapView.kt
+1
-1
InfoWindowAdapter.kt
...c/main/java/cn/qiuxiang/react/amap3d/InfoWindowAdapter.kt
+1
-1
InfoWindow.js
components/InfoWindow.js
+0
-16
examples.js
example/src/examples.js
+1
-1
marker.js
example/src/examples/marker.js
+8
-10
AMapMarker.m
ios/AMapMarker.m
+9
-5
No files found.
README.md
View file @
949816bb
...
...
@@ -113,18 +113,18 @@ import MapView from 'react-native-amap3d'
```
jsx
<Marker
icon={() =>
<
Overlay
style=
{styles.customMarker}
>
<
View
style=
{styles.customMarker}
>
<Image
style=
{styles.customIcon}
source=
{require('marker.png')}/
>
</
Overlay
>
</
View
>
}
coordinate={{
latitude: 39.706901,
longitude: 116.397972,
}}
>
<
InfoWindo
w
style=
{styles.customInfoWindow}
>
<
Vie
w
style=
{styles.customInfoWindow}
>
<Text>
自定义信息窗体
</Text>
</
InfoWindo
w>
</
Vie
w>
</Marker>
```
...
...
@@ -157,7 +157,7 @@ import MapView from 'react-native-amap3d'
-
[
x
]
手势交互(平移、缩放、旋转、倾斜)
-
[
x
]
中心坐标、缩放级别、倾斜度
-
[
x
]
地图事件(onPress、onLongPress、onLocation)
-
[
]
地图标记(Marker)
-
[
x
]
地图标记(Marker)
-
[
x
]
基本属性及事件
-
[
x
]
自定义信息窗体
-
[
x
]
自定义图标
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/AMap3DPackage.kt
View file @
949816bb
...
...
@@ -20,7 +20,6 @@ class AMap3DPackage : ReactPackage {
AMapViewManager
(),
AMapMarkerManager
(),
AMapOverlayManager
(),
AMapInfoWindowManager
(),
AMapPolylineManager
(),
AMapPolygonManager
(),
AMapCircleManager
())
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/AMapInfoWindow.kt
deleted
100644 → 0
View file @
3c5fe80e
package
cn.qiuxiang.react.amap3d
import
android.content.Context
import
com.facebook.react.views.view.ReactViewGroup
class
AMapInfoWindow
(
context
:
Context
)
:
ReactViewGroup
(
context
)
android/src/main/java/cn/qiuxiang/react/amap3d/AMapInfoWindowManager.kt
deleted
100644 → 0
View file @
3c5fe80e
package
cn.qiuxiang.react.amap3d
import
android.view.ViewGroup.LayoutParams
import
com.facebook.react.uimanager.LayoutShadowNode
import
com.facebook.react.uimanager.ThemedReactContext
import
com.facebook.react.uimanager.ViewGroupManager
class
AMapInfoWindowManager
:
ViewGroupManager
<
AMapInfoWindow
>()
{
override
fun
getName
():
String
{
return
"AMapInfoWindow"
}
override
fun
createViewInstance
(
reactContext
:
ThemedReactContext
):
AMapInfoWindow
{
return
AMapInfoWindow
(
reactContext
)
}
override
fun
createShadowNodeInstance
():
LayoutShadowNode
{
return
LayoutNode
()
}
override
fun
updateExtraData
(
infoWindow
:
AMapInfoWindow
,
extraData
:
Any
)
{
val
data
=
extraData
as
LayoutNode
.
Layout
infoWindow
.
layoutParams
=
LayoutParams
(
data
.
width
,
data
.
height
)
}
}
android/src/main/java/cn/qiuxiang/react/amap3d/AMapMarker.kt
View file @
949816bb
...
...
@@ -23,7 +23,7 @@ class AMapMarker(context: ThemedReactContext) : ReactViewGroup(context) {
)
}
var
infoWindow
:
ReactViewGroup
?
=
null
var
infoWindow
:
AMapOverlay
?
=
null
var
infoWindowEnabled
:
Boolean
=
true
var
marker
:
Marker
?
=
null
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/AMapMarkerManager.kt
View file @
949816bb
...
...
@@ -18,9 +18,11 @@ internal class AMapMarkerManager : ViewGroupManager<AMapMarker>() {
}
override
fun
addView
(
marker
:
AMapMarker
,
view
:
View
,
index
:
Int
)
{
when
(
view
)
{
is
AMapInfoWindow
->
marker
.
infoWindow
=
view
is
AMapOverlay
->
marker
.
setIconView
(
view
)
if
(
view
is
AMapOverlay
)
{
when
(
index
)
{
0
->
marker
.
setIconView
(
view
)
1
->
marker
.
infoWindow
=
view
}
}
}
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/AMapView.kt
View file @
949816bb
...
...
@@ -85,7 +85,7 @@ class AMapView(context: ThemedReactContext) : MapView(context) {
emit
(
polylines
[
polyline
.
id
]
?.
id
,
"onPolylineClick"
)
}
map
.
setInfoWindowAdapter
(
AMap
InfoWindowAdapter
(
context
,
markers
))
map
.
setInfoWindowAdapter
(
InfoWindowAdapter
(
context
,
markers
))
}
fun
addMarker
(
marker
:
AMapMarker
)
{
...
...
android/src/main/java/cn/qiuxiang/react/amap3d/
AMap
InfoWindowAdapter.kt
→
android/src/main/java/cn/qiuxiang/react/amap3d/InfoWindowAdapter.kt
View file @
949816bb
...
...
@@ -8,7 +8,7 @@ import android.widget.TextView
import
com.amap.api.maps.AMap
import
com.amap.api.maps.model.Marker
class
AMap
InfoWindowAdapter
(
class
InfoWindowAdapter
(
val
context
:
Context
,
val
markers
:
HashMap
<
String
,
AMapMarker
>
)
:
AMap
.
InfoWindowAdapter
{
...
...
components/InfoWindow.js
deleted
100644 → 0
View file @
3c5fe80e
import
React
,
{
PropTypes
,
Component
}
from
'react'
import
{
requireNativeComponent
,
View
}
from
'react-native'
class
InfoWindow
extends
Component
{
static
propTypes
=
{
...
View
.
propTypes
,
}
render
()
{
return
<
AMapInfoWindow
{...
this
.
props
}
/
>
}
}
AMapInfoWindow
=
requireNativeComponent
(
'AMapInfoWindow'
,
InfoWindow
)
export
default
InfoWindow
example/src/examples.js
View file @
949816bb
...
...
@@ -34,7 +34,7 @@ export default class Examples extends Component {
<
View
style
=
{
styles
.
group
}
>
{
this
.
_renderItem
(
'地图模式'
,
'MapTypes'
)}
<
View
style
=
{
styles
.
separator
}
/
>
{
this
.
_renderItem
(
'
图层功能
'
,
'Layers'
)}
{
this
.
_renderItem
(
'
基本图层
'
,
'Layers'
)}
<
View
style
=
{
styles
.
separator
}
/
>
{
this
.
_renderItem
(
'室内地图'
,
'Indoor'
)}
<
View
style
=
{
styles
.
separator
}
/
>
...
...
example/src/examples/marker.js
View file @
949816bb
import
React
,
{
Component
}
from
'react'
import
{
StyleSheet
,
Alert
,
Text
,
Image
}
from
'react-native'
import
{
MapView
,
Marker
,
InfoWindow
,
Overlay
}
from
'react-native-amap3d'
import
{
StyleSheet
,
Alert
,
Text
,
Image
,
View
}
from
'react-native'
import
{
MapView
,
Marker
}
from
'react-native-amap3d'
export
default
class
MarkerExample
extends
Component
{
static
navigationOptions
=
{
...
...
@@ -45,15 +45,15 @@ export default class MarkerExample extends Component {
latitude
:
39.806901
,
longitude
:
116.297972
,
}}
>
<
InfoWindo
w
style
=
{
styles
.
customInfoWindow
}
>
<
Vie
w
style
=
{
styles
.
customInfoWindow
}
>
<
Text
>
Custom
View
InfoWindow
<
/Text
>
<
/
InfoWindo
w
>
<
/
Vie
w
>
<
/Marker
>
<
Marker
icon
=
{()
=>
<
Overlay
style
=
{
styles
.
customIcon
}
>
<
View
style
=
{
styles
.
customIcon
}
>
<
Image
style
=
{
styles
.
customIcon
}
source
=
{
require
(
'../../images/marker.png'
)}
/
>
<
/
Overlay
>
<
/
View
>
}
title
=
'自定义图片'
description
=
"Note the use of nativeOnly above. Sometimes you'll have some special properties that you need to expose for the native component, but don't actually want them as part of the API for the associated React component."
...
...
@@ -65,9 +65,9 @@ export default class MarkerExample extends Component {
<
Marker
title
=
'Custom View Marker'
icon
=
{()
=>
<
Overlay
style
=
{
styles
.
customMarker
}
>
<
View
style
=
{
styles
.
customMarker
}
>
<
Text
style
=
{
styles
.
markerText
}
>
{
this
.
state
.
time
.
toLocaleTimeString
()}
<
/Text
>
<
/
Overlay
>
<
/
View
>
}
coordinate
=
{{
latitude
:
39.706901
,
...
...
@@ -85,7 +85,6 @@ const styles = StyleSheet.create({
},
customInfoWindow
:
{
backgroundColor
:
'#8bc34a'
,
position
:
'absolute'
,
padding
:
10
,
borderRadius
:
10
,
elevation
:
4
,
...
...
@@ -93,7 +92,6 @@ const styles = StyleSheet.create({
borderColor
:
'#689F38'
,
},
customMarker
:
{
position
:
'absolute'
,
backgroundColor
:
'#009688'
,
alignItems
:
'center'
,
borderRadius
:
5
,
...
...
ios/AMapMarker.m
View file @
949816bb
...
...
@@ -85,11 +85,15 @@
-
(
void
)
insertReactSubview
:
(
id
<
RCTComponent
>
)
subview
atIndex
:
(
NSInteger
)
atIndex
{
if
([
subview
isKindOfClass
:[
AMapOverlay
class
]])
{
_overlay
=
(
AMapOverlay
*
)
subview
;
_overlay
.
delegate
=
self
;
_annotationView
.
image
=
nil
;
}
else
{
_annotationView
.
customCalloutView
=
[[
MACustomCalloutView
alloc
]
initWithCustomView
:(
id
)
subview
];
if
(
atIndex
==
0
)
{
_overlay
=
(
AMapOverlay
*
)
subview
;
_overlay
.
delegate
=
self
;
_annotationView
.
image
=
nil
;
}
if
(
atIndex
==
1
)
{
// TODO: customCalloutView 的位置不太对
_annotationView
.
customCalloutView
=
[[
MACustomCalloutView
alloc
]
initWithCustomView
:(
id
)
subview
];
}
}
}
...
...
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