Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sometimes can't fully zoom in/out on Validate #3646

Closed
misaugstad opened this issue Sep 5, 2024 · 1 comment · Fixed by #3660
Closed

Sometimes can't fully zoom in/out on Validate #3646

misaugstad opened this issue Sep 5, 2024 · 1 comment · Fixed by #3660
Assignees

Comments

@misaugstad
Copy link
Member

Brief description of problem/feature

Occasionally I'm only able to zoom in/out between two zoom levels, when we are supposed to be able to zoom between three. The UI will show that you can continue to zoom, but clicking on the buttons won't actually zoom.

Potential solution(s)

The issue seems to be that we'll be set to a non-integer zoom, and we aren't rounding to the nearest integer. I'm running into this issue now, for example, and svv.panorama.getPov().zoom is returning 1.9999999999999996. The valid zoom levels are 1, 2, and 3, so we should be able to zoom out one more time, but I'm not able to. I took a look at ZoomConrol.js, and noticed that we are just adding/subtracting 1 to the zoom level and setting it, so we never deal with the non-integer zoom.

    function zoomOut () {
        let zoomLevel = svv.panorama.getPov().zoom;
        if (zoomLevel >= 2) {
            zoomLevel -= 1;
            svv.panorama.setZoom(zoomLevel);
        }
        updateZoomAvailability();
    }

Here, zoomLevel is not greater than or equal to 2, so we won't zoom out again.

In both zoomIn() and zoomOut(), we should change

let zoomLevel = svv.panorama.getPov().zoom;

to

let zoomLevel = Math.round(svv.panorama.getPov().zoom);
@misaugstad
Copy link
Member Author

I've also noticed that on the Explore page, we're using parseInt() instead of Math.round(). At first glance this seems less than ideal. My guess is that in this situation, it would make it so that the first time you try to zoom in we say that the current zoom level is parseInt(1.9999999999999996) which would be 1, then we increase the zoom to 2. So it would look like nothing happened. Then if you try to zoom in a second time it works correctly, setting the zoom to 3. I haven't tested this and seen it happen, but that's my guess. I would want to go back in the git history and old PRs to see if there was a reason for implementing it this way.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants