Skip to content

Commit

Permalink
Fixed advanced marker view demo page in server side
Browse files Browse the repository at this point in the history
  • Loading branch information
valentas-deltamina committed Apr 30, 2024
1 parent 219e0fa commit 3f6a2d6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ServerSideDemo/Pages/AdvancedMarkerViewPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<h1>Google Map Advanced Markers</h1>
<smallNotice: Available only in the v=beta channel.></smallNotice:>
<GoogleMap @ref="@_map1" Id="map1" Options="@_mapOptions"></GoogleMap>
<GoogleMap @ref="@_map1" Id="map1" Options="@_mapOptions" OnAfterInit="OnAfterRenderAsync"></GoogleMap>
<button @onclick="@AddMarker">Add marker</button>

@code {
Expand Down Expand Up @@ -34,12 +34,9 @@
};
}

protected override async Task OnAfterRenderAsync(bool firstRender)
protected async Task OnAfterRenderAsync()
{
if (firstRender)
{
_bounds = await LatLngBounds.CreateAsync(_map1.JsRuntime);
}
_bounds = await LatLngBounds.CreateAsync(_map1.JsRuntime);
}

private async Task AddMarker()
Expand All @@ -54,5 +51,8 @@
});

await _bounds.Extend(mapCenter);

var position = await marker.GetPosition();
var latitude = position.Lat;
}
}

0 comments on commit 3f6a2d6

Please sign in to comment.