More fixes for tiledImage animation

This commit is contained in:
Ian Gilman 2014-12-02 13:17:56 -08:00
parent 6a7f56d858
commit 09e494091e
3 changed files with 26 additions and 3 deletions

View File

@ -209,6 +209,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
if (this._xSpring.current.value !== oldX || this._ySpring.current.value !== oldY || if (this._xSpring.current.value !== oldX || this._ySpring.current.value !== oldY ||
this._scaleSpring.current.value !== oldScale) { this._scaleSpring.current.value !== oldScale) {
this._updateForScale();
this._needsDraw = true; this._needsDraw = true;
return true; return true;
} }

View File

@ -666,6 +666,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
delete options.index; delete options.index;
} }
if (options.collectionImmediately === undefined) {
options.collectionImmediately = true;
}
var originalSuccess = options.success; var originalSuccess = options.success;
options.success = function(event) { options.success = function(event) {
successes++; successes++;
@ -1237,6 +1241,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* supports except arrays of images. * supports except arrays of images.
* Note that you can specify options.width or options.height, but not both. * Note that you can specify options.width or options.height, but not both.
* The other dimension will be calculated according to the item's aspect ratio. * The other dimension will be calculated according to the item's aspect ratio.
* If collectionMode is on (see {@link OpenSeadragon.Options}), the new image is
* automatically arranged with the others.
* @function * @function
* @param {Object} options * @param {Object} options
* @param {String|Object|Function} options.tileSource - The TileSource specifier. * @param {String|Object|Function} options.tileSource - The TileSource specifier.
@ -1260,6 +1266,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* @param {Function} [options.error] A function that gets called if the image is * @param {Function} [options.error] A function that gets called if the image is
* unable to be added. It's passed the error event object, which contains "message" * unable to be added. It's passed the error event object, which contains "message"
* and "source" properties. * and "source" properties.
* @param {Boolean} [options.collectionImmediately=false] If collectionMode is on,
* specifies whether to snap to the new arrangement immediately or to animate to it.
* @fires OpenSeadragon.World.event:add-item * @fires OpenSeadragon.World.event:add-item
* @fires OpenSeadragon.Viewer.event:add-item-failed * @fires OpenSeadragon.Viewer.event:add-item-failed
*/ */
@ -1355,6 +1363,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
if (_this.collectionMode) { if (_this.collectionMode) {
_this.world.arrange({ _this.world.arrange({
immediately: queueItem.options.collectionImmediately,
rows: _this.collectionRows, rows: _this.collectionRows,
layout: _this.collectionLayout, layout: _this.collectionLayout,
tileSize: _this.collectionTileSize, tileSize: _this.collectionTileSize,

View File

@ -9,7 +9,7 @@
var testInitialOpen = false; var testInitialOpen = false;
var testOverlays = false; var testOverlays = false;
var testMargins = false; var testMargins = false;
var testNavigator = true; var testNavigator = false;
var margins; var margins;
var config = { var config = {
@ -21,7 +21,7 @@
// referenceStripScroll: 'vertical', // referenceStripScroll: 'vertical',
navPrevNextWrap: false, navPrevNextWrap: false,
preserveViewport: false, preserveViewport: false,
// collectionMode: true, collectionMode: true,
// collectionRows: 3, // collectionRows: 3,
// collectionLayout: 'vertical', // collectionLayout: 'vertical',
// collectionTileSize: 10, // collectionTileSize: 10,
@ -112,7 +112,7 @@
} }
if (!testInitialOpen) { if (!testInitialOpen) {
this.gridTest(); this.basicTest();
} }
}, },
@ -132,6 +132,19 @@
image.setPosition(point); image.setPosition(point);
}, },
// ----------
add: function() {
var self = this;
this.viewer.addTiledImage({
tileSource: "../../data/testpattern.dzi",
width: 1,
success: function() {
self.viewer.viewport.goHome();
}
});
},
// ---------- // ----------
basicTest: function() { basicTest: function() {
var self = this; var self = this;