diff --git a/changelog.txt b/changelog.txt index efe6e936..1e7f78a5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -40,6 +40,8 @@ OPENSEADRAGON CHANGELOG * Overlays appear in the DOM immediately on open or addOverlay (#507) * imageLoaderLimit now works (#544) * 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) diff --git a/src/rectangle.js b/src/rectangle.js index 6c8c9243..5d3495af 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -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 * degrees are supported. diff --git a/src/viewport.js b/src/viewport.js index 44654f7e..0f7f5cf1 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -275,7 +275,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{ this.minZoomLevel : this.minZoomImageRatio * homeZoom; - return Math.min( zoom, homeZoom ); + return zoom; }, /**