Merge branch 'master' of github.com:openseadragon/openseadragon into issue37-navigator

This commit is contained in:
houseofyin 2013-06-01 14:12:04 -04:00
commit 3e24be12e0
6 changed files with 42 additions and 14 deletions

View File

@ -68,9 +68,8 @@ When contributing, please attempt to match the code style already in the codebas
When fixing bugs and adding features, when appropriate please also:
* Update changelog.txt
* Add/update related unit tests
* Update related doc comments
* Add/update related unit tests
If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water.

View File

@ -9,6 +9,10 @@ OPENSEADRAGON CHANGELOG
* Keyboard handling is now done in the viewer rather than navigator (#46)
* Additional navigator fixes (#46)
* Fixed an error in EventHandler.removeHandler() (#48)
* Better requestAnimationFrame detection on older Firefox (#103)
* More efficient navigator loading (#115)
* Sometimes tiles wouldn't resolve if you used the blendTime option; fixed. (#95)
* You can now choose to have previous and next buttons wrap using the config.navPrevNextWrap. (#114)
0.9.127:

View File

@ -57,7 +57,7 @@ $.ButtonState = {
* @param {String} options.srcRest URL of image to use in 'rest' state
* @param {String} options.srcGroup URL of image to use in 'up' state
* @param {String} options.srcHover URL of image to use in 'hover' state
* @param {String} options.srcDown URL of image to use in 'domn' state
* @param {String} options.srcDown URL of image to use in 'down' state
* @param {Element} [options.element] Element to use as a container for the
* button.
* @property {String} tooltip Provides context help for the button we the
@ -65,7 +65,7 @@ $.ButtonState = {
* @property {String} srcRest URL of image to use in 'rest' state
* @property {String} srcGroup URL of image to use in 'up' state
* @property {String} srcHover URL of image to use in 'hover' state
* @property {String} srcDown URL of image to use in 'domn' state
* @property {String} srcDown URL of image to use in 'down' state
* @property {Object} config Configurable settings for this button. DEPRECATED.
* @property {Element} [element] Element to use as a container for the
* button.

View File

@ -709,8 +709,7 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le
);
if ( tile.loaded ) {
drawer.updateAgain = blendTile(
var needsUpdate = blendTile(
drawer,
tile,
x, y,
@ -718,6 +717,10 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le
levelOpacity,
currentTime
);
if ( needsUpdate ) {
drawer.updateAgain = true;
}
} else if ( tile.loading ) {
// the tile is already in the download queue
// thanks josh1093 for finally translating this typo

View File

@ -258,6 +258,11 @@
* these paths, prefer setting the option.prefixUrl rather than overriding
* every image path directly through this setting.
*
* @param {Boolean} [options.navPrevNextWrap=false]
* If the 'previous' button will wrap to the last image when viewing the first
* image and if the 'next' button will wrap to the first image when viewing
* the last image.
*
* @returns {OpenSeadragon.Viewer}
*/
window.OpenSeadragon = window.OpenSeadragon || function( options ){
@ -595,6 +600,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
DOWN: 'next_pressed.png'
}
},
navPrevNextWrap: false,
//DEVELOPER SETTINGS
debugMode: false,

View File

@ -346,6 +346,10 @@ $.Viewer = function( options ) {
beginControlsAutoHide( _this );
} ); // initial fade out
if(this.navPrevNextWrap){
this.previousButton.enable();
}
};
$.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, {
@ -523,8 +527,11 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
/**
* Shows or hides the controls (e.g. the default navigation buttons).
*
* @function
* @name OpenSeadragon.Viewer.prototype.setDashboardEnabled
* @name OpenSeadragon.Viewer.prototype.setControlsEnabled
* @param {Boolean} true to show, false to hide.
* @return {OpenSeadragon.Viewer} Chainable.
*/
setControlsEnabled: function( enabled ) {
@ -1019,7 +1026,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
if( this.nextButton ){
if( ( this.tileSources.length - 1 ) === page ){
//Disable next button
if(!this.navPrevNextWrap){
this.nextButton.disable();
}
} else {
this.nextButton.enable();
}
@ -1029,9 +1038,11 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
//Enable previous button
this.previousButton.enable();
} else {
if(!this.navPrevNextWrap){
this.previousButton.disable();
}
}
}
this.open( this.tileSources[ page ] );
}
@ -1145,7 +1156,10 @@ function openTileSource( viewer, source ) {
sizeRatio: _this.navigatorSizeRatio,
height: _this.navigatorHeight,
width: _this.navigatorWidth,
tileSources: _this.tileSources,
// By passing the fully parsed source here, the navigator doesn't
// have to load it again. Additionally, we don't have to call
// navigator.open, as it's implicitly called in the ctor.
tileSources: source,
tileHost: _this.tileHost,
prefixUrl: _this.prefixUrl,
overlays: _this.overlays,
@ -1210,10 +1224,6 @@ function openTileSource( viewer, source ) {
}
VIEWERS[ _this.hash ] = _this;
if( _this.navigator ){
_this.navigator.open( source );
}
_this.raiseEvent( 'open', { source: source, viewer: _this } );
return _this;
@ -1623,12 +1633,18 @@ function onFullPage() {
function onPrevious(){
var previous = THIS[ this.hash ].sequence - 1;
if(this.navPrevNextWrap && previous < 0){
previous += this.tileSources.length;
}
this.goToPage( previous );
}
function onNext(){
var next = THIS[ this.hash ].sequence + 1;
if(this.navPrevNextWrap && next >= this.tileSources.length){
next = 0;
}
this.goToPage( next );
}