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

Initialize MapOptions #1

Open
lombardk opened this issue Apr 27, 2022 · 12 comments
Open

Initialize MapOptions #1

lombardk opened this issue Apr 27, 2022 · 12 comments

Comments

@lombardk
Copy link

Dear jgraves
Please update the sample to show how MapOptions must be initialized to change center/zoom.

@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jun 17, 2022

I apologize for the late response, I have updated the readme file to contain more information regarding this issue. It is contained in step 5 of the documentation.

@lombardk
Copy link
Author

thank you.

@lombardk
Copy link
Author

Dear jgraves

I have created Map element with MapOptions defined:
<Map @ref="gMap" MapOptions="mapOpt" Map_Click="(e) => MapClicked((MapLatLng)e)" Map_DoubleClick="(e) => MapDoubleClicked((MapLatLng)e)" Map_RightClick="(e) => MapRightClicked((MapLatLng)e)"
Marker_Click="(e) => MarkerClicked((MapElementMouseEvent)e)" MapId="MapElement">

Code:
private MapOptions mapOpt { get; set; }
protected async override Task OnInitializedAsync()
{
await base.OnInitializedAsync();

        while (gMap is null)
        {
            await Task.Delay(25);
        }

        mapOpt = new MapOptions { center = new MapLatLng { lat = -25.4, lng = 28.0}, zoom = 15, tilt = 0 };

        StateHasChanged();
    }

the above results in the map not being rendered i.e. just beige background with no tiles rendered. panning/zooming the map gives the following error in browser's developer console:
map.js:55 Uncaught TypeError: Cannot read properties of null (reading 'zoom')
at Vka (map.js:55:513)
at HTMLDivElement. (map.js:54:453)
Vka @ map.js:55
(anonymous) @ map.js:54

I will appreciate your assistance to resolve the above.

Regards
Kobus

@lombardk lombardk reopened this Jul 11, 2022
@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jul 11, 2022 via email

@lombardk
Copy link
Author

lombardk commented Jul 11, 2022 via email

@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jul 11, 2022 via email

@lombardk
Copy link
Author

lombardk commented Jul 11, 2022 via email

@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jul 11, 2022 via email

@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jul 11, 2022 via email

@lombardk
Copy link
Author

lombardk commented Jul 11, 2022 via email

@joeygraves222
Copy link
Collaborator

joeygraves222 commented Jul 11, 2022 via email

@lombardk
Copy link
Author

lombardk commented Jul 12, 2022 via email

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

2 participants