/// <summary> /// Create a polygon using the passed PolygonOptions, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions. /// A polygon may contain one or more paths, where each path consists of an array of LatLngs. /// </summary> public Polygon(IJSRuntime jsRuntime, MapEventJsInterop jsEventInterop, PolygonOptions opts = null) : base(jsRuntime) { if (opts?.Map != null) { _map = opts.Map; } _jsRuntime.JsonNetInvokeAsync <bool>("googleMapPolygonJsFunctions.init", _guid, opts); _jsEventInterop = jsEventInterop; //if (opts != null) //{ // _map = opts.Map; // _jsRuntime.InvokeWithDefinedGuidAsync<bool>( // "googleMapPolygonJsFunctions.init", // _guid.ToString(), // opts); //} //else //{ // _jsRuntime.InvokeWithDefinedGuidAsync<bool>( // "googleMapPolygonJsFunctions.init", // _guid.ToString()); //} }
/// <summary> /// Create a polygon using the passed PolygonOptions, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions. /// A polygon may contain one or more paths, where each path consists of an array of LatLngs. /// </summary> /// <param name="opts"></param> public async static Task <Polygon> CreateAsync(IJSRuntime jsRuntime, PolygonOptions opts = null) { var jsObjectRef = await JsObjectRef.CreateAsync(jsRuntime, "google.maps.Polygon", opts); var obj = new Polygon(jsObjectRef, opts); return(obj); }
/// <summary> /// Sets the first path. See PolygonOptions for more details. /// </summary> /// <param name="options"></param> public Task SetOptions(PolygonOptions options) { return(_jsRuntime.InvokeWithDefinedGuidAndMethodAsync <bool>( "googleMapPolygonJsFunctions.invoke", _guid.ToString(), "setOptions", options)); }
/// <summary> /// Create a polygon using the passed PolygonOptions, which specify the polygon's path, the stroke style for the polygon's edges, and the fill style for the polygon's interior regions. /// A polygon may contain one or more paths, where each path consists of an array of LatLngs. /// </summary> /// <param name="opts"></param> private Polygon(JsObjectRef jsObjectRef, PolygonOptions opts = null) { _jsObjectRef = jsObjectRef; _map = opts?.Map; }
/// <summary> /// Sets the first path. See PolygonOptions for more details. /// </summary> /// <param name="options"></param> public Task SetOptions(PolygonOptions options) { return(_jsObjectRef.InvokeAsync( "setOptions", options)); }