Adding Markers After Tap
I store the markers in an array of markers.Step 1: Adding markers dynamically when user taps on map
I added two lines of code to the onMapClicked method:
Step 2: Changing the added markers
CheckDirectionsFromDb will check if the direction has data for all transport modes. In that case, it will call updateMarker for that coordinate:
Since the method doesn't care whether the center of the map equals orig or dest, I'll let the method updateMarker do that check, |
First, the script determines which coordinate is connected to the marker. After that, it changes the connected icon. Note the icons to the right. |
For some strange reason, the title is hidden when another marker is added.
The next blog post will discuss how the program shall add when moving the map. The markers should be cleared and existing directions shall be added, if found in the database.
No comments:
Post a Comment