Encountering a TypeError in the browser console when attempting to call FromLatLngToPoint on a projection object in the OnAfterMapInit() method. The error suggests that obj is undefined in objectManager.js in the context of this function call.
Reproduction Code
private async Task OnAfterMapInit()
{
var projection = await map1.InteropObject.GetProjection();
var testPointFromLatLng = await projection.FromLatLngToPoint(new LatLngLiteral()
{
Lat = 59.612529,
Lng = 16.567550
});
if (testPointFromLatLng is null)
{
// This should not happen
}
}
Console Error
TypeError: Cannot read properties of undefined (reading 'fromLatLngToPoint')
at Object.invoke (objectManager.js:536:40)
at blazor.server.js:1:3501
...
Source Code Context
In the source code, the error occurs at:
else if (functionToInvoke == "fromLatLngToPoint") {
try {
var point = obj[functionToInvoke](args2[0]);
return point;
} catch (e) {
console.log(e);
}
}
Additional Observations
The issue does not occur when bypassing the GoogleMap component and creating a map manually using a div element.
Expected Behavior
The method FromLatLngToPoint should be called without any errors, and obj in objectManager.js should not be undefined.
Description
Encountering a
TypeError
in the browser console when attempting to callFromLatLngToPoint
on a projection object in theOnAfterMapInit()
method. The error suggests thatobj
is undefined inobjectManager.js
in the context of this function call.Reproduction Code
Console Error
Source Code Context
In the source code, the error occurs at:
Additional Observations
Expected Behavior
The method
FromLatLngToPoint
should be called without any errors, andobj
inobjectManager.js
should not beundefined
.