ClementCariou / virtual-art-gallery

Explore an Art Gallery in your browser.
https://clementcariou.github.io/virtual-art-gallery/build
MIT License
202 stars 84 forks source link

Panning Camera in Mobile Browser #36

Closed cielcp closed 8 months ago

cielcp commented 8 months ago

Thank you for such a great open source project!

I was having trouble finding the perfect virtual gallery for my class to hold an exhibition, until I found this repo. I really appreciate that it's responsive, easy to deploy, and customizable 👍

One problem I had was that panning the camera around on my iPhone's Safari browser caused the page to shift around, so you could see the white borders of the script and it was hard to navigate. Adding this line to index.js fixed it for me:

// Prevent scrolling on mobile browsers
document.addEventListener('touchmove', function(event) {
    event.preventDefault();
    }, { passive: false });

Hope this helps if you are still maintaining this project or for any users in the future. Thanks again!

ClementCariou commented 8 months ago

Thank you for your feedback ! I've implemented your suggestion directly in the touch event callbacks https://github.com/ClementCariou/virtual-art-gallery/commit/674e29bd8e6572ed7b761aad8bb518090d5adc01. I don't have any iPhone device, can you tell me if the change fixed the issue in the current build ?

cielcp commented 8 months ago

Yes, it works perfectly now :)