question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

intended use case clarification for stopAll firing onMouseDown event.

See original GitHub issue

Hello!

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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mistic100commented, Aug 18, 2022

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

0reactions
github-actions[bot]commented, Sep 19, 2022

This feature/bug fix has been released in version 4.7.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

support option to stop propagation of events in React tree · ...
We cannot stop all events propagation from portal to its React tree ance. ... I will try to clarify our use-case of the...
Read more >
Photo-Sphere-Viewer
intended use case clarification for stopAll firing onMouseDown event. ... I traced this back to the onMouseDown method in the photo-sphere-viewer javascript ...
Read more >
Element: mousedown event - Web APIs | MDN
The mousedown event is fired at an Element when a pointing device button is pressed while the pointer is inside the element.
Read more >
Why OnMouseDown Event occur once , how to handle ...
mouseup and mousedown are not supposed to continuously fire. They are meant to signal a single action has happened.
Read more >
[BUG-16346] Button: onMouseDown event triggers on a ...
I need a button on a view to complete the same script whether it is touched or clicked. I quickly realized that I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found