shama/atlaspack — pull request #6 by deathcap (2014-07-01 03:09:48+00:00)
Title: Fix _uvcache object initialization. Closes GH-5

Changes the _uvcache initialization from [] to Object.create(null) (note: not using {} so that inherited Object properties e.g. toString are [not added](http://stackoverflow.com/questions/15518328/creating-js-object-with-object-createnull)). Fixes use of this variable as an array.

Also removed the `.length > 0` cache check, which had no effect. This could be replaced with `Object.keys(this._uvcache).length > 0` but then cache invalidation is needed (I originally made this change, but in my code `uv()` may be called before all textures are loaded, returning a stale UV cache causing texture rendering issues. Returning the cache & invalidating it as needed could be added later, separately).