Added reference to first element in circular linked list for tile frames
This will both make it easy to reset an animation and help to display the first tile (when animations are disabled or for display tiles for the editor)master
parent
af533652a6
commit
eb5fb38396
|
@ -188,7 +188,7 @@ ltjs.MapRender = Class( 'MapRender',
|
||||||
var tile = this._tiles[ tid ],
|
var tile = this._tiles[ tid ],
|
||||||
ctx = ( tile.masked ) ? this._ctxObj : this._ctx;
|
ctx = ( tile.masked ) ? this._ctxObj : this._ctx;
|
||||||
|
|
||||||
ctx.putImageData( this._tiles[ tid ].data, x, y );
|
ctx.putImageData( this._tiles[ tid ].first.data, x, y );
|
||||||
|
|
||||||
if ( tile.masked )
|
if ( tile.masked )
|
||||||
{
|
{
|
||||||
|
|
|
@ -303,7 +303,9 @@ ltjs.TileMasker = Class( 'TileMasker',
|
||||||
|
|
||||||
// If there is a previous frame, set the 'next' entry to its 'next'
|
// If there is a previous frame, set the 'next' entry to its 'next'
|
||||||
// entry to maintain the circular reference. Otherwise, set to self.
|
// entry to maintain the circular reference. Otherwise, set to self.
|
||||||
set[ id ].next = ( prev )
|
// This can also be stored as the 'first' reference to permit quickly
|
||||||
|
// resetting an animation.
|
||||||
|
set[ id ].next = set[ id ].first = ( prev )
|
||||||
? prev.next
|
? prev.next
|
||||||
: set[ id ];
|
: set[ id ];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue