diff --git a/lib/MapRender.js b/lib/MapRender.js index a1b8c53..d620ce2 100644 --- a/lib/MapRender.js +++ b/lib/MapRender.js @@ -188,7 +188,7 @@ ltjs.MapRender = Class( 'MapRender', var tile = this._tiles[ tid ], 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 ) { diff --git a/lib/TileMasker.js b/lib/TileMasker.js index f37c428..aaa2c28 100644 --- a/lib/TileMasker.js +++ b/lib/TileMasker.js @@ -303,7 +303,9 @@ ltjs.TileMasker = Class( 'TileMasker', // If there is a previous frame, set the 'next' entry to its 'next' // 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 : set[ id ];