mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #2007 from RammasEchor/master
Add keys to change image source in sequence mode
This commit is contained in:
commit
fc7a4b93f4
@ -1646,8 +1646,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
var onFocusHandler = $.delegate( this, onFocus ),
|
||||
onBlurHandler = $.delegate( this, onBlur ),
|
||||
onNextHandler = $.delegate( this, onNext ),
|
||||
onPreviousHandler = $.delegate( this, onPrevious ),
|
||||
onNextHandler = $.delegate( this, this.goToNextPage ),
|
||||
onPreviousHandler = $.delegate( this, this.goToPreviousPage ),
|
||||
navImages = this.navImages,
|
||||
useGroup = true;
|
||||
|
||||
@ -2316,7 +2316,40 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
this.world.resetItems();
|
||||
this.forceRedraw();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the image source to the source with index equal to
|
||||
* currentIndex - 1. Changes current image in sequence mode.
|
||||
* If specified, wraps around (see navPrevNextWrap in
|
||||
* {@link OpenSeadragon.Options})
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
|
||||
goToPreviousPage: function () {
|
||||
var previous = this._sequenceIndex - 1;
|
||||
if(this.navPrevNextWrap && previous < 0){
|
||||
previous += this.tileSources.length;
|
||||
}
|
||||
this.goToPage( previous );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the image source to the source with index equal to
|
||||
* currentIndex + 1. Changes current image in sequence mode.
|
||||
* If specified, wraps around (see navPrevNextWrap in
|
||||
* {@link OpenSeadragon.Options})
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
goToNextPage: function () {
|
||||
var next = this._sequenceIndex + 1;
|
||||
if(this.navPrevNextWrap && next >= this.tileSources.length){
|
||||
next = 0;
|
||||
}
|
||||
this.goToPage( next );
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -2782,6 +2815,12 @@ function onCanvasKeyPress( event ) {
|
||||
this.viewport.toggleFlip();
|
||||
event.preventDefault = true;
|
||||
break;
|
||||
case 106: //j - previous image source
|
||||
this.goToPreviousPage();
|
||||
break;
|
||||
case 107: //k - next image source
|
||||
this.goToNextPage();
|
||||
break;
|
||||
default:
|
||||
// console.log( 'navigator keycode %s', event.keyCode );
|
||||
event.preventDefault = false;
|
||||
@ -3671,22 +3710,4 @@ function onFlip() {
|
||||
this.viewport.toggleFlip();
|
||||
}
|
||||
|
||||
function onPrevious(){
|
||||
var previous = this._sequenceIndex - 1;
|
||||
if(this.navPrevNextWrap && previous < 0){
|
||||
previous += this.tileSources.length;
|
||||
}
|
||||
this.goToPage( previous );
|
||||
}
|
||||
|
||||
|
||||
function onNext(){
|
||||
var next = this._sequenceIndex + 1;
|
||||
if(this.navPrevNextWrap && next >= this.tileSources.length){
|
||||
next = 0;
|
||||
}
|
||||
this.goToPage( next );
|
||||
}
|
||||
|
||||
|
||||
}( OpenSeadragon ));
|
||||
|
Loading…
Reference in New Issue
Block a user