mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
Fixed broken test
This commit is contained in:
parent
9347cfe692
commit
b371af712e
@ -405,7 +405,7 @@ $.Viewer = function( options ) {
|
|||||||
THIS[ _this.hash ].forceRedraw = true;
|
THIS[ _this.hash ].forceRedraw = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.world.addHandler('home-bounds-change', function(event) {
|
this.world.addHandler('metrics-change', function(event) {
|
||||||
if (_this.viewport) {
|
if (_this.viewport) {
|
||||||
_this.viewport.setHomeBounds(_this.world.getHomeBounds(), _this.world.getContentFactor());
|
_this.viewport.setHomeBounds(_this.world.getHomeBounds(), _this.world.getContentFactor());
|
||||||
}
|
}
|
||||||
@ -436,6 +436,8 @@ $.Viewer = function( options ) {
|
|||||||
margins: this.viewportMargins
|
margins: this.viewportMargins
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.viewport.setHomeBounds(this.world.getHomeBounds(), this.world.getContentFactor());
|
||||||
|
|
||||||
// Create the image loader
|
// Create the image loader
|
||||||
this.imageLoader = new $.ImageLoader();
|
this.imageLoader = new $.ImageLoader();
|
||||||
|
|
||||||
|
19
src/world.js
19
src/world.js
@ -65,7 +65,7 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
* @param {OpenSeadragon.TiledImage} item - The item to add.
|
* @param {OpenSeadragon.TiledImage} item - The item to add.
|
||||||
* @param {Number} [options.index] - Index for the item. If not specified, goes at the top.
|
* @param {Number} [options.index] - Index for the item. If not specified, goes at the top.
|
||||||
* @fires OpenSeadragon.World.event:add-item
|
* @fires OpenSeadragon.World.event:add-item
|
||||||
* @fires OpenSeadragon.World.event:home-bounds-change
|
* @fires OpenSeadragon.World.event:metrics-change
|
||||||
*/
|
*/
|
||||||
addItem: function( item, options ) {
|
addItem: function( item, options ) {
|
||||||
$.console.assert(item, "[World.addItem] item is required");
|
$.console.assert(item, "[World.addItem] item is required");
|
||||||
@ -172,7 +172,7 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
* Remove an item.
|
* Remove an item.
|
||||||
* @param {OpenSeadragon.TiledImage} item - The item to remove.
|
* @param {OpenSeadragon.TiledImage} item - The item to remove.
|
||||||
* @fires OpenSeadragon.World.event:remove-item
|
* @fires OpenSeadragon.World.event:remove-item
|
||||||
* @fires OpenSeadragon.World.event:home-bounds-change
|
* @fires OpenSeadragon.World.event:metrics-change
|
||||||
*/
|
*/
|
||||||
removeItem: function( item ) {
|
removeItem: function( item ) {
|
||||||
$.console.assert(item, "[World.removeItem] item is required");
|
$.console.assert(item, "[World.removeItem] item is required");
|
||||||
@ -192,7 +192,7 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
/**
|
/**
|
||||||
* Remove all items.
|
* Remove all items.
|
||||||
* @fires OpenSeadragon.World.event:remove-item
|
* @fires OpenSeadragon.World.event:remove-item
|
||||||
* @fires OpenSeadragon.World.event:home-bounds-change
|
* @fires OpenSeadragon.World.event:metrics-change
|
||||||
*/
|
*/
|
||||||
removeAll: function() {
|
removeAll: function() {
|
||||||
var item;
|
var item;
|
||||||
@ -268,7 +268,7 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
* @param {Number} [options.rows] - See collectionRows in {@link OpenSeadragon.Options}.
|
* @param {Number} [options.rows] - See collectionRows in {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.tileSize] - See collectionTileSize in {@link OpenSeadragon.Options}.
|
* @param {Number} [options.tileSize] - See collectionTileSize in {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.tileMargin] - See collectionTileMargin in {@link OpenSeadragon.Options}.
|
* @param {Number} [options.tileMargin] - See collectionTileMargin in {@link OpenSeadragon.Options}.
|
||||||
* @fires OpenSeadragon.World.event:home-bounds-change
|
* @fires OpenSeadragon.World.event:metrics-change
|
||||||
*/
|
*/
|
||||||
arrange: function(options) {
|
arrange: function(options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
@ -318,6 +318,8 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
// private
|
// private
|
||||||
_figureSizes: function() {
|
_figureSizes: function() {
|
||||||
var oldHomeBounds = this._homeBounds ? this._homeBounds.clone() : null;
|
var oldHomeBounds = this._homeBounds ? this._homeBounds.clone() : null;
|
||||||
|
var oldContentSize = this._contentSize ? this._contentSize.clone() : null;
|
||||||
|
var oldContentFactor = this._contentFactor || 0;
|
||||||
|
|
||||||
if ( !this._items.length ) {
|
if ( !this._items.length ) {
|
||||||
this._homeBounds = new $.Rect(0, 0, 1, 1);
|
this._homeBounds = new $.Rect(0, 0, 1, 1);
|
||||||
@ -344,16 +346,17 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
this._homeBounds.height * this._contentFactor);
|
this._homeBounds.height * this._contentFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._homeBounds.equals(oldHomeBounds)) {
|
if (this._contentFactor !== oldContentFactor || !this._homeBounds.equals(oldHomeBounds) ||
|
||||||
|
!this._contentSize.equals(oldContentSize)) {
|
||||||
/**
|
/**
|
||||||
* Raised when the home bounds change.
|
* Raised when the home bounds, content size, or content factor change.
|
||||||
* @event home-bounds-change
|
* @event metrics-change
|
||||||
* @memberOf OpenSeadragon.World
|
* @memberOf OpenSeadragon.World
|
||||||
* @type {object}
|
* @type {object}
|
||||||
* @property {OpenSeadragon.World} eventSource - A reference to the World which raised the event.
|
* @property {OpenSeadragon.World} eventSource - A reference to the World which raised the event.
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
*/
|
*/
|
||||||
this.raiseEvent('home-bounds-change');
|
this.raiseEvent('metrics-change', {});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user