Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoRotateInactivityDelay without autoRotate causes it to lookAt on scene start #1222

Open
aproni34f opened this issue Jul 4, 2024 · 3 comments
Labels

Comments

@aproni34f
Copy link

aproni34f commented Jul 4, 2024

I am not sure if I got this correctly.

I start / stop autoRotate manually on button using Viewer.startAutoRotate / stopAutoRotate.

I still want to have autoRotateInactivityDelay set in settings.

This causes viewer on start to look at even if autoRotate is not set in scene options, for example:

pannellum.viewer('panorama', {
    "type": "equirectangular",
    "panorama": "blah.jpg",
    "autoRotateInactivityDelay": 1000,
});

I dont want this to happen.

If I look into pannellum.js it seems this code is running on start:

        animating = false;
        prevTime = undefined;
        var autoRotateStartTime = config.autoRotateInactivityDelay -
            (Date.now() - latestInteraction);
        if (autoRotateStartTime > 0) {
            autoRotateStart = setTimeout(function() {
                config.autoRotate = autoRotateSpeed;
                _this.lookAt(origPitch, undefined, origHfov, 3000);
                animateInit();
            }, autoRotateStartTime);
        }

If this is the case, how can I manually use Viewer.startAutoRotate and still have autoRotateInactivityDelay option?

@mpetroff
Copy link
Owner

mpetroff commented Jul 4, 2024

This causes viewer on start to look at even if autoRotate is not set in scene options

The autoRotateInactivityDelay option isn't meant to be used if the autoRotate option is not used. Despite this, I made a change in 83084e8 to prevent it from doing anything.

how can I manually use Viewer.startAutoRotate and still have autoRotateInactivityDelay option?

The startAutoRotate method has an optional inactivityDelay parameter, which needs to be set if you want an inactivity delay when using the method. Regardless of the initial configuration, the stopAutoRotate method will remove any existing inactivity delay settings, so even if one existed originally, you'd still need to set it when calling startAutoRotate.

@aproni34f
Copy link
Author

According to documentation:

startAutoRotate()
Parameters:
speed
pitch

Where is inactivityDelay (should it be autoRotateInactivityDelay )?

@mpetroff
Copy link
Owner

mpetroff commented Jul 5, 2024

Sorry, it was added in a84fc56 and is not in the v2.5.6 release, which is what the documentation on pannellum.org corresponds to. You can look at the docstring in src/js/pannellum.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants