Skip to content

Commit

Permalink
Complete polygon stroke
Browse files Browse the repository at this point in the history
  • Loading branch information
fynngodau committed Aug 26, 2023
1 parent 5d58b17 commit 1eb6f20
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -233,11 +237,15 @@ class LitePolygonImpl(id: String, options: PolygonOptions, private val map: Lite

override val strokes: MutableList<AbstractPolylineImpl> = (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()

Expand Down

0 comments on commit 1eb6f20

Please sign in to comment.