Created
May 2, 2021 20:08
-
-
Save DelphiWorlds/2e65ad9998a017351778ad2f321fdbd1 to your computer and use it in GitHub Desktop.
Create 2 markers, not far from each other
This file contains hidden or 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
type | |
TForm1 = class(TForm) | |
Map: TMapView; | |
private | |
FMarkerA: TMapMarker; | |
FMarkerB: TMapMarker; | |
procedure AddMarkers; | |
public | |
constructor Create(AOwner: TComponent); override; | |
end; | |
var | |
Form1: TForm1; | |
implementation | |
{$R *.fmx} | |
constructor TForm1.Create(AOwner: TComponent); | |
begin | |
inherited; | |
AddMarkers; | |
end; | |
procedure TForm1.AddMarkers; | |
var | |
LDescriptor: TMapMarkerDescriptor; | |
begin | |
Map.Location := TMapCoordinate.Create(30.3970, -97.7300); | |
LDescriptor := TMapMarkerDescriptor.Create(Map.Location, 'EMBT'); | |
FMarkerA := Map.AddMarker(LDescriptor); | |
Map.Location := TMapCoordinate.Create(30.3966, -97.7275); | |
LDescriptor := TMapMarkerDescriptor.Create(Map.Location, 'Near EMBT'); | |
FMarkerB := Map.AddMarker(LDescriptor); | |
Map.Zoom := 18; | |
end; |
If you are interessed to see the effect I describe, you can download GaletPocket on the App Store, and write "Dijon" in the search bar. I can give you access to the source code too. Thanks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related to this SO question: https://stackoverflow.com/questions/67300467/mapview-marker-show-previous-on-ios
In FMX.Maps.iOS, there is the TMapKitMapView.MapEvent method:
Using the steps in the report, i.e.:
Here are the events fired in TMapKitMapView.MapEvent for each step
Event.Kind = MapClick
Event.Kind = MarkerClick (i.e. Marker A)
Event.Kind = MapClick
Event.Kind = MarkerDeselected (i.e. Marker A)
Event.Kind = MarkerClick (i.e. Marker B)
Event.Kind = MapClick
Event.Kind = MarkerDeselected (i.e. Marker B)
Event.Kind = MapClick
Event.Kind = MarkerClick (i.e. Marker A)
Unfortunately because MapClick is called in step 3, and FSelectedMarker is non-nil at this point, the OnMarkerClick event is being called for the marker that is about to be deselected. This seems to be an undesirable effect