backspaces/agentscript — pull request #36 by bennlich (2014-04-11 22:58:43+00:00)
Title: ABM.TileDataSet

Here's a first pass at a tile dataset that binds to leaflet. I put a droplet example in models/tiledroplets.html.

Some things that come to mind that might need changing:
* If you bind the TileDataSet to leaflet, the leaflet layer gets embedded in the agentscript div wrapper. In order for click events to make it to leaflet, I let them pass through all the canvas layers (see [here](https://github.com/bennlich/agentscript/compare/tiledataset?expand=1#diff-4edf0c342ad4b1067c070fe8fdb3db80R128)). This should work fine with mouse.coffee, because the events should still bubble up to the wrapper div, but leaflet doesn't let its mousedown events propagate (I'm [asking](https://github.com/Leaflet/Leaflet/issues/2590) whether there's a good reason for this). So for the time being embedding a leaflet layer and using mouse.coffee are incompatible.
* TileDataSet's prototype is DataSet, but it doesn't implement a data array, so not all of the DataSet functions work (e.g. convolve). At some point we should rewrite TileDataSet to fill a data[] array with tile data, instead of having to parse a tile every time you try to sample the dataset.