diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt index 16bb4071d48e4d345ba5c6330f613eb9cfd8ea48..c91f5834313c4a41b2ae7f81a94597b570efaa3a 100644 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/model/Polygon.kt @@ -191,11 +191,15 @@ class PolygonImpl(private val map: GoogleMapImpl, id: String, options: PolygonOp override val strokes = (listOf( PolylineImpl( - map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(points) + map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll( + (points + points.firstOrNull()).filterNotNull() + ) ) - ) + holes.mapIndexed { idx, it -> + ) + holes.mapIndexed { idx, holePoints -> PolylineImpl( - map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it) + map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll( + (holePoints + holePoints.firstOrNull()).filterNotNull() + ) ) }).toMutableList() @@ -233,11 +237,15 @@ class LitePolygonImpl(id: String, options: PolygonOptions, private val map: Lite override val strokes: MutableList = (listOf( LitePolylineImpl( - map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(points) + map, "$id-stroke-main", PolylineOptions().color(strokeColor).width(strokeWidth).addAll( + (points + points.firstOrNull()).filterNotNull() + ) ) - ) + holes.mapIndexed { idx, it -> + ) + holes.mapIndexed { idx, holePoints -> LitePolylineImpl( - map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll(it) + map, "$id-stroke-hole-$idx", PolylineOptions().color(strokeColor).width(strokeWidth).addAll( + (holePoints + holePoints.firstOrNull()).filterNotNull() + ) ) }).toMutableList()