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

Dynamically toggle navigator? #907

Closed
bdrichards opened this issue Apr 7, 2016 · 4 comments
Closed

Dynamically toggle navigator? #907

bdrichards opened this issue Apr 7, 2016 · 4 comments
Labels

Comments

@bdrichards
Copy link

I know this must be very basic, but what would be the syntax in a button onclick event to dynamically toggle the navigator?

    function toggleNav(){
        if (viewer.showNavigator){
            viewer.showNavigator = false;}
        else {viewer.showNavigator = true;}
    }

@harlet
Copy link

harlet commented Apr 7, 2016

@bdrichards I don't think you can do that.
But you cand destroy and recreate a navigator on button click.

See OpenSeadragon.Navigator

@avandecreme
Copy link
Member

Another option is to change the visibility of the navigator:

            var viewer = OpenSeadragon({
                // debugMode: true,
                id: "contentDiv",
                prefixUrl: "../../build/openseadragon/images/",
                tileSources: "../data/testpattern.dzi",
                showNavigator: true
            });

            var navigatorShown = true;
            function toggleNavigator() {
                navigatorShown = !navigatorShown;
                viewer.navigator.element.style.display = navigatorShown ? 'block' : 'none';
            }

There is a small issue with that, the red rectangle indicating the current position of the viewport will sometimes be misplaced after a toggle.

@bdrichards
Copy link
Author

Thanks for the ideas to investigate.
Simply hiding the navigator could work; however, my motivation to have the ability to completely turn off the navigator in order to collect some performance stats. I need to check how much of a performance hit the Navigator imposes.....

@adgoncal
Copy link
Contributor

adgoncal commented May 6, 2016

This might be helpful (see the last comments for working code):
#713

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

5 participants