Open i-to-z opened 4 years ago
The "strange code" is there for a reason, so your proposed change potentially introduces regressions. It was added to fix some intermittent bugs with changing direction with yaw limits set, as well as some issues that occurred when switching away from and then back to the browser tab. I don't remember all of the details, since the change was made four years ago. See bf9c6f50730ae0d30223dec9d2603617f47bc34b, #170, #213.
For most browsers, the error is ~2%, which I don't consider to be a problem for this sort of functionality. I suspect the larger difference with Firefox probably has something to do with the anti-fingerprinting protections that reduce the accuracy of timers. Although I can't immediately reproduce the issues that code change was introduced to fix after reverting it, I'm hesitant to make a change to "fix" something I don't really consider to be broken due to the risk of reintroducing the bugs that the original change was meant to fix.
Hello Matthew, I am using the latest panellum v. 2.5.6 on ubuntu 18 desktop, with various browsers (described below).
I have a simple web page that waits for a panorama to load (at initial yaw=90), then rotates it at speed -5 degrees/second for 10 seconds, then gets the end yaw (aka horizontal rotation degree). So the end yaw (after 10 seconds) should be 90 + 5*10 = 140. But the result is always wrong:
On Opera: After 10 seconds of rotating: current yaw=136.99477978932896; it should be 140 On Firefox: After 10 seconds of rotating: current yaw=120.46426666666707; it should be 140 On Chrome: After 10 seconds of rotating: current yaw=137.57165254399365; it should be 140 On Chromium: After 10 seconds of rotating: current yaw=137.41833774068527; it should be 140
I played with different speeds and initial yaw, the result is always wrong.
So I did some digging and I found this strange code: https://github.com/mpetroff/pannellum/blob/master/src/js/pannellum.js#L1255
I replaced lines 1255 and 1256 with: const yawDiff = -1 config.autoRotate timeDiff; ... and now it works properly. I will appreciate if you could make this fix in the codebase.
Below is the meaningful part of my code.
Thanks,