mistic100/Photo-Sphere-Viewer

Event that fires when motion stopped

Closed this issue · 3 comments

Describe the feature

When I click and drag the panorama there is the PositionUpdatedEvent that fires as I move the view, but it would be nice to have an event that fires when you release the mouse and the movement stops.

The stop-all event fires when I click on the panorama to drag it, before I move anything.

Alternatives you've considered

Could be a mouseUp event or motionStopped event or stopDrag event

Additional context

No response

You can wrap your listener in a debounce function

For example with lodash https://lodash.com/docs/4.17.15#debounce

viewer.addEventListener('position-updated', _.debounce((event) => {

});

ok thanks.
I'll take a look.

something like this works

viewer.addEventListener('position-updated', _.debounce(endMove, 300, {
     'leading': false,
     'trailing': true
   }));

but it would be easier to have an event.