mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Adding an option that allows the previous and next buttons to wrap around past the end or beginning images.
This commit is contained in:
parent
96d8cae6e2
commit
b5d977d593
@ -9,6 +9,7 @@ OPENSEADRAGON CHANGELOG
|
|||||||
* Keyboard handling is now done in the viewer rather than navigator (#46)
|
* Keyboard handling is now done in the viewer rather than navigator (#46)
|
||||||
* Additional navigator fixes (#46)
|
* Additional navigator fixes (#46)
|
||||||
* Fixed an error in EventHandler.removeHandler() (#48)
|
* Fixed an error in EventHandler.removeHandler() (#48)
|
||||||
|
* You can now choose to have previous and next buttons wrap using the config.navPrevNextWrap.
|
||||||
|
|
||||||
0.9.127:
|
0.9.127:
|
||||||
|
|
||||||
|
@ -588,6 +588,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
DOWN: 'next_pressed.png'
|
DOWN: 'next_pressed.png'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
navPrevNextWrap: false,
|
||||||
|
|
||||||
//DEVELOPER SETTINGS
|
//DEVELOPER SETTINGS
|
||||||
debugMode: false,
|
debugMode: false,
|
||||||
|
@ -345,6 +345,10 @@ $.Viewer = function( options ) {
|
|||||||
beginControlsAutoHide( _this );
|
beginControlsAutoHide( _this );
|
||||||
} ); // initial fade out
|
} ); // initial fade out
|
||||||
|
|
||||||
|
if(this.navPrevNextWrap){
|
||||||
|
this.previousButton.enable();
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, {
|
$.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, {
|
||||||
@ -1021,7 +1025,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
if( this.nextButton ){
|
if( this.nextButton ){
|
||||||
if( ( this.tileSources.length - 1 ) === page ){
|
if( ( this.tileSources.length - 1 ) === page ){
|
||||||
//Disable next button
|
//Disable next button
|
||||||
|
if(!this.navPrevNextWrap){
|
||||||
this.nextButton.disable();
|
this.nextButton.disable();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.nextButton.enable();
|
this.nextButton.enable();
|
||||||
}
|
}
|
||||||
@ -1031,9 +1037,11 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
//Enable previous button
|
//Enable previous button
|
||||||
this.previousButton.enable();
|
this.previousButton.enable();
|
||||||
} else {
|
} else {
|
||||||
|
if(!this.navPrevNextWrap){
|
||||||
this.previousButton.disable();
|
this.previousButton.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.open( this.tileSources[ page ] );
|
this.open( this.tileSources[ page ] );
|
||||||
}
|
}
|
||||||
@ -1625,12 +1633,18 @@ function onFullPage() {
|
|||||||
|
|
||||||
function onPrevious(){
|
function onPrevious(){
|
||||||
var previous = THIS[ this.hash ].sequence - 1;
|
var previous = THIS[ this.hash ].sequence - 1;
|
||||||
|
if(this.navPrevNextWrap && previous < 0){
|
||||||
|
previous += this.tileSources.length;
|
||||||
|
}
|
||||||
this.goToPage( previous );
|
this.goToPage( previous );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function onNext(){
|
function onNext(){
|
||||||
var next = THIS[ this.hash ].sequence + 1;
|
var next = THIS[ this.hash ].sequence + 1;
|
||||||
|
if(this.navPrevNextWrap && next >= this.tileSources.length){
|
||||||
|
next = 0;
|
||||||
|
}
|
||||||
this.goToPage( next );
|
this.goToPage( next );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user