diff --git a/src/drawer.js b/src/drawer.js
index ebdf9c77..6f7af45c 100644
--- a/src/drawer.js
+++ b/src/drawer.js
@@ -49,7 +49,7 @@ var DEVICE_SCREEN = $.getWindowSize(),
/**
* @class Drawer
- * @classdesc Handles rendering of tiles for an {@link OpenSeadragon.Viewer}.
+ * @classdesc Handles rendering of tiles for an {@link OpenSeadragon.Viewer}.
* A new instance is created for each TileSource opened (see {@link OpenSeadragon.Viewer#drawer}).
*
* @memberof OpenSeadragon
@@ -74,6 +74,9 @@ $.Drawer = function( options ) {
$.extend( true, this, {
+ x: 0,
+ y: 0,
+
//internal state properties
viewer: null,
imageLoader: new $.ImageLoader(),
@@ -380,6 +383,11 @@ function updateViewport( drawer ) {
levelOpacity,
levelVisibility;
+ viewportTL.x -= drawer.x;
+ viewportTL.y -= drawer.y;
+ viewportBR.x -= drawer.x;
+ viewportBR.y -= drawer.y;
+
// Reset tile's internal drawn state
while ( drawer.lastDrawn.length > 0 ) {
tile = drawer.lastDrawn.pop();
@@ -636,7 +644,8 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le
drawer.source.tileOverlap,
drawer.viewport,
viewportCenter,
- levelVisibility
+ levelVisibility,
+ drawer
);
if ( tile.loaded ) {
@@ -793,9 +802,13 @@ function onTileLoad( drawer, tile, time, image ) {
}
-function positionTile( tile, overlap, viewport, viewportCenter, levelVisibility ){
- var boundsTL = tile.bounds.getTopLeft(),
- boundsSize = tile.bounds.getSize(),
+function positionTile( tile, overlap, viewport, viewportCenter, levelVisibility, drawer ){
+ var boundsTL = tile.bounds.getTopLeft();
+
+ boundsTL.x += drawer.x;
+ boundsTL.y += drawer.y;
+
+ var boundsSize = tile.bounds.getSize(),
positionC = viewport.pixelFromPoint( boundsTL, true ),
positionT = viewport.pixelFromPoint( boundsTL, false ),
sizeC = viewport.deltaPixelsFromPoints( boundsSize, true ),
diff --git a/src/viewer.js b/src/viewer.js
index 7ba1e7c0..8be09980 100644
--- a/src/viewer.js
+++ b/src/viewer.js
@@ -111,7 +111,7 @@ $.Viewer = function( options ) {
/**
* A <textarea> element, the element where keyboard events are handled.
* Child element of {@link OpenSeadragon.Viewer#container},
- * positioned below {@link OpenSeadragon.Viewer#canvas}.
+ * positioned below {@link OpenSeadragon.Viewer#canvas}.
* @member {Element} keyboardCommandArea
* @memberof OpenSeadragon.Viewer#
*/
@@ -120,7 +120,7 @@ $.Viewer = function( options ) {
* A <div> element, the element where user-input events are handled for panning and zooming.
* Child element of {@link OpenSeadragon.Viewer#container},
* positioned on top of {@link OpenSeadragon.Viewer#keyboardCommandArea}.
- * The parent of {@link OpenSeadragon.Drawer#canvas} instances.
+ * The parent of {@link OpenSeadragon.Drawer#canvas} instances.
* @member {Element} canvas
* @memberof OpenSeadragon.Viewer#
*/
@@ -246,14 +246,14 @@ $.Viewer = function( options ) {
if( this.tileSources.length > 1 ){
THIS[ this.hash ].sequenced = true;
}
-
+
//Keeps the initial page within bounds
if ( this.initialPage > this.tileSources.length - 1 ){
this.initialPage = this.tileSources.length - 1;
}
-
+
initialTileSource = this.tileSources[ this.initialPage ];
-
+
//Update the sequence (aka currrent page) property
THIS[ this.hash ].sequence = this.initialPage;
} else {
@@ -529,12 +529,12 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* @fires OpenSeadragon.Viewer.event:close
*/
close: function ( ) {
-
+
if ( !THIS[ this.hash ] ) {
//this viewer has already been destroyed: returning immediately
return this;
}
-
+
if ( this._updateRequestId !== null ) {
$.cancelAnimationFrame( this._updateRequestId );
this._updateRequestId = null;
@@ -579,7 +579,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* Function to destroy the viewer and clean up everything created by OpenSeadragon.
- *
+ *
* Example:
* var viewer = OpenSeadragon({
* [...]
@@ -596,8 +596,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
//TODO: implement this...
//this.unbindSequenceControls()
- //this.unbindStandardControls()
-
+ //this.unbindStandardControls()
+
this.removeAllHandlers();
// Go through top element (passed to us) and remove all children
@@ -1096,24 +1096,26 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
return;
}
- for ( var i = 0; i < _this.drawers.length; i++ ) {
- var otherAspectRatio = _this.drawers[ i ].source.aspectRatio;
- var diff = otherAspectRatio - tileSource.aspectRatio;
- if ( Math.abs( diff ) > _this.layersAspectRatioEpsilon ) {
- raiseAddLayerFailed({
- message: "Aspect ratio mismatch with layer " + i + ".",
- source: tileSource,
- options: options
- });
- return;
- }
- }
+ // for ( var i = 0; i < _this.drawers.length; i++ ) {
+ // var otherAspectRatio = _this.drawers[ i ].source.aspectRatio;
+ // var diff = otherAspectRatio - tileSource.aspectRatio;
+ // if ( Math.abs( diff ) > _this.layersAspectRatioEpsilon ) {
+ // raiseAddLayerFailed({
+ // message: "Aspect ratio mismatch with layer " + i + ".",
+ // source: tileSource,
+ // options: options
+ // });
+ // return;
+ // }
+ // }
var drawer = new $.Drawer({
viewer: _this,
source: tileSource,
viewport: _this.viewport,
element: _this.drawersContainer,
+ x: options.x !== undefined ? options.x : 0,
+ y: options.y !== undefined ? options.y : 0,
opacity: options.opacity !== undefined ?
options.opacity : _this.opacity,
maxImageCacheCount: _this.maxImageCacheCount,
@@ -1249,7 +1251,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/**
* Remove a layer. If there is only one layer, close the viewer.
* @function
- * @param {OpenSeadragon.Drawer} drawer The underlying drawer of the layer
+ * @param {OpenSeadragon.Drawer} drawer The underlying drawer of the layer
* to remove
* @returns {OpenSeadragon.Viewer} Chainable.
* @fires OpenSeadragon.Viewer.event:remove-layer
@@ -1540,7 +1542,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
}
return this;
},
-
+
/**
* Gets the active page of a sequence
* @function
@@ -1779,7 +1781,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
}
}
},
-
+
/**
* Display a message in the viewport
* @function OpenSeadragon.Viewer.prototype._showMessage
diff --git a/src/viewport.js b/src/viewport.js
index aadb81e9..fae70dc9 100644
--- a/src/viewport.js
+++ b/src/viewport.js
@@ -326,6 +326,10 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
* @fires OpenSeadragon.Viewer.event:constrain
*/
applyConstraints: function( immediately ) {
+ if (true) {
+ return; // TEMP
+ }
+
var actualZoom = this.getZoom(),
constrainedZoom = Math.max(
Math.min( actualZoom, this.getMaxZoom() ),
@@ -653,7 +657,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
}
this.degrees = degrees;
this.viewer.forceRedraw();
-
+
return this;
},
@@ -991,7 +995,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
return viewerCoordinates.plus(
OpenSeadragon.getElementPosition( this.viewer.element ));
},
-
+
/**
* Convert a viewport zoom to an image zoom.
* Image zoom: ratio of the original image size to displayed image size.
@@ -1009,7 +1013,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
var viewportToImageZoomRatio = containerWidth / imageWidth;
return viewportZoom * viewportToImageZoomRatio;
},
-
+
/**
* Convert an image zoom to a viewport zoom.
* Image zoom: ratio of the original image size to displayed image size.
diff --git a/test/demo/collections/index.html b/test/demo/collections/index.html
new file mode 100644
index 00000000..9afe8907
--- /dev/null
+++ b/test/demo/collections/index.html
@@ -0,0 +1,22 @@
+
+
+