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;}
}
@bdrichards I don't think you can do that.
But you cand destroy and recreate a navigator on button click.
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.
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.....
This might be helpful (see the last comments for working code):
https://github.com/openseadragon/openseadragon/issues/713
Most helpful comment
Another option is to change the visibility of the navigator:
There is a small issue with that, the red rectangle indicating the current position of the viewport will sometimes be misplaced after a toggle.