Skip to content

Commit

Permalink
improved queue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhellsing committed Aug 31, 2012
1 parent c958502 commit 303c8be
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions src/galleria.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Galleria v 1.2.9b 2012-08-25
* Galleria v 1.2.9b 2012-08-31
* http://galleria.io
*
* Licensed under the MIT license
Expand Down Expand Up @@ -275,6 +275,8 @@ var undef,
instance._init.call( instance );
}
});

_pool = [];
},

// the Utils singleton
Expand Down Expand Up @@ -4386,8 +4388,8 @@ this.prependChild( 'info', 'myElement' );

show : function( index, rewind, _history ) {

// do nothing if index is false or queue is false and transition is in progress
if ( index === false || ( !this._options.queue && this._queue.stalled ) ) {
// do nothing queue is long || index is false || queue is false and transition is in progress
if ( this._queue.length > 3 || index === false || ( !this._options.queue && this._queue.stalled ) ) {
return;
}

Expand Down Expand Up @@ -4446,9 +4448,6 @@ this.prependChild( 'info', 'myElement' );

_transitions.active = false;

// remove stalled
self._queue.stalled = false;

// optimize quality
Utils.toggleQuality( next.image, self._options.imageQuality );

Expand Down Expand Up @@ -4514,14 +4513,6 @@ this.prependChild( 'info', 'myElement' );
});
}

// remove the queued image
protoArray.shift.call( self._queue );

// if we still have images in the queue, show it
if ( self._queue.length ) {
self._show();
}

// check if we are playing
self._playCheck();

Expand All @@ -4533,6 +4524,18 @@ this.prependChild( 'info', 'myElement' );
thumbTarget: thumb.image,
galleriaData: data
});

// remove the queued image
protoArray.shift.call( self._queue );

// remove stalled
self._queue.stalled = false;

// if we still have images in the queue, show it
if ( self._queue.length ) {
self._show();
}

};
}( data, next, active, queue, thumb ));

Expand Down Expand Up @@ -4580,6 +4583,9 @@ this.prependChild( 'info', 'myElement' );
galleriaData: data
});

// stall the queue
self._queue.stalled = true;

// begin loading the next image
next.load( src, function( next ) {

Expand All @@ -4596,9 +4602,6 @@ this.prependChild( 'info', 'myElement' );
}
Utils.toggleQuality( next.image, false );

// stall the queue
self._queue.stalled = true;

// remove the image panning, if applied
// TODO: rethink if this is necessary
self.removePan();
Expand Down

0 comments on commit 303c8be

Please sign in to comment.