Skip to content

Commit

Permalink
fix : fix polyline hide user location marker (liodali#226)
Browse files Browse the repository at this point in the history
* when user activate tracking and draw road in the map hide the user location marker,
so solution was when we will draw the road we will check last overlay exist and before we add road overlay we will add it before user location marker overlay
  • Loading branch information
liodali committed Feb 5, 2022
1 parent c404013 commit efb4554
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ class FlutterOsmView(
animateTo = false
)

//map!!.overlays.add(marker)

result.success(null)

}
Expand Down Expand Up @@ -1046,7 +1046,10 @@ class FlutterOsmView(
val widthRoad = (args["roadWidth"] as Double)

if (!map!!.overlays.contains(folderRoad)) {
map!!.overlays.add(folderRoad)
locationNewOverlay?.let { locationOverlay ->
val indexOf = map!!.overlays.indexOf(locationOverlay)
map!!.overlays.add(indexOf - 1, folderRoad)
} ?: map!!.overlays.add(folderRoad)
} else {
folderRoad.items.clear()
}
Expand Down Expand Up @@ -1382,7 +1385,10 @@ class FlutterOsmView(
map!!.overlays.remove(it)
}
if (!map!!.overlays.contains(folderRoad)) {
map!!.overlays.add(folderRoad)
locationNewOverlay?.let { locationOverlay ->
val indexOf = map!!.overlays.indexOf(locationOverlay)
map!!.overlays.add(indexOf - 1, folderRoad)
} ?: map!!.overlays.add(folderRoad)
}
folderRoad.items.clear()
val cachedRoads = map!!.overlays.filterIsInstance<Polyline>()
Expand Down Expand Up @@ -1483,10 +1489,15 @@ class FlutterOsmView(
map!!.overlays.remove(it)
}
if (!map!!.overlays.contains(folderRoad)) {
map!!.overlays.add(folderRoad)
locationNewOverlay?.let { locationOverlay ->
val indexOf = map!!.overlays.indexOf(locationOverlay)
map!!.overlays.add(indexOf - 1, folderRoad)
} ?: map!!.overlays.add(folderRoad)

} else {
folderRoad.items.clear()
}

map!!.invalidate()

if (roadManager == null)
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/home/home_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class _MainExampleState extends State<MainExample> with OSMMixinObserver {
},
initZoom: 8,
minZoomLevel: 3,
maxZoomLevel: 14,
maxZoomLevel: 18,
stepZoom: 1.0,
userLocationMarker: UserLocationMaker(
personMarker: MarkerIcon(
Expand Down

0 comments on commit efb4554

Please sign in to comment.