diff --git a/changelog.txt b/changelog.txt
index c04d490a..4393908a 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -35,6 +35,7 @@ OPENSEADRAGON CHANGELOG
* Rect and Point now have clone functions
* New Viewport method for managing homeBounds as well as constraints: setHomeBounds
* Viewport.open supports positioning config properties
+ * For multi-image open, drawing isn't started until all tileSources have been opened
* Margins option to push the home region in from the edges of the Viewer (#505)
* Rect and Point toString() functions are now consistent: rounding values to nearest hundredth
* Overlays appear in the DOM immediately on open or addOverlay (#507)
diff --git a/src/viewer.js b/src/viewer.js
index 60e64e8a..4f74b6ac 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -524,6 +524,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
return;
}
+ this._opening = true;
+
var expected = tileSources.length;
var successes = 0;
var failures = 0;
@@ -552,6 +554,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
}
_this._drawOverlays();
+ _this._opening = false;
/**
* Raised when the viewer has opened and loaded one or more TileSources.
@@ -566,6 +569,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
// TODO: what if there are multiple sources?
_this.raiseEvent( 'open', { source: source } );
} else {
+ _this._opening = false;
+
/**
* Raised when an error occurs loading a TileSource.
*
@@ -655,6 +660,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
return this;
}
+ this._opening = false;
+
if ( this.navigator ) {
this.navigator.close();
}
@@ -2794,6 +2801,10 @@ function updateOnce( viewer ) {
//viewer.profiler.beginUpdate();
+ if (viewer._opening) {
+ return;
+ }
+
if ( viewer.autoResize ) {
var containerSize = _getSafeElemSize( viewer.container );
if ( !containerSize.equals( THIS[ viewer.hash ].prevContainerSize ) ) {
diff --git a/test/demo/m2/README.md b/test/demo/m2/README.md
index 847f90c2..881cfbdb 100644
--- a/test/demo/m2/README.md
+++ b/test/demo/m2/README.md
@@ -10,11 +10,12 @@ http://showcase.iiif.io/viewer/mirador/
## To Do
-* Choosing between multiple versions of a page
* Detail images overlaid on the page
* Cropped images
### Maybe
+* Alternates: align with default image
+* Alternates: wait until tiles have loaded before switching
* Show/hide pages?
* Lazyloading tilesources?
diff --git a/test/demo/m2/index.html b/test/demo/m2/index.html
index e86c9a39..70c4c486 100644
--- a/test/demo/m2/index.html
+++ b/test/demo/m2/index.html
@@ -6,6 +6,7 @@
+