intended use case clarification for stopAll firing onMouseDown event.
See original GitHub issueHello!
First of all, I have been using your library for years and I think it’s very useful. Thanks a bunch for creating and maintaining this!
Recently I was experimenting with the Virtual Tour Plugin, and to use it I needed to upgrade to a newer version.
After upgrading the version I noticed the gyroscope plugin is being disabled whenever I click the screen. I traced this back to the onMouseDown method in the photo-sphere-viewer javascript file:
_proto.__onMouseDown = function __onMouseDown() {
if (!this.prop.enabled) {
return;
}
this.psv.__stopAll();
this.psv.dynamics.position.roll(this.prop.value);
this.prop.handler.down();
}
This fires the stopAll method which calls the stop method on the gryoscope plugin:
_proto.handleEvent = function handleEvent(e) {
switch (e.type) {
case photoSphereViewer.CONSTANTS.EVENTS.STOP_ALL:
this.stop();
break;
case photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER:
this.__onBeforeRender();
break;
case photoSphereViewer.CONSTANTS.EVENTS.BEFORE_ROTATE:
this.__onBeforeRotate(e);
break;
}
}
which then disables the gyroscope plugin altogether:
_proto.stop = function stop() {
if (this.isEnabled()) {
this.controls.disconnect();
this.prop.enabled = false;
this.psv.config.moveInertia = this.prop.config_moveInertia;
this.trigger(EVENTS.GYROSCOPE_UPDATED, false);
this.psv.resetIdleTimer();
}
}
My question is: Is this the intended functionality for onMouseDown? If so, why is it built out like this? For my use case, we allow users to interact with markers on the screen while using the gyroscope, so that being disabled makes the whole experience quite a bit clunkier. If this is intended are there any good workarounds to make sure the gyroscope remains enabled when the user clicks a marker or somewhere on the spherical viewer?
I’ve dug around quite a bit on this issue, but I realize that I could be completely missing something here, if so please just let me know.
Versions- Photo-Sphere-Viewer: ^4.7.0 Three.js: ^0.129.0 Chrome: 104.0.5112.82
Thanks for your time and your reply!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
The intention is to replace the gyroscope control by manual movement if the user swipes. Perhaps something breaks in recent changes or it never allowed clicks while staying in gyroscope mode.
I’ll see if the “__stopAll” call be delayed depending on the touch travel (same threshold as the “click”) https://github.com/mistic100/Photo-Sphere-Viewer/blob/107f7a46f362d67bc405d834735337934b13d394/src/services/EventsHandler.js#L603-L608
This feature/bug fix has been released in version 4.7.3.