Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix camera center not being deserialized properly upon platform view …
…creation (#469) * Fix camera center not being deserialed properly upon platform view creation * Add changelog entry
- Loading branch information
Showing
4 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
android/src/main/kotlin/com/mapbox/maps/mapbox_maps/mapping/turf/TurfAdapters.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
package com.mapbox.maps.mapbox_maps.mapping.turf | ||
|
||
import com.google.gson.Gson | ||
import com.mapbox.geojson.Point | ||
|
||
fun Point.toList(): List<Any?> { | ||
return listOf(mapOf("coordinates" to coordinates())) | ||
} | ||
|
||
object PointDecoder { | ||
@Suppress("UNCHECKED_CAST") | ||
fun fromList(list: List<Any?>): Point { | ||
return Point.fromJson(Gson().toJson(list.first())) | ||
val rawPoint = list.first() as Map<String, Any> | ||
val coordinates = rawPoint["coordinates"] as List<Double> | ||
|
||
return Point.fromLngLat(coordinates[0], coordinates[1]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters