Added Rect.union; allowed minZoomLevel greater than home zoom

This commit is contained in:
Ian Gilman 2015-01-13 15:31:52 -08:00
parent ef20ccc1e7
commit e4c3dfc8dd
3 changed files with 18 additions and 1 deletions

View File

@ -40,6 +40,8 @@ OPENSEADRAGON CHANGELOG
* Overlays appear in the DOM immediately on open or addOverlay (#507) * Overlays appear in the DOM immediately on open or addOverlay (#507)
* imageLoaderLimit now works (#544) * imageLoaderLimit now works (#544)
* Turning off scrollToZoom in gestureSettings now allows scroll events to propagate * Turning off scrollToZoom in gestureSettings now allows scroll events to propagate
* You can now set a minZoomLevel that's greater than the home zoom level
* Added union() to OpenSeadragon.Rect
1.2.1: (in progress) 1.2.1: (in progress)

View File

@ -201,6 +201,21 @@ $.Rect.prototype = /** @lends OpenSeadragon.Rect.prototype */{
); );
}, },
/**
* Returns the smallest rectangle that will contain this and the given rectangle.
* @param {OpenSeadragon.Rect} rect
* @return {OpenSeadragon.Rect} The new rectangle.
*/
// ----------
union: function(rect) {
var left = Math.min(this.x, rect.x);
var top = Math.min(this.y, rect.y);
var right = Math.max(this.x + this.width, rect.x + rect.width);
var bottom = Math.max(this.y + this.height, rect.y + rect.height);
return new OpenSeadragon.Rect(left, top, right - left, bottom - top);
},
/** /**
* Rotates a rectangle around a point. Currently only 90, 180, and 270 * Rotates a rectangle around a point. Currently only 90, 180, and 270
* degrees are supported. * degrees are supported.

View File

@ -275,7 +275,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
this.minZoomLevel : this.minZoomLevel :
this.minZoomImageRatio * homeZoom; this.minZoomImageRatio * homeZoom;
return Math.min( zoom, homeZoom ); return zoom;
}, },
/** /**