NREL / floorspace.js

Other
66 stars 35 forks source link

Small rotation of the map does not remain #396

Open jbkoh opened 2 years ago

jbkoh commented 2 years ago

Hello there, thanks for the great project! I know this repo is not actively maintained, but if anybody can give me any guidance, I'd be happy to contribute my time for fixing the bug.

My issue is: when I try to rotate the map for around 5 degree or less, the rotation does not remain and goes back to the original state.

Thanks!

Mkellyeng commented 2 years ago

Taking a quick look, the rotation is handled in one of two different areas, depending on whether you use the map overlay or not. The rotation issue occurs with the map overlay, when you use your mouse to rotate the screen, right?

I believe that's handled in Map.vue (...\src\components\Canvas\Map.vue), though I'm not super familiar with it

Looking over it, I can see it doing some math with the map rotation. I'd guess that it's related to how the map adjusts it's resolution, or some precision issue in how it calculates the rotation. Can't quite tell though

I'd probably start with this this.rotation = this.view.getRotation();

jbkoh commented 2 years ago

Thanks for sharing the pointer! I will take a look (or let my colleague do it). Based on the behavior, I'm guessing it's snapping to the right north when the degree is close to that.

https://user-images.githubusercontent.com/1572627/126119944-783fdf41-a19b-4e3e-9092-a591a83fcf18.mov