mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Move change image source's methods inside viewer
Added the methods inside the extend function, so that they appear as properties. Since we cannot reference properties of an object inside said object, we extract them as properties when needed.
This commit is contained in:
parent
5889f34695
commit
1f73dde983
@ -1646,8 +1646,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
var onFocusHandler = $.delegate( this, onFocus ),
|
var onFocusHandler = $.delegate( this, onFocus ),
|
||||||
onBlurHandler = $.delegate( this, onBlur ),
|
onBlurHandler = $.delegate( this, onBlur ),
|
||||||
onNextHandler = $.delegate( this, onNext ),
|
onNextHandler = $.delegate( this, this['goToNextPage'] ),
|
||||||
onPreviousHandler = $.delegate( this, onPrevious ),
|
onPreviousHandler = $.delegate( this, this['goToPreviousPage'] ),
|
||||||
navImages = this.navImages,
|
navImages = this.navImages,
|
||||||
useGroup = true;
|
useGroup = true;
|
||||||
|
|
||||||
@ -2316,7 +2316,40 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
this.world.resetItems();
|
this.world.resetItems();
|
||||||
this.forceRedraw();
|
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 );
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -2783,10 +2816,10 @@ function onCanvasKeyPress( event ) {
|
|||||||
event.preventDefault = true;
|
event.preventDefault = true;
|
||||||
break;
|
break;
|
||||||
case 106: //j - previous image source
|
case 106: //j - previous image source
|
||||||
onPrevious.bind(this)();
|
this.goToPreviousPage();
|
||||||
break;
|
break;
|
||||||
case 107: //k - next image source
|
case 107: //k - next image source
|
||||||
onNext.bind(this)();
|
this.goToNextPage();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// console.log( 'navigator keycode %s', event.keyCode );
|
// console.log( 'navigator keycode %s', event.keyCode );
|
||||||
@ -3677,22 +3710,4 @@ function onFlip() {
|
|||||||
this.viewport.toggleFlip();
|
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 ));
|
}( OpenSeadragon ));
|
||||||
|
Loading…
Reference in New Issue
Block a user