Skip to content

Commit

Permalink
Update Map to take MapSpan as mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarfgp committed Oct 21, 2022
1 parent 97f74c0 commit c0c4fea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
4 changes: 0 additions & 4 deletions samples/HelloMap/HelloMap/App.fs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ module App =
| MapClicked _ -> model, Cmd.none
| MarkerClicked _ -> model, Cmd.none

let map () = Map()

let mapWithRegion () =
Map(MapSpan.FromCenterAndRadius(Position(47.640663, -122.1376177), Distance.FromMiles(250.)))

Expand Down Expand Up @@ -123,11 +121,9 @@ module App =
.strokeColor (Color.Black.ToFabColor())
}


let view (_: Model) =
Application(
(TabbedPage("HelloMap") {
ContentPage("Map", map ())
ContentPage("Region", mapWithRegion ())
ContentPage("Pins", mapWithPins ())
ContentPage("Circle", mapWihCircleElement ())
Expand Down
14 changes: 5 additions & 9 deletions src/Map.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,11 @@ module MapBuilders =

/// <summary>The Map control is a cross-platform view for displaying and annotating maps</summary>
/// <param name ="requestRegion">The region of a map to display when a map is loaded can be set by passing a MapSpan.</param>
static member inline Map<'msg>(?requestRegion: MapSpan) =
match requestRegion with
| Some mapSpan ->
WidgetBuilder<'msg, IMap>(
Map.WidgetKey,
AttributesBundle(StackList.one (Map.RequestedRegion.WithValue(mapSpan)), ValueNone, ValueNone)
)
| None ->
WidgetBuilder<'msg, IMap>(Map.WidgetKey, AttributesBundle(StackList.empty (), ValueNone, ValueNone))
static member inline Map<'msg>(requestRegion: MapSpan) =
WidgetBuilder<'msg, IMap>(
Map.WidgetKey,
AttributesBundle(StackList.one (Map.RequestedRegion.WithValue(requestRegion)), ValueNone, ValueNone)
)

/// <summary>The Map control is a cross-platform view for displaying and annotating maps</summary>
/// <param name ="requestRegion">The region of a map to display when a map is loaded can be set by passing a MapSpan.</param>
Expand Down

0 comments on commit c0c4fea

Please sign in to comment.