Skip to content

Set MapOptions wont work on WASM #4

Description

@SaschaPatschka

Ha, nice component.

I am using your component on a WASM App and i try to set options but only the position has any effects.

private MapOptions opts { get;set; }


        protected async Task SetLocation()
        {
            //await this.azureMaps.ClearShapes();
            do
            {
                StateHasChanged();
                await Task.Delay(200);
            } while (azureMaps == null);
            await Task.Delay(1000);
            
            opts = new MapOptions
            {
                Center = new[] { Longitude, this.Latitude },
                Zoom = 16,
                View = ViewEnum.AE,
                Style = "all",
                EnableAccessibility = true,
                Interactive = true,
                ShowBuildingModels = true,
                ShowLogo = false,


            };

            var drawingManagerOptions = new DrawingManagerOptions
            {
                Latitude = this.Latitude,
                Longitude = this.Longitude,
                Radius = this.Radius
            };

            await this.azureMaps.SetCamera(opts);
            await this.azureMaps.AddShape(drawingManagerOptions, "pin", null);

            var properties = new ShapeProperties
            {
                SubType = "Circle",
                Radius = this.Radius
            };
            await this.azureMaps.AddShape(drawingManagerOptions, "circle", properties);
            
            
        }

On open i must set a delay because the component is null for long time on Blazor WASM?

private async Task OpenDialog(int id)
        {
            visibleDialog = true;

            var dat = pagedData.Where(x => x.Id == id).Single();
            Latitude = (double)dat.Latitude.Value;
            Longitude = (double)dat.Longitude.Value;
            await SetLocation();
        } 

Do you have an idea why this wont work, or maybe a workaround?
Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions