Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions src/BlazorUI/Bit.BlazorUI.Extras/Components/Map/BitMap.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -804,32 +804,32 @@ await _js.BitMapAddRectangle(JsObject, _Id, r.LayerId,

private string JsObject => _activeProvider!.JsObjectName;

private static object ToMarkerPayload(BitMapMarker m) => new
{
lat = m.Position.Latitude,
lng = m.Position.Longitude,
title = m.Title,
popupHtml = m.PopupHtml?.Value,
popupText = m.PopupText,
tooltipHtml = m.TooltipHtml?.Value,
tooltipText = m.TooltipText,
tooltipPermanent = m.TooltipPermanent,
tooltipDirection = m.TooltipDirection.ToString().ToLowerInvariant(),
draggable = m.Draggable,
iconUrl = m.IconUrl,
iconWidth = m.IconWidth,
iconHeight = m.IconHeight,
zIndexOffset = m.ZIndexOffset,
private static object ToMarkerPayload(BitMapMarker m) => new Dictionary<string, object?>
{
["lat"] = m.Position.Latitude,
["lng"] = m.Position.Longitude,
["title"] = m.Title,
["popupHtml"] = m.PopupHtml?.Value,
["popupText"] = m.PopupText,
["tooltipHtml"] = m.TooltipHtml?.Value,
["tooltipText"] = m.TooltipText,
["tooltipPermanent"] = m.TooltipPermanent,
["tooltipDirection"] = m.TooltipDirection.ToString().ToLowerInvariant(),
["draggable"] = m.Draggable,
["iconUrl"] = m.IconUrl,
["iconWidth"] = m.IconWidth,
["iconHeight"] = m.IconHeight,
["zIndexOffset"] = m.ZIndexOffset,
};

private static object ToTileOverlayPayload(BitMapTileOverlay o) => new
private static object ToTileOverlayPayload(BitMapTileOverlay o) => new Dictionary<string, object?>
{
id = o.Id,
urlTemplate = o.UrlTemplate,
attribution = o.Attribution,
opacity = o.Opacity,
zIndex = o.ZIndex,
maxZoom = o.MaxZoom,
["id"] = o.Id,
["urlTemplate"] = o.UrlTemplate,
["attribution"] = o.Attribution,
["opacity"] = o.Opacity,
["zIndex"] = o.ZIndex,
["maxZoom"] = o.MaxZoom,
};

private static BitMapMarker CloneWithPosition(BitMapMarker prev, BitMapLatLng position) => new()
Expand All @@ -855,21 +855,21 @@ private static object[] ToLatLngArray(IReadOnlyList<BitMapLatLng> pts)
var arr = new object[pts.Count];
for (var i = 0; i < pts.Count; i++)
{
arr[i] = new { lat = pts[i].Latitude, lng = pts[i].Longitude };
arr[i] = new Dictionary<string, object?> { ["lat"] = pts[i].Latitude, ["lng"] = pts[i].Longitude };
}
return arr;
}

private static object? ToStylePayload(BitMapVectorPathStyle? s) => s is null
? null
: new
{
color = s.Color,
weight = s.Weight,
opacity = s.Opacity,
fillColor = s.FillColor,
fillOpacity = s.FillOpacity,
dashArray = s.DashArray,
: new Dictionary<string, object?>
{
["color"] = s.Color,
["weight"] = s.Weight,
["opacity"] = s.Opacity,
["fillColor"] = s.FillColor,
["fillOpacity"] = s.FillOpacity,
["dashArray"] = s.DashArray,
};

private static BitMapLatLng ReadLatLng(JsonElement e) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected void ValidateCommonOptions()

return new Dictionary<string, object?>
{
["center"] = new { lat = Center.Latitude, lng = Center.Longitude },
["center"] = new Dictionary<string, object?> { ["lat"] = Center.Latitude, ["lng"] = Center.Longitude },
["zoom"] = Zoom,
["minZoom"] = MinZoom,
["maxZoom"] = MaxZoom,
Expand All @@ -140,10 +140,10 @@ protected void ValidateCommonOptions()
["dragPan"] = Dragging,
["keyboardNavigation"] = KeyboardNavigation,
["maxBounds"] = MaxBounds is { } b
? new
? new Dictionary<string, object?>
{
southWest = new { lat = b.SouthWest.Latitude, lng = b.SouthWest.Longitude },
northEast = new { lat = b.NorthEast.Latitude, lng = b.NorthEast.Longitude },
["southWest"] = new Dictionary<string, object?> { ["lat"] = b.SouthWest.Latitude, ["lng"] = b.SouthWest.Longitude },
["northEast"] = new Dictionary<string, object?> { ["lat"] = b.NorthEast.Latitude, ["lng"] = b.NorthEast.Longitude },
}
: null,
};
Expand Down
Loading