ichim / LeafletForBlazor-NuGet

LeafletForBlazor NuGet Package - You can quickly add a map control to your Blazor application - 2.2.2.2 version. #12 issue, StreamLegend customization
https://www.nuget.org/packages/LeafletForBlazor#versions-body-tab
74 stars 9 forks source link

Map Event #11

Open rassmith opened 10 months ago

rassmith commented 10 months ago

Hi Laurentiu, thanks for package. I have a question, How can I get latitude and longitude on click event in new version?

ichim commented 10 months ago

Hello sir, No, for this moment. for the near future I will also add this event.

ichim commented 8 months ago

Hello sir,

The new version of leafletforblazer (RealTimeMap) now has some event methods

rassmith commented 8 months ago

Hi Laurentiu, thanks for adding new features to the package ....

rassmith commented 8 months ago

Laurentiu I have another question. I'm trying to init default marker to map and use this event but that's not work image how can I set default marker in map? mapPoint method works here in OnClickMap Event image

ichim commented 8 months ago

Hello sir,

The syntax of your code is Javascript specific.

You have to write:

public async void OnClickMap(RealTimeMap.ClicksMapArgs arg)
         {
             await realTimeMap.movePoint(new double[] { arg.location.latitude, arg.location.longitude });
         }

movePoint code example

rassmith commented 8 months ago

Hello sir, actually I wanted to have a marker at a specific point when loading the map. I try this way and its work (by remove await Task.Delay(1000);, that don't work)

public async Task OnAfterMapLoaded(RealTimeMap.MapEventArgs param)
    {
        await Task.Delay(1000);
        await param.sender.movePoint(new double[] { 44.4501715, 26.1107672 });
    }

I'd like to know your opinion on whether this is the best way to implement it?

ichim commented 8 months ago

Hello sir, Your example is very good. It seems that the movePoint() method does not find the loaded map!?! I will check!!

You can use instead:

await param.sender.Geometric.Points.add(new RealTimeMap.StreamPoint() { latitude = 44.4501715, longitude = 26.1107672 });