Merge branch 'master' into lint

Fixed Conflicts:
	openseadragon.js
	src/drawer.js
This commit is contained in:
Ian Gilman 2013-01-31 09:26:55 -08:00
commit 527682d5a6
21 changed files with 339 additions and 108 deletions

View File

@ -6,7 +6,7 @@
PROJECT: openseadragon PROJECT: openseadragon
BUILD_MAJOR: 0 BUILD_MAJOR: 0
BUILD_MINOR: 9 BUILD_MINOR: 9
BUILD_ID: 90 BUILD_ID: 92
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID} BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID} VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}

View File

@ -1,7 +1,7 @@
/*globals OpenSeadragon */ /*globals OpenSeadragon */
/** /**
* @version OpenSeadragon 0.9.90 * @version OpenSeadragon 0.9.92
* *
* @fileOverview * @fileOverview
* <h2> * <h2>
@ -526,6 +526,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
maxImageCacheCount: 200, maxImageCacheCount: 200,
minZoomImageRatio: 0.8, minZoomImageRatio: 0.8,
maxZoomPixelRatio: 2, maxZoomPixelRatio: 2,
timeout: 5000,
//INTERFACE RESOURCE SETTINGS //INTERFACE RESOURCE SETTINGS
prefixUrl: "/images/", prefixUrl: "/images/",
@ -3685,6 +3686,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
contentSize: this.source.dimensions, contentSize: this.source.dimensions,
springStiffness: this.springStiffness, springStiffness: this.springStiffness,
animationTime: this.animationTime, animationTime: this.animationTime,
showNavigator: false,
minZoomImageRatio: 1, minZoomImageRatio: 1,
maxZoomPixelRatio: 1 maxZoomPixelRatio: 1
}); });
@ -3739,13 +3741,14 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
immediateRender: this.immediateRender, immediateRender: this.immediateRender,
blendTime: this.blendTime, blendTime: this.blendTime,
alwaysBlend: this.alwaysBlend, alwaysBlend: this.alwaysBlend,
minPixelRatio: this.minPixelRatio, minPixelRatio: this.collectionMode ? 0 : this.minPixelRatio,
timeout: this.timeout,
debugMode: this.debugMode, debugMode: this.debugMode,
debugGridColor: this.debugGridColor debugGridColor: this.debugGridColor
}); });
//Instantiate a navigator if configured //Instantiate a navigator if configured
if ( this.showNavigator && ! this.navigator ){ if ( this.showNavigator && ! this.navigator && !this.collectionMode ){
this.navigator = new $.Navigator({ this.navigator = new $.Navigator({
id: this.navigatorElement, id: this.navigatorElement,
position: this.navigatorPosition, position: this.navigatorPosition,
@ -3942,8 +3945,8 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
bodyStyle.width = "100%"; bodyStyle.width = "100%";
bodyStyle.height = "100%"; bodyStyle.height = "100%";
canvasStyle.backgroundColor = "black"; //canvasStyle.backgroundColor = "black";
canvasStyle.color = "white"; //canvasStyle.color = "white";
//containerStyle.position = "fixed"; //containerStyle.position = "fixed";
@ -4745,7 +4748,7 @@ $.Navigator = function( options ){
} }
options = $.extend( true, { options = $.extend( true, {
navigatorSizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio
}, options, { }, options, {
element: this.element, element: this.element,
//These need to be overridden to prevent recursion since //These need to be overridden to prevent recursion since
@ -4902,8 +4905,8 @@ $.Navigator = function( options ){
this.element.style.width = options.width + 'px'; this.element.style.width = options.width + 'px';
this.element.style.height = options.height + 'px'; this.element.style.height = options.height + 'px';
} else { } else {
this.element.style.width = ( viewerSize.x * options.navigatorSizeRatio ) + 'px'; this.element.style.width = ( viewerSize.x * options.sizeRatio ) + 'px';
this.element.style.height = ( viewerSize.y * options.navigatorSizeRatio ) + 'px'; this.element.style.height = ( viewerSize.y * options.sizeRatio ) + 'px';
} }
$.Viewer.apply( this, [ options ] ); $.Viewer.apply( this, [ options ] );
@ -5770,7 +5773,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, {
} }
dziPath = url.split('/'); dziPath = url.split('/');
dziName = dziPath.pop(); dziName = dziPath.pop();
dziName = dziName.substring(0, dziName.indexOf('.')); dziName = dziName.substring(0, dziName.lastIndexOf('.'));
dziPath = '/' + dziPath.join('/') + '/' + dziName + '_files/'; dziPath = '/' + dziPath.join('/') + '/' + dziName + '_files/';
tilesUrl = dziPath; tilesUrl = dziPath;
if( host ){ if( host ){
@ -7690,7 +7693,8 @@ $.Tile.prototype = {
drawHTML: function( container ) { drawHTML: function( container ) {
var position = this.position.apply( Math.floor ), var position = this.position.apply( Math.floor ),
size = this.size.apply( Math.ceil ); size = this.size.apply( Math.ceil )
containerSize = $.getElementSize( container );
if ( !this.loaded || !this.image ) { if ( !this.loaded || !this.image ) {
$.console.warn( $.console.warn(
@ -7701,26 +7705,48 @@ $.Tile.prototype = {
} }
if ( !this.element ) { if ( !this.element ) {
this.element = $.makeNeutralElement("img"); this.element = $.makeNeutralElement("img");
this.element.src = this.url; this.element.src = this.url;
this.style = this.element.style;
this.style = this.element.style;
this.style.position = "absolute"; this.style.position = "absolute";
this.style.msInterpolationMode = "nearest-neighbor"; this.style.msInterpolationMode = "nearest-neighbor";
} }
if ( this.element.parentNode != container ) { if ( this.element.parentNode != container ) {
container.appendChild( this.element ); container.appendChild( this.element );
} }
this.element.style.left = position.x + "px"; this.style.top = position.y + "px";
this.element.style.top = position.y + "px"; this.style.left = position.x + "px";
this.element.style.width = size.x + "px"; this.style.height = size.y + "px";
this.element.style.height = size.y + "px"; this.style.width = size.x + "px";
//EXPERIMENTAL - trying to figure out how to scale the container
// content during animation of the container size.
/*
if ( !this.element ) {
this.element = $.makeNeutralElement("div");
this.image = $.makeNeutralElement("img");
this.image.src = this.url;
this.image.style.height = '100%';
this.image.style.width = '100%';
this.image.style.msInterpolationMode = "nearest-neighbor";
this.element.appendChild( this.image );
this.style = this.element.style;
this.style.position = "absolute";
}
this.style.right = "0px";
this.style.bottom = "0px";
if ( size.y == containerSize.y || size.x == containerSize.x ){
this.style.right = position.x + "px";
this.style.bottom = position.y + "px";
}
*/
$.setElementOpacity( this.element, this.opacity ); $.setElementOpacity( this.element, this.opacity );
}, },
/** /**
@ -7741,7 +7767,23 @@ $.Tile.prototype = {
return; return;
} }
context.globalAlpha = this.opacity; context.globalAlpha = this.opacity;
context.save();
if( context.globalAlpha == 1 && this.image.src.match('.png') ){
context.clearRect(
position.x+1,
position.y+1,
size.x-2,
size.y-2
);
}
context.drawImage( this.image, position.x, position.y, size.x, size.y ); context.drawImage( this.image, position.x, position.y, size.x, size.y );
context.restore();
}, },
/** /**
@ -7938,8 +7980,7 @@ $.Tile.prototype = {
(function( $ ){ (function( $ ){
var TIMEOUT = 5000, var DEVICE_SCREEN = $.getWindowSize(),
DEVICE_SCREEN = $.getWindowSize(),
BROWSER = $.Browser.vendor, BROWSER = $.Browser.vendor,
BROWSER_VERSION = $.Browser.version, BROWSER_VERSION = $.Browser.version,
@ -8008,6 +8049,7 @@ $.Drawer = function( options ) {
midUpdate: false, midUpdate: false,
updateAgain: true, updateAgain: true,
//internal state / configurable settings //internal state / configurable settings
overlays: [], overlays: [],
collectionOverlays: {}, collectionOverlays: {},
@ -8022,7 +8064,8 @@ $.Drawer = function( options ) {
blendTime: $.DEFAULT_SETTINGS.blendTime, blendTime: $.DEFAULT_SETTINGS.blendTime,
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend, alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio, minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
debugMode: $.DEFAULT_SETTINGS.debugMode debugMode: $.DEFAULT_SETTINGS.debugMode,
timeout: $.DEFAULT_SETTINGS.timeout
}, options ); }, options );
@ -8259,7 +8302,7 @@ $.Drawer.prototype = {
jobid = window.setTimeout( function(){ jobid = window.setTimeout( function(){
finishLoadingImage( image, complete, false, jobid ); finishLoadingImage( image, complete, false, jobid );
}, TIMEOUT ); }, this.timeout );
loading = true; loading = true;
image.src = src; image.src = src;
@ -8323,8 +8366,12 @@ function updateViewport( drawer ) {
//TODO //TODO
drawer.canvas.innerHTML = ""; drawer.canvas.innerHTML = "";
if ( USE_CANVAS ) { if ( USE_CANVAS ) {
drawer.canvas.width = viewportSize.x; if( drawer.canvas.width != viewportSize.x ||
drawer.canvas.height = viewportSize.y; drawer.canvas.height != viewportSize.y
){
drawer.canvas.width = viewportSize.x;
drawer.canvas.height = viewportSize.y;
}
drawer.context.clearRect( 0, 0, viewportSize.x, viewportSize.y ); drawer.context.clearRect( 0, 0, viewportSize.x, viewportSize.y );
} }
@ -8568,12 +8615,17 @@ function getTile( x, y, level, tileSource, tilesMatrix, time, numTiles, normHeig
function loadTile( drawer, tile, time ) { function loadTile( drawer, tile, time ) {
tile.loading = drawer.loadImage( if( drawer.viewport.collectionMode ){
tile.url, drawer.midUpdate = false;
function( image ){ onTileLoad( drawer, tile, time );
onTileLoad( drawer, tile, time, image ); } else {
} tile.loading = drawer.loadImage(
); tile.url,
function( image ){
onTileLoad( drawer, tile, time, image );
}
);
}
} }
function onTileLoad( drawer, tile, time, image ) { function onTileLoad( drawer, tile, time, image ) {
@ -8593,7 +8645,7 @@ function onTileLoad( drawer, tile, time, image ) {
if ( drawer.midUpdate ) { if ( drawer.midUpdate ) {
$.console.warn( "Tile load callback in middle of drawing routine." ); $.console.warn( "Tile load callback in middle of drawing routine." );
return; return;
} else if ( !image ) { } else if ( !image && !drawer.viewport.collectionMode ) {
$.console.log( "Tile %s failed to load: %s", tile, tile.url ); $.console.log( "Tile %s failed to load: %s", tile, tile.url );
tile.exists = false; tile.exists = false;
return; return;
@ -8929,9 +8981,9 @@ function drawTiles( drawer, lastDrawn ){
'below 0px -webkit-gradient('+ 'below 0px -webkit-gradient('+
'linear,left '+ 'linear,left '+
'top,left '+ 'top,left '+
'bottom,from(transparent),color-stop(60%,transparent),to(rgba(255,255,255,0.4))'+ 'bottom,from(transparent),color-stop(62%,transparent),to(rgba(255,255,255,0.62))'+
')'; ')';
style['border'] = '1px solid rgba(255,255,255,0.2)'; style['border'] = '1px solid rgba(255,255,255,0.38)';
//style['borderRight'] = '1px solid #fff'; //style['borderRight'] = '1px solid #fff';
}(viewer.element.style)); }(viewer.element.style));
@ -9104,6 +9156,7 @@ $.Viewport.prototype = {
this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY ); this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY );
this.homeBounds = this.fitHeightBounds; this.homeBounds = this.fitHeightBounds;
return this;
}, },
/** /**
@ -9289,6 +9342,7 @@ $.Viewport.prototype = {
bounds.y += dy; bounds.y += dy;
this.fitBounds( bounds, immediately ); this.fitBounds( bounds, immediately );
} }
return this;
}, },
/** /**
@ -9297,6 +9351,7 @@ $.Viewport.prototype = {
*/ */
ensureVisible: function( immediately ) { ensureVisible: function( immediately ) {
this.applyConstraints( immediately ); this.applyConstraints( immediately );
return this;
}, },
/** /**
@ -9334,7 +9389,7 @@ $.Viewport.prototype = {
newZoom = 1.0 / newBounds.width; newZoom = 1.0 / newBounds.width;
if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) { if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) {
this.panTo( center, immediately ); this.panTo( center, immediately );
return; return this;
} }
referencePoint = oldBounds.getTopLeft().times( referencePoint = oldBounds.getTopLeft().times(
@ -9349,6 +9404,7 @@ $.Viewport.prototype = {
); );
this.zoomTo( newZoom, referencePoint, immediately ); this.zoomTo( newZoom, referencePoint, immediately );
return this;
}, },
/** /**
@ -9361,6 +9417,7 @@ $.Viewport.prototype = {
} else { } else {
return this.fitHorizontally( immediately ); return this.fitHorizontally( immediately );
} }
return this;
}, },
/** /**
@ -9385,6 +9442,7 @@ $.Viewport.prototype = {
} }
this.fitBounds( this.homeBounds, immediately ); this.fitBounds( this.homeBounds, immediately );
return this;
}, },
/** /**
@ -9409,6 +9467,7 @@ $.Viewport.prototype = {
} }
this.fitBounds( this.homeBounds, immediately ); this.fitBounds( this.homeBounds, immediately );
return this;
}, },
@ -9423,6 +9482,7 @@ $.Viewport.prototype = {
this.centerSpringY.target.value this.centerSpringY.target.value
); );
this.panTo( center.plus( delta ), immediately ); this.panTo( center.plus( delta ), immediately );
return this;
}, },
/** /**
@ -9438,6 +9498,8 @@ $.Viewport.prototype = {
this.centerSpringX.springTo( center.x ); this.centerSpringX.springTo( center.x );
this.centerSpringY.springTo( center.y ); this.centerSpringY.springTo( center.y );
} }
return this;
}, },
/** /**
@ -9445,6 +9507,7 @@ $.Viewport.prototype = {
*/ */
zoomBy: function( factor, refPoint, immediately ) { zoomBy: function( factor, refPoint, immediately ) {
this.zoomTo( this.zoomSpring.target.value * factor, refPoint, immediately ); this.zoomTo( this.zoomSpring.target.value * factor, refPoint, immediately );
return this;
}, },
/** /**
@ -9452,15 +9515,18 @@ $.Viewport.prototype = {
*/ */
zoomTo: function( zoom, refPoint, immediately ) { zoomTo: function( zoom, refPoint, immediately ) {
this.zoomPoint = refPoint instanceof $.Point ?
refPoint :
null;
if ( immediately ) { if ( immediately ) {
this.zoomSpring.resetTo( zoom ); this.zoomSpring.resetTo( zoom );
} else { } else {
this.zoomSpring.springTo( zoom ); this.zoomSpring.springTo( zoom );
} }
this.zoomPoint = refPoint instanceof $.Point ?
refPoint : return this;
null;
}, },
/** /**
@ -9482,6 +9548,8 @@ $.Viewport.prototype = {
} }
this.fitBounds( newBounds, true ); this.fitBounds( newBounds, true );
return this;
}, },
/** /**

View File

@ -2,8 +2,7 @@
(function( $ ){ (function( $ ){
var TIMEOUT = 5000, var DEVICE_SCREEN = $.getWindowSize(),
DEVICE_SCREEN = $.getWindowSize(),
BROWSER = $.Browser.vendor, BROWSER = $.Browser.vendor,
BROWSER_VERSION = $.Browser.version, BROWSER_VERSION = $.Browser.version,
@ -72,6 +71,7 @@ $.Drawer = function( options ) {
midUpdate: false, midUpdate: false,
updateAgain: true, updateAgain: true,
//internal state / configurable settings //internal state / configurable settings
overlays: [], overlays: [],
collectionOverlays: {}, collectionOverlays: {},
@ -86,7 +86,8 @@ $.Drawer = function( options ) {
blendTime: $.DEFAULT_SETTINGS.blendTime, blendTime: $.DEFAULT_SETTINGS.blendTime,
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend, alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio, minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
debugMode: $.DEFAULT_SETTINGS.debugMode debugMode: $.DEFAULT_SETTINGS.debugMode,
timeout: $.DEFAULT_SETTINGS.timeout
}, options ); }, options );
@ -323,7 +324,7 @@ $.Drawer.prototype = {
jobid = window.setTimeout( function(){ jobid = window.setTimeout( function(){
finishLoadingImage( image, complete, false, jobid ); finishLoadingImage( image, complete, false, jobid );
}, TIMEOUT ); }, this.timeout );
loading = true; loading = true;
image.src = src; image.src = src;
@ -387,8 +388,12 @@ function updateViewport( drawer ) {
//TODO //TODO
drawer.canvas.innerHTML = ""; drawer.canvas.innerHTML = "";
if ( USE_CANVAS ) { if ( USE_CANVAS ) {
drawer.canvas.width = viewportSize.x; if( drawer.canvas.width != viewportSize.x ||
drawer.canvas.height = viewportSize.y; drawer.canvas.height != viewportSize.y
){
drawer.canvas.width = viewportSize.x;
drawer.canvas.height = viewportSize.y;
}
drawer.context.clearRect( 0, 0, viewportSize.x, viewportSize.y ); drawer.context.clearRect( 0, 0, viewportSize.x, viewportSize.y );
} }
@ -632,12 +637,17 @@ function getTile( x, y, level, tileSource, tilesMatrix, time, numTiles, normHeig
function loadTile( drawer, tile, time ) { function loadTile( drawer, tile, time ) {
tile.loading = drawer.loadImage( if( drawer.viewport.collectionMode ){
tile.url, drawer.midUpdate = false;
function( image ){ onTileLoad( drawer, tile, time );
onTileLoad( drawer, tile, time, image ); } else {
} tile.loading = drawer.loadImage(
); tile.url,
function( image ){
onTileLoad( drawer, tile, time, image );
}
);
}
} }
function onTileLoad( drawer, tile, time, image ) { function onTileLoad( drawer, tile, time, image ) {
@ -657,7 +667,7 @@ function onTileLoad( drawer, tile, time, image ) {
if ( drawer.midUpdate ) { if ( drawer.midUpdate ) {
$.console.warn( "Tile load callback in middle of drawing routine." ); $.console.warn( "Tile load callback in middle of drawing routine." );
return; return;
} else if ( !image ) { } else if ( !image && !drawer.viewport.collectionMode ) {
$.console.log( "Tile %s failed to load: %s", tile, tile.url ); $.console.log( "Tile %s failed to load: %s", tile, tile.url );
tile.exists = false; tile.exists = false;
return; return;
@ -993,9 +1003,9 @@ function drawTiles( drawer, lastDrawn ){
'below 0px -webkit-gradient('+ 'below 0px -webkit-gradient('+
'linear,left '+ 'linear,left '+
'top,left '+ 'top,left '+
'bottom,from(transparent),color-stop(60%,transparent),to(rgba(255,255,255,0.4))'+ 'bottom,from(transparent),color-stop(62%,transparent),to(rgba(255,255,255,0.62))'+
')'; ')';
style['border'] = '1px solid rgba(255,255,255,0.2)'; style['border'] = '1px solid rgba(255,255,255,0.38)';
//style['borderRight'] = '1px solid #fff'; //style['borderRight'] = '1px solid #fff';
}(viewer.element.style)); }(viewer.element.style));

View File

@ -112,7 +112,7 @@ $.extend( $.DziTileSource.prototype, $.TileSource.prototype, {
} }
dziPath = url.split('/'); dziPath = url.split('/');
dziName = dziPath.pop(); dziName = dziPath.pop();
dziName = dziName.substring(0, dziName.indexOf('.')); dziName = dziName.substring(0, dziName.lastIndexOf('.'));
dziPath = '/' + dziPath.join('/') + '/' + dziName + '_files/'; dziPath = '/' + dziPath.join('/') + '/' + dziName + '_files/';
tilesUrl = dziPath; tilesUrl = dziPath;
if( host ){ if( host ){

View File

@ -31,7 +31,7 @@ $.Navigator = function( options ){
} }
options = $.extend( true, { options = $.extend( true, {
navigatorSizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio sizeRatio: $.DEFAULT_SETTINGS.navigatorSizeRatio
}, options, { }, options, {
element: this.element, element: this.element,
//These need to be overridden to prevent recursion since //These need to be overridden to prevent recursion since
@ -188,8 +188,8 @@ $.Navigator = function( options ){
this.element.style.width = options.width + 'px'; this.element.style.width = options.width + 'px';
this.element.style.height = options.height + 'px'; this.element.style.height = options.height + 'px';
} else { } else {
this.element.style.width = ( viewerSize.x * options.navigatorSizeRatio ) + 'px'; this.element.style.width = ( viewerSize.x * options.sizeRatio ) + 'px';
this.element.style.height = ( viewerSize.y * options.navigatorSizeRatio ) + 'px'; this.element.style.height = ( viewerSize.y * options.sizeRatio ) + 'px';
} }
$.Viewer.apply( this, [ options ] ); $.Viewer.apply( this, [ options ] );

View File

@ -526,6 +526,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
maxImageCacheCount: 200, maxImageCacheCount: 200,
minZoomImageRatio: 0.8, minZoomImageRatio: 0.8,
maxZoomPixelRatio: 2, maxZoomPixelRatio: 2,
timeout: 5000,
//INTERFACE RESOURCE SETTINGS //INTERFACE RESOURCE SETTINGS
prefixUrl: "/images/", prefixUrl: "/images/",

View File

@ -80,7 +80,8 @@ $.Tile.prototype = {
drawHTML: function( container ) { drawHTML: function( container ) {
var position = this.position.apply( Math.floor ), var position = this.position.apply( Math.floor ),
size = this.size.apply( Math.ceil ); size = this.size.apply( Math.ceil )
containerSize = $.getElementSize( container );
if ( !this.loaded || !this.image ) { if ( !this.loaded || !this.image ) {
$.console.warn( $.console.warn(
@ -91,26 +92,48 @@ $.Tile.prototype = {
} }
if ( !this.element ) { if ( !this.element ) {
this.element = $.makeNeutralElement("img"); this.element = $.makeNeutralElement("img");
this.element.src = this.url; this.element.src = this.url;
this.style = this.element.style;
this.style = this.element.style;
this.style.position = "absolute"; this.style.position = "absolute";
this.style.msInterpolationMode = "nearest-neighbor"; this.style.msInterpolationMode = "nearest-neighbor";
} }
if ( this.element.parentNode != container ) { if ( this.element.parentNode != container ) {
container.appendChild( this.element ); container.appendChild( this.element );
} }
this.element.style.left = position.x + "px"; this.style.top = position.y + "px";
this.element.style.top = position.y + "px"; this.style.left = position.x + "px";
this.element.style.width = size.x + "px"; this.style.height = size.y + "px";
this.element.style.height = size.y + "px"; this.style.width = size.x + "px";
//EXPERIMENTAL - trying to figure out how to scale the container
// content during animation of the container size.
/*
if ( !this.element ) {
this.element = $.makeNeutralElement("div");
this.image = $.makeNeutralElement("img");
this.image.src = this.url;
this.image.style.height = '100%';
this.image.style.width = '100%';
this.image.style.msInterpolationMode = "nearest-neighbor";
this.element.appendChild( this.image );
this.style = this.element.style;
this.style.position = "absolute";
}
this.style.right = "0px";
this.style.bottom = "0px";
if ( size.y == containerSize.y || size.x == containerSize.x ){
this.style.right = position.x + "px";
this.style.bottom = position.y + "px";
}
*/
$.setElementOpacity( this.element, this.opacity ); $.setElementOpacity( this.element, this.opacity );
}, },
/** /**
@ -131,7 +154,23 @@ $.Tile.prototype = {
return; return;
} }
context.globalAlpha = this.opacity; context.globalAlpha = this.opacity;
context.save();
if( context.globalAlpha == 1 && this.image.src.match('.png') ){
context.clearRect(
position.x+1,
position.y+1,
size.x-2,
size.y-2
);
}
context.drawImage( this.image, position.x, position.y, size.x, size.y ); context.drawImage( this.image, position.x, position.y, size.x, size.y );
context.restore();
}, },
/** /**

View File

@ -373,6 +373,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
contentSize: this.source.dimensions, contentSize: this.source.dimensions,
springStiffness: this.springStiffness, springStiffness: this.springStiffness,
animationTime: this.animationTime, animationTime: this.animationTime,
showNavigator: false,
minZoomImageRatio: 1, minZoomImageRatio: 1,
maxZoomPixelRatio: 1 maxZoomPixelRatio: 1
}); });
@ -427,13 +428,14 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
immediateRender: this.immediateRender, immediateRender: this.immediateRender,
blendTime: this.blendTime, blendTime: this.blendTime,
alwaysBlend: this.alwaysBlend, alwaysBlend: this.alwaysBlend,
minPixelRatio: this.minPixelRatio, minPixelRatio: this.collectionMode ? 0 : this.minPixelRatio,
timeout: this.timeout,
debugMode: this.debugMode, debugMode: this.debugMode,
debugGridColor: this.debugGridColor debugGridColor: this.debugGridColor
}); });
//Instantiate a navigator if configured //Instantiate a navigator if configured
if ( this.showNavigator && ! this.navigator ){ if ( this.showNavigator && ! this.navigator && !this.collectionMode ){
this.navigator = new $.Navigator({ this.navigator = new $.Navigator({
id: this.navigatorElement, id: this.navigatorElement,
position: this.navigatorPosition, position: this.navigatorPosition,
@ -630,8 +632,8 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
bodyStyle.width = "100%"; bodyStyle.width = "100%";
bodyStyle.height = "100%"; bodyStyle.height = "100%";
canvasStyle.backgroundColor = "black"; //canvasStyle.backgroundColor = "black";
canvasStyle.color = "white"; //canvasStyle.color = "white";
//containerStyle.position = "fixed"; //containerStyle.position = "fixed";

View File

@ -79,6 +79,7 @@ $.Viewport.prototype = {
this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY ); this.fitHeightBounds = new $.Rect( 0, 0, 1, this.contentAspectY );
this.homeBounds = this.fitHeightBounds; this.homeBounds = this.fitHeightBounds;
return this;
}, },
/** /**
@ -264,6 +265,7 @@ $.Viewport.prototype = {
bounds.y += dy; bounds.y += dy;
this.fitBounds( bounds, immediately ); this.fitBounds( bounds, immediately );
} }
return this;
}, },
/** /**
@ -272,6 +274,7 @@ $.Viewport.prototype = {
*/ */
ensureVisible: function( immediately ) { ensureVisible: function( immediately ) {
this.applyConstraints( immediately ); this.applyConstraints( immediately );
return this;
}, },
/** /**
@ -309,7 +312,7 @@ $.Viewport.prototype = {
newZoom = 1.0 / newBounds.width; newZoom = 1.0 / newBounds.width;
if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) { if ( newZoom == oldZoom || newBounds.width == oldBounds.width ) {
this.panTo( center, immediately ); this.panTo( center, immediately );
return; return this;
} }
referencePoint = oldBounds.getTopLeft().times( referencePoint = oldBounds.getTopLeft().times(
@ -324,6 +327,7 @@ $.Viewport.prototype = {
); );
this.zoomTo( newZoom, referencePoint, immediately ); this.zoomTo( newZoom, referencePoint, immediately );
return this;
}, },
/** /**
@ -336,6 +340,7 @@ $.Viewport.prototype = {
} else { } else {
return this.fitHorizontally( immediately ); return this.fitHorizontally( immediately );
} }
return this;
}, },
/** /**
@ -360,6 +365,7 @@ $.Viewport.prototype = {
} }
this.fitBounds( this.homeBounds, immediately ); this.fitBounds( this.homeBounds, immediately );
return this;
}, },
/** /**
@ -384,6 +390,7 @@ $.Viewport.prototype = {
} }
this.fitBounds( this.homeBounds, immediately ); this.fitBounds( this.homeBounds, immediately );
return this;
}, },
@ -398,6 +405,7 @@ $.Viewport.prototype = {
this.centerSpringY.target.value this.centerSpringY.target.value
); );
this.panTo( center.plus( delta ), immediately ); this.panTo( center.plus( delta ), immediately );
return this;
}, },
/** /**
@ -413,6 +421,8 @@ $.Viewport.prototype = {
this.centerSpringX.springTo( center.x ); this.centerSpringX.springTo( center.x );
this.centerSpringY.springTo( center.y ); this.centerSpringY.springTo( center.y );
} }
return this;
}, },
/** /**
@ -420,6 +430,7 @@ $.Viewport.prototype = {
*/ */
zoomBy: function( factor, refPoint, immediately ) { zoomBy: function( factor, refPoint, immediately ) {
this.zoomTo( this.zoomSpring.target.value * factor, refPoint, immediately ); this.zoomTo( this.zoomSpring.target.value * factor, refPoint, immediately );
return this;
}, },
/** /**
@ -427,15 +438,18 @@ $.Viewport.prototype = {
*/ */
zoomTo: function( zoom, refPoint, immediately ) { zoomTo: function( zoom, refPoint, immediately ) {
this.zoomPoint = refPoint instanceof $.Point ?
refPoint :
null;
if ( immediately ) { if ( immediately ) {
this.zoomSpring.resetTo( zoom ); this.zoomSpring.resetTo( zoom );
} else { } else {
this.zoomSpring.springTo( zoom ); this.zoomSpring.springTo( zoom );
} }
this.zoomPoint = refPoint instanceof $.Point ?
refPoint : return this;
null;
}, },
/** /**
@ -457,6 +471,8 @@ $.Viewport.prototype = {
} }
this.fitBounds( newBounds, true ); this.fitBounds( newBounds, true );
return this;
}, },
/** /**

View File

@ -19,7 +19,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon/", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.js", tileSources: "/openseadragon/examples/images/highsmith/highsmith.js",
showNavigator: false, showNavigator: false,
debugMode: true debugMode: true

View File

@ -18,7 +18,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon/", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.js" tileSources: "/openseadragon/examples/images/highsmith/highsmith.js"
}); });
</script> </script>

View File

@ -31,7 +31,7 @@
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi", tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi",
toolbar: "toolbarDiv", toolbar: "toolbarDiv",
showNavigator: true, showNavigator: true,

View File

@ -42,25 +42,31 @@ OpenSeadragon({
});</pre> });</pre>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ var viewer = OpenSeadragon({
id: "example-tilesource-collection", id: "example-tilesource-collection",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
//debugMode: true, debugMode: false, //if you want to see the render grid
showNavigator: false,
minPixelRatio: 0.0,
collectionMode: true, collectionMode: true,
collectionRows: 1, collectionRows: 1,
collectionTileSize: 1024, collectionTileSize: 1024,
collectionTileMargin: 256, collectionTileMargin: 256,
//collectionLayout: 'vertical', //collectionLayout: 'vertical',
//panVertical: false,
//panHorizontal: false,
//defaultZoomLevel: 1, //defaultZoomLevel: 1,
/*The wrap options can be fun to give a sense of infinite results*/
//wrapHorizontal: true, //wrapHorizontal: true,
//wrapVertical: true, //wrapVertical: true,
/*Tile sources can be mixed*/
tileSources: [ tileSources: [
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05954.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05954.dzi",
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05955.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05955.dzi",
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05956.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05956.dzi",
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05957.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05957.dzi"/*,
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05958.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05958.dzi",
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05959.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05959.dzi",
"/openseadragon/examples/images/pnp/ppmsca/05900/05954/05960.dzi", "/openseadragon/examples/images/pnp/ppmsca/05900/05954/05960.dzi",
@ -227,7 +233,7 @@ OpenSeadragon({
width: 2970 width: 2970
}] }]
}/*,{ }*//*,{
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',
levels: [{ levels: [{
url: '/openseadragon/examples/images/rbc/rbc0001/2003/2003rosen1799/0011q.jpg', url: '/openseadragon/examples/images/rbc/rbc0001/2003/2003rosen1799/0011q.jpg',

View File

@ -32,22 +32,111 @@
<div class="demoheading"> <div class="demoheading">
Example Inline Configuration for Custom Tile Sources Example Inline Configuration for Custom Tile Sources
</div> </div>
<div id="example-custom-tilesource"
class="openseadragon" >
</div>
<p> <p>
Below is a make believe minimal inline configuration. Note that the Below is a make believe minimal inline configuration. Note that the
default tileSize is available as a property of the tile source. default tileSize is available as a property of the tile source.
</p> </p>
<pre> <pre>
OpenSeadragon({ OpenSeadragon({
id: "example-inline-configuration", id: "example-custom-tilesource",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon",
showNavigator: true, navigatorSizeRatio: 0.25,
wrapHorizontal: true,
tileSources: { tileSources: {
height: 1140, height: 512*256,
width: 2450, width: 512*256,
tileSize: 256,
minLevel: 8,
getTileUrl: function( level, x, y ){ getTileUrl: function( level, x, y ){
return "http://example.org/imageservice/"+level+"/"+x+"/"+y+"/?tileSize="+this.tileSize return "http://s3.amazonaws.com/com.modestmaps.bluemarble/"+(level-8)+"-r"+x+"-c"+y+".jpg";
} }
} }
}); });
</pre> </pre>
<script>
OpenSeadragon({
id: "example-custom-tilesource",
prefixUrl: "/openseadragon/images/",
navigatorSizeRatio: 0.25,
wrapHorizontal: true,
tileSources: {
height: 512*256,
width: 512*256,
tileSize: 256,
minLevel: 8,
getTileUrl: function( level, x, y ){
return "http://s3.amazonaws.com/com.modestmaps.bluemarble/"+(level-8)+"-r"+y+"-c"+x+".jpg";
}
}
});
</script>
</div>
<div class="demoarea">
<div class="demoheading">
Another Inline Configuration for Custom Tile Sources
</div>
<div id="example2-custom-tilesource"
class="openseadragon"
style='background-color:#aaa'>
</div>
<p>
Below is a make believe minimal inline configuration. Note that the
default tileSize is available as a property of the tile source.
</p>
<pre>
OpenSeadragon({
...
showNavigator: false,
blendTime: 0,
wrapHorizontal: true,
tileSources: {
height: 1024*256,
width: 1024*256,
tileSize: 256,
minLevel: 9,
getTileUrl: function( level, x, y ){
function zeropad( i ) {
var n = String( i ),
m = 6 - n.length;
n = (m < 1) ? n : new Array(m + 1).join( "0" ) + n;
return n.substr(0, 3) + "/" + n.substr(3);
};
return "http://s3.amazonaws.com/info.aaronland.tiles.shapetiles/"+(level-8)+"/"+zeropad(x)+"/"+zeropad(y)+".png";
}
}
...
});
</pre>
<script>
OpenSeadragon({
id: "example2-custom-tilesource",
prefixUrl: "/openseadragon/images/",
showNavigator: false,
blendTime: 0,
wrapHorizontal: true,
tileSources: {
height: 1024*256,
width: 1024*256,
tileSize: 256,
minLevel: 9,
getTileUrl: function( level, x, y ){
function zeropad( i ) {
var n = String( i ),
m = 6 - n.length;
n = (m < 1) ? n : new Array(m + 1).join( "0" ) + n;
return n.substr(0, 3) + "/" + n.substr(3);
};
return "http://s3.amazonaws.com/info.aaronland.tiles.shapetiles/"+(level-8)+"/"+zeropad(x)+"/"+zeropad(y)+".png";
}
}
});
</script>
</div> </div>

View File

@ -32,7 +32,7 @@
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-xmlhttprequest-for-dzi", id: "example-xmlhttprequest-for-dzi",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi", tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi",
showNavigator: true showNavigator: true
}); });
@ -102,7 +102,7 @@ OpenSeadragon({
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-jsonprequest-for-dzi-jsonp", id: "example-jsonprequest-for-dzi-jsonp",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.js", tileSources: "/openseadragon/examples/images/highsmith/highsmith.js",
showNavigator: true showNavigator: true
}); });
@ -188,7 +188,7 @@ OpenSeadragon({
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-inline-configuration-for-dzi", id: "example-inline-configuration-for-dzi",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
tileSources: { tileSources: {
Image: { Image: {
@ -218,7 +218,7 @@ OpenSeadragon({
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-wide-dzi", id: "example-wide-dzi",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/pnp/pan/6a32000/6a32400/6a32487.dzi" tileSources: "/openseadragon/examples/images/pnp/pan/6a32000/6a32400/6a32487.dzi"
}); });
</script> </script>

View File

@ -27,7 +27,7 @@
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-xmlhttprequest", id: "example-xmlhttprequest",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/rbc/rbc0001/2003/rosen.xml", tileSources: "/openseadragon/examples/images/rbc/rbc0001/2003/rosen.xml",
showNavigator: true showNavigator: true
}); });
@ -109,7 +109,7 @@ OpenSeadragon({
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "example-jsonprequest", id: "example-jsonprequest",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/rbc/rbc0001/2003/rosen.js", tileSources: "/openseadragon/examples/images/rbc/rbc0001/2003/rosen.js",
showNavigator: true showNavigator: true
}); });
@ -173,7 +173,7 @@ OpenSeadragon({
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "inline-configuration", id: "inline-configuration",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
tileSources: { tileSources: {
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',
@ -243,7 +243,7 @@ OpenSeadragon({
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "aspect-ratio", id: "aspect-ratio",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
tileSources: { tileSources: {
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',

View File

@ -47,7 +47,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv1", id: "contentDiv1",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
tileSources: [{ tileSources: [{
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',
@ -487,7 +487,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv2", id: "contentDiv2",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
defaultZoomLevel: 1.05, defaultZoomLevel: 1.05,
tileSources: [ tileSources: [
@ -507,7 +507,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv3", id: "contentDiv3",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
preserveViewport: true, preserveViewport: true,
tileSources: [{ tileSources: [{
@ -585,7 +585,7 @@
// Example // Example
OpenSeadragon({ OpenSeadragon({
id: "contentDiv4", id: "contentDiv4",
prefixUrl: '/openseadragon', prefixUrl: "/openseadragon/images/",
showNavigator: true, showNavigator: true,
tileSources: [{ tileSources: [{
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',

View File

@ -36,7 +36,7 @@
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
toolbar: "toolbarDiv", toolbar: "toolbarDiv",
zoomInButton: "zoom-in", zoomInButton: "zoom-in",
zoomOutButton: "zoom-out", zoomOutButton: "zoom-out",

View File

@ -19,7 +19,7 @@
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
showReferenceStrip: true, showReferenceStrip: true,
tileSources: [{ tileSources: [{
type: 'legacy-image-pyramid', type: 'legacy-image-pyramid',
@ -106,7 +106,7 @@ The relevant configuration options are shown below.
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "contentDiv2", id: "contentDiv2",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
toolbar: "toolbarDiv", toolbar: "toolbarDiv",
springStiffness: 10, springStiffness: 10,
showReferenceStrip: true, showReferenceStrip: true,

View File

@ -25,7 +25,7 @@
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi", tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi",
toolbar: "toolbarDiv", toolbar: "toolbarDiv",
showNavigator: true showNavigator: true

View File

@ -20,7 +20,7 @@
<script type="text/javascript"> <script type="text/javascript">
OpenSeadragon({ OpenSeadragon({
id: "contentDiv", id: "contentDiv",
prefixUrl: "/openseadragon", prefixUrl: "/openseadragon/images/",
tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi", tileSources: "/openseadragon/examples/images/highsmith/highsmith.dzi",
showNavigator: true showNavigator: true
}); });