dcjones/Compose.jl — pull request #89 by shashi (2014-11-02 21:24:27+00:00)
Title: WIP: A Patchable backend

This back-end lets us draw Compose and Gadfly graphics using [virtual-dom](/Matt-Esch/virtual-dom) for rendering. There is a mechanism through which re-rendering of the same graphic happens via a diff-patch mechanism using [Patchwork.jl](/shashi/Patchwork.jl): a set of patches is computed against the previously rendered SVG document and then applied.

This optimizes for network usage. And also allows for full-blown FRP-based GUI programming a la Elm and mercury using Julia+JavaScript.

Comments are welcome! I added `draw_recursive` to reduce the bookkeeping I had to do in the back-end which if I were to use `drawpart` which seemed better for rendering by writing to a buffer, as opposed to rendering by constructing a data structure.

*TODO*
* [ ] We want to allow JSCall, but loading gadfly.js and enabling zoom and pan features it provides can be disastrous for patching. A single element misplaced by JavaScript can cause the patching to behave unexpectedly. So we need a safer alternative. Panning is possible with `viewBox`. Zooming can also be implemented with viewBox, but will look weird. One good approach is to have Julia be involved in the zoom and pan process, I would love to zoom into a histogram and have the granularity increase as I do. This sort of a thing requires Julia intervention anyway. An extension of the idea is to have this behave like Google maps, i.e. initial zoom using viewBox, and then fetch patches from Julia to show more detail. I feel this item requires a more general widget creation mechanism to come from Patchwork or another package, so this probably should not block this PR.
* [ ] Do not depend on Patchwork being installed - load this back-end only if Patchwork is present - this is in the interest of reducing load time.
* [ ] Test rendering for all primitives

Patchwork issues (perhaps)
* [ ] Text inside `text` elements should not be escaped while rendering