Viewer open event is not being triggered if viewer is initialized without a tile source
but images are later added on with addTiledImage() calls. Therefore, my code below
will not be called.
My code segment below used to start the view with the focused location if the viewer
was called with a specific X, Y, Zoom location (startState is set to true)
myViewer.addHandler('open', function(target) {
window.console.log("in open handler");
if(startState) {
goPosition(newX,newY,newZoom);
startState=false;
}
}
Yes, we consider adding additional images to be different than the initial open. If you want to know when addTiledImage is successful, use this:
myViewer.world.addHandler('add-item', handler);
There is a subtle difference in triggering with viewer's 'open' and with world's 'add-item'.
We want to load an image and followed with a function that calls viewerport.panTo and
viewport.zoomTo to take it to a particular location. Under open-handler that worked
but not with add-item-handler. Tracing it, goHome() was called after add-item event within
OpenSeadragon. If panTo() and zoomTo() were called before goHome(), is there a function
that needs to be called to save the new location as the 'home' location and so all the subsequent items will also be using the same 'home' location?
I see. Well, you can use the preserveViewport: false flag to turn off the goHome entirely, which is probably want you want.
For what it's worth, the success handler passed into addTiledImage happens after the goHome.
Most helpful comment
Yes, we consider adding additional images to be different than the initial open. If you want to know when
addTiledImageis successful, use this: