Fixed broken defaultZoomLevel and homeFillsViewer options

This commit is contained in:
Ian Gilman 2015-01-02 11:44:35 -08:00
parent cd329016bb
commit a7d9f7dcd5
3 changed files with 17 additions and 3 deletions

View File

@ -230,7 +230,16 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @function * @function
*/ */
getHomeBounds: function() { getHomeBounds: function() {
return this.homeBounds.clone(); var center = this.homeBounds.getCenter( ),
width = 1.0 / this.getHomeZoom( ),
height = width / this.getAspectRatio();
return new $.Rect(
center.x - ( width / 2.0 ),
center.y - ( height / 2.0 ),
width,
height
);
}, },
/** /**

View File

@ -17,6 +17,8 @@
zoomPerScroll: 1.02, zoomPerScroll: 1.02,
showNavigator: testNavigator, showNavigator: testNavigator,
useCanvas: true, useCanvas: true,
// defaultZoomLevel: 2,
// homeFillsViewer: true,
// sequenceMode: true, // sequenceMode: true,
// showReferenceStrip: true, // showReferenceStrip: true,
// referenceStripScroll: 'vertical', // referenceStripScroll: 'vertical',
@ -70,7 +72,10 @@
} }
]; ];
// config.tileSources = highsmith; // config.tileSources = {
// tileSource: highsmith,
// width: 1
// };
} }
if (testOverlays) { if (testOverlays) {

View File

@ -207,7 +207,7 @@
method: 'getHomeBounds', method: 'getHomeBounds',
processExpected: function(level, expected) { processExpected: function(level, expected) {
// Have to special case this to avoid dividing by 0 // Have to special case this to avoid dividing by 0
if(level === 0){ if(level === -1 || level === 0){
expected = new OpenSeadragon.Rect(0, 0, 1, 1); expected = new OpenSeadragon.Rect(0, 0, 1, 1);
} else { } else {
var sideLength = 1.0 / viewer.defaultZoomLevel; // it's a square in this case var sideLength = 1.0 / viewer.defaultZoomLevel; // it's a square in this case