Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set MapOptions wont work on WASM #4

Open
SaschaPatschka opened this issue Jun 18, 2022 · 0 comments
Open

Set MapOptions wont work on WASM #4

SaschaPatschka opened this issue Jun 18, 2022 · 0 comments

Comments

@SaschaPatschka
Copy link

SaschaPatschka commented Jun 18, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant