Open bcamper opened 8 years ago
Can you say more about how you think this might work?
It's my understanding that FileReader is only available on user interaction - that is, I can't just drop a scene file and then my browser goes hunting through my hard drive for assets. But with the right prompting, users can drop a bundle of files into the browser, or load them all using the dialog box. We could then need to store each of these files in memory and map local resources to those references. This might mean some form of URL replacement in the scene file with Data-URI equivalents before sending it to Tangram.
Let me know if you had a different thing in mind?
Wow I can't remember even putting this in so I am not sure :D
I'm going to rename this issue to refer to handling assets such as images, sprites, untiled data sources, and so forth. We've opened issue #321 for the multiple-file scenes. I'm not sure the solution for both of these is generic enough to handle any sort of file for any purpose (but it might be), or if it's easier to address each one separately.
We can use the FileReader API to allow loading of local files. We already support drag and drop loading, but better local file support would be useful for loading local resources (images, etc.), and for future multi-file scenes.
https://developer.mozilla.org/en-US/docs/Web/API/FileReader http://caniuse.com/#feat=filereader https://www.w3.org/TR/FileAPI/#dfn-filereader