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
05b9a735
Commit
05b9a735
authored
Dec 23, 2017
by
7c00
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 android Marker#lockToScreen 接口
resolve #112
parent
e1e9a924
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
AMapUtilsModule.kt
...src/main/java/cn/qiuxiang/react/amap3d/AMapUtilsModule.kt
+4
-0
AMapMarker.kt
...src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarker.kt
+10
-0
AMapMarkerManager.kt
...n/java/cn/qiuxiang/react/amap3d/maps/AMapMarkerManager.kt
+4
-1
No files found.
android/src/main/java/cn/qiuxiang/react/amap3d/AMapUtilsModule.kt
View file @
05b9a735
package
cn.qiuxiang.react.amap3d
import
android.content.res.Resources
import
com.amap.api.maps.AMapUtils
import
com.amap.api.maps.model.LatLng
import
com.facebook.react.bridge.Promise
...
...
@@ -18,3 +19,6 @@ class AMapUtilsModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
promise
.
resolve
(
AMapUtils
.
calculateLineDistance
(
LatLng
(
lat1
,
lng1
),
LatLng
(
lat2
,
lng2
)))
}
}
val
Int
.
toPx
:
Int
get
()
=
(
this
*
Resources
.
getSystem
().
displayMetrics
.
density
).
toInt
()
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarker.kt
View file @
05b9a735
...
...
@@ -4,8 +4,10 @@ import android.content.Context
import
android.graphics.Bitmap
import
android.graphics.Canvas
import
android.view.View
import
cn.qiuxiang.react.amap3d.toPx
import
com.amap.api.maps.AMap
import
com.amap.api.maps.model.*
import
com.facebook.react.bridge.ReadableArray
import
com.facebook.react.views.view.ReactViewGroup
class
AMapMarker
(
context
:
Context
)
:
ReactViewGroup
(
context
),
AMapOverlay
{
...
...
@@ -157,4 +159,12 @@ class AMapMarker(context: Context) : ReactViewGroup(context), AMapOverlay {
anchorV
=
y
.
toFloat
()
marker
?.
setAnchor
(
anchorU
,
anchorV
)
}
fun
lockToScreen
(
args
:
ReadableArray
?)
{
if
(
args
!=
null
)
{
val
x
=
args
.
getInt
(
0
).
toPx
val
y
=
args
.
getInt
(
1
).
toPx
marker
?.
setPositionByPixels
(
x
,
y
)
}
}
}
android/src/main/java/cn/qiuxiang/react/amap3d/maps/AMapMarkerManager.kt
View file @
05b9a735
...
...
@@ -39,12 +39,14 @@ internal class AMapMarkerManager : ViewGroupManager<AMapMarker>() {
companion
object
{
val
UPDATE
=
1
val
ACTIVE
=
2
val
LOCK_TO_SCREEN
=
3
}
override
fun
getCommandsMap
():
Map
<
String
,
Int
>
{
return
mapOf
(
"update"
to
UPDATE
,
"active"
to
ACTIVE
"active"
to
ACTIVE
,
"lockToScreen"
to
LOCK_TO_SCREEN
)
}
...
...
@@ -52,6 +54,7 @@ internal class AMapMarkerManager : ViewGroupManager<AMapMarker>() {
when
(
commandId
)
{
UPDATE
->
marker
.
updateIcon
()
ACTIVE
->
marker
.
active
=
true
LOCK_TO_SCREEN
->
marker
.
lockToScreen
(
args
)
}
}
...
...
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