ProjectSidewalk / SidewalkWebpage

Project Sidewalk web page
http://projectsidewalk.org
MIT License
84 stars 25 forks source link

Fixed occasional zoom in/out in validate bug #3660

Closed srihariKrishnaswamy closed 2 months ago

srihariKrishnaswamy commented 2 months ago

Resolves #3646

As suggested in the issue, I changed the zoomLevel variables in the zoomControl in validate to wrap them with Math.round() so that they were rounded to the appropriate decimal value. I also went into the zoomControl in explore and looked through the commit history to see why we were doing parseInt(zoomLevelIn), and I found that it's been like that since the very first commit where no reasoning was provided. So I went ahead and changed that to a Math.round as well.

Before/After screenshots (if applicable)

Before (couldn't zoom sometimes even if the button wasn't grayed out) image

After (can always zoom until the button is grayed out) image

Testing instructions

I was able to reproduce this issue, albeit occasionally, whenever I went through validate and kept zooming in and zooming out. The exact way I tested this was by going through 4 different validate missions and for each new frame, zooming in and zooming out, making sure that the three zoom levels showed up & the buttons worked every time they were not grayed out.

I also added console.log() statements to print out the original svv.panorama.getPov().zoom & verified that whenever it printed out a decimal (like 1.99999996), we still were able to get the three zoom levels because of the rounding.

  1. Go to validate
  2. Click through frames doing the process described above
  3. Repeat for 4-5 missions
Things to check before submitting the PR
srihariKrishnaswamy commented 2 months ago

Also in testing this PR I found that the default zoom for some panos is different, like some panos we start off at 1, some we start off at 3, etc. Should I fix that in this PR also?