arnaudleclerc / ng-azure-maps

Angular wrapper around azure maps
MIT License
16 stars 14 forks source link

Angular 15 support #81

Closed seawave23 closed 1 year ago

seawave23 commented 1 year ago

Hello, we just updated our project to Angular 15, and realized that this one package is not working with it: image

Is there a chance that this project will be updated or is there any suggestion for a replacement?

arnaudleclerc commented 1 year ago

I just published a version 7.0.0-beta.1 built on angular 15. Do you mind giving it a try and giving me feedback ? If this version works for you, I will publish a stable version.

seawave23 commented 1 year ago

Wow, that was fast! I investigated our issue in the meantime and found out that it throws when setting the bounds input variable in the azure map, as well as when I'm resizing the page with the map. I will give it a try in the next minutes and will report. Thanks a lot for keeping the package alive!

seawave23 commented 1 year ago

@arnaudleclerc: Unfortunately, our problem is still there, and reproducible. We have a toggle that toggles the type of address from coordinates to address. When the user switches the address type, for the coordinates, a matching address is retrieved with the first result of SearchService's searchAddressReverse which contains a viewport. The viewport is passed to the bounds input of the map, transformed like this:

this.bounds = [ viewport.topLeft.longitude, viewport.topLeft.latitude, viewport.bottomRight.longitude, viewport.bottomRight.latitude, ];

Then, the setCamera in the map gets called and throws. Is there probably an error in our mapping which now throws, but before didn't?

EDIT: After debugging everything, I found out that this error happens when the bearing or pitch value is undefined while bounds get set. The reason why this happens is that the properties bearing and pitch are undefined now instead of not existing (as before) when assigned as undefined to cameraOptions on setCamera. Then calculations are done where -0 and undefined are summed up for both which results in NaN, which causes _calcMatrices going wrong suddenly.

This is the place in Atlas where they are summed up: bearing or pitch undefined

This is the place where they are assigned and not existing in the object afterwards (the m variable, before the update): setCamera without bearing and pitch prop

This is the place where they are assigned and existing in the object afterwards (the r variable, after the update): setCamera with bearing pitch prop

So the way to fix this would be to set bearing and pitch always (as a library consumer), or to clean the object upfront to not contain undefined properties at all. Your update is good to go then, I would say - except you would like to add cleaning the properties before calling setCamera in this library. 😎

Pandolfou commented 1 year ago

I just published a version 7.0.0-beta.1 built on angular 15. Do you mind giving it a try and giving me feedback ? If this version works for you, I will publish a stable version.

Hi, I am upgrading my application to angular 15 and try the beta release of ng-azure-maps. All works fine on my side. We have a simple implementation that display locations by coordinates with bubble layers.

jcarloscandela commented 1 year ago

Hi, I have tested it in my project and it is working properly