From 88c488d70606061c9c0be35a07b1dfb15b373fc1 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 10 Feb 2015 11:30:36 -0800 Subject: [PATCH 1/4] For multi-image open, drawing isn't started until all tileSources have been opened --- changelog.txt | 1 + src/viewer.js | 11 +++++++++++ 2 files changed, 12 insertions(+) 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 ) ) { From f531a18531aff8fd1889cf65a478cc33f1f19729 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 10 Feb 2015 11:42:36 -0800 Subject: [PATCH 2/4] Fixed mouse positioning (m2) --- test/demo/m2/js/main.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/demo/m2/js/main.js b/test/demo/m2/js/main.js index 33af2b5b..0e86b766 100644 --- a/test/demo/m2/js/main.js +++ b/test/demo/m2/js/main.js @@ -93,11 +93,13 @@ }) .mousemove(function(event) { var pixel = new OpenSeadragon.Point(event.clientX, event.clientY); + pixel.y -= self.$scrollCover.position().top; var result = self.hitTest(self.viewer.viewport.pointFromPixel(pixel)); self.updateHover(result ? result.index : -1); }) .click(function(event) { var pixel = new OpenSeadragon.Point(event.clientX, event.clientY); + pixel.y -= self.$scrollCover.position().top; var result = self.hitTest(self.viewer.viewport.pointFromPixel(pixel)); if (result) { self.setMode({ From 5443eedebc628f3e14b03b1bf69b8b8b2b885461 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 10 Feb 2015 11:53:56 -0800 Subject: [PATCH 3/4] Fixed positioning issue when going to book mode with tall images (m2) --- test/demo/m2/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/demo/m2/js/main.js b/test/demo/m2/js/main.js index 0e86b766..0959cc3e 100644 --- a/test/demo/m2/js/main.js +++ b/test/demo/m2/js/main.js @@ -415,7 +415,7 @@ item = this.viewer.world.getItemAt(this.page - 1); if (item) { box = item.getBounds(); - x -= width; + x -= box.width; width += box.width; } } From ae7adad5cf4f81e9356a618bf541965ce8131527 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 10 Feb 2015 14:02:41 -0800 Subject: [PATCH 4/4] Alternate images (m2) --- test/demo/m2/README.md | 3 +- test/demo/m2/index.html | 1 + test/demo/m2/js/main.js | 62 +++++++++++++++++++++++++++++++++++++---- test/demo/m2/js/page.js | 44 +++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 test/demo/m2/js/page.js 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 @@ +