mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
More sequence mode work
This commit is contained in:
parent
0dd97dbc56
commit
1279c6766c
@ -200,13 +200,11 @@ $.Viewer = function( options ) {
|
|||||||
// how much we should be continuously zooming by
|
// how much we should be continuously zooming by
|
||||||
"zoomFactor": null,
|
"zoomFactor": null,
|
||||||
"lastZoomTime": null,
|
"lastZoomTime": null,
|
||||||
// did we decide this viewer has a sequence of tile sources
|
|
||||||
"sequenced": false,
|
|
||||||
"sequence": 0,
|
|
||||||
"fullPage": false,
|
"fullPage": false,
|
||||||
"onfullscreenchange": null
|
"onfullscreenchange": null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this._sequenceIndex = 0;
|
||||||
this._firstOpen = true;
|
this._firstOpen = true;
|
||||||
this._updateRequestId = null;
|
this._updateRequestId = null;
|
||||||
this.currentOverlays = [];
|
this.currentOverlays = [];
|
||||||
@ -507,17 +505,18 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
// Sequence mode
|
// Sequence mode
|
||||||
if (this.sequenceMode) {
|
if (this.sequenceMode) {
|
||||||
THIS[ this.hash ].sequenced = true;
|
if (this.tileSources && this.tileSources.length) {
|
||||||
this.initialPage = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
||||||
THIS[ this.hash ].sequence = this.initialPage;
|
}
|
||||||
|
|
||||||
this.bindSequenceControls();
|
this.bindSequenceControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open initial tilesources
|
// Open initial tilesources
|
||||||
if ( this.tileSources ) {
|
if ( this.tileSources && this.tileSources.length) {
|
||||||
if (this.sequenceMode) {
|
if (this.sequenceMode) {
|
||||||
this.open(this.tileSources[this.initialPage]);
|
this.open(this.tileSources[this._sequenceIndex]);
|
||||||
this._updateSequenceButtons( this.initialPage );
|
this._updateSequenceButtons( this._sequenceIndex );
|
||||||
} else {
|
} else {
|
||||||
this.open( this.tileSources );
|
this.open( this.tileSources );
|
||||||
}
|
}
|
||||||
@ -1422,7 +1421,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
navImages = this.navImages,
|
navImages = this.navImages,
|
||||||
useGroup = true ;
|
useGroup = true ;
|
||||||
|
|
||||||
if( this.showSequenceControl && THIS[ this.hash ].sequenced ){
|
if( this.showSequenceControl ){
|
||||||
|
|
||||||
if( this.previousButton || this.nextButton ){
|
if( this.previousButton || this.nextButton ){
|
||||||
//if we are binding to custom buttons then layout and
|
//if we are binding to custom buttons then layout and
|
||||||
@ -1462,6 +1461,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
this.previousButton.disable();
|
this.previousButton.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.tileSources || !this.tileSources.length) {
|
||||||
|
this.nextButton.disable();
|
||||||
|
}
|
||||||
|
|
||||||
if( useGroup ){
|
if( useGroup ){
|
||||||
this.paging = new $.ButtonGroup({
|
this.paging = new $.ButtonGroup({
|
||||||
buttons: [
|
buttons: [
|
||||||
@ -1659,7 +1662,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
* @return {Number}
|
* @return {Number}
|
||||||
*/
|
*/
|
||||||
currentPage: function() {
|
currentPage: function() {
|
||||||
return THIS[ this.hash ].sequence;
|
return this._sequenceIndex;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1668,7 +1671,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
* @fires OpenSeadragon.Viewer.event:page
|
* @fires OpenSeadragon.Viewer.event:page
|
||||||
*/
|
*/
|
||||||
goToPage: function( page ){
|
goToPage: function( page ){
|
||||||
if( page >= 0 && page < this.tileSources.length ){
|
if( this.tileSources && page >= 0 && page < this.tileSources.length ){
|
||||||
/**
|
/**
|
||||||
* Raised when the page is changed on a viewer configured with multiple image sources (see {@link OpenSeadragon.Viewer#goToPage}).
|
* Raised when the page is changed on a viewer configured with multiple image sources (see {@link OpenSeadragon.Viewer#goToPage}).
|
||||||
*
|
*
|
||||||
@ -1681,7 +1684,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
*/
|
*/
|
||||||
this.raiseEvent( 'page', { page: page } );
|
this.raiseEvent( 'page', { page: page } );
|
||||||
|
|
||||||
THIS[ this.hash ].sequence = page;
|
this._sequenceIndex = page;
|
||||||
|
|
||||||
this._updateSequenceButtons( page );
|
this._updateSequenceButtons( page );
|
||||||
|
|
||||||
@ -1871,7 +1874,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
_updateSequenceButtons: function( page ) {
|
_updateSequenceButtons: function( page ) {
|
||||||
|
|
||||||
if ( this.nextButton ) {
|
if ( this.nextButton ) {
|
||||||
if( ( this.tileSources.length - 1 ) === page ) {
|
if(!this.tileSources || this.tileSources.length - 1 === page) {
|
||||||
//Disable next button
|
//Disable next button
|
||||||
if ( !this.navPrevNextWrap ) {
|
if ( !this.navPrevNextWrap ) {
|
||||||
this.nextButton.disable();
|
this.nextButton.disable();
|
||||||
@ -2856,7 +2859,7 @@ function onRotateRight() {
|
|||||||
|
|
||||||
|
|
||||||
function onPrevious(){
|
function onPrevious(){
|
||||||
var previous = THIS[ this.hash ].sequence - 1;
|
var previous = this._sequenceIndex - 1;
|
||||||
if(this.navPrevNextWrap && previous < 0){
|
if(this.navPrevNextWrap && previous < 0){
|
||||||
previous += this.tileSources.length;
|
previous += this.tileSources.length;
|
||||||
}
|
}
|
||||||
@ -2865,7 +2868,7 @@ function onPrevious(){
|
|||||||
|
|
||||||
|
|
||||||
function onNext(){
|
function onNext(){
|
||||||
var next = THIS[ this.hash ].sequence + 1;
|
var next = this._sequenceIndex + 1;
|
||||||
if(this.navPrevNextWrap && next >= this.tileSources.length){
|
if(this.navPrevNextWrap && next >= this.tileSources.length){
|
||||||
next = 0;
|
next = 0;
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,12 @@
|
|||||||
|
|
||||||
if (testInitialOpen) {
|
if (testInitialOpen) {
|
||||||
config.tileSources = [
|
config.tileSources = [
|
||||||
// {
|
{
|
||||||
// tileSource: "../../data/tall.dzi",
|
tileSource: "../../data/tall.dzi",
|
||||||
// x: 1.5,
|
x: 1.5,
|
||||||
// y: 0,
|
y: 0,
|
||||||
// width: 1
|
width: 1
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
tileSource: '../../data/wide.dzi',
|
tileSource: '../../data/wide.dzi',
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user