OpenGeoscience/geojs — pull request #146 by jbeezley (2014-07-04 15:23:28+00:00)
Title: Refactor d3Renderer and add a sticky option to layers

I'm still going to add a test and an example, but this is ready for comment. I don't know that I love the term sticky layer, so I am up for suggestions on renaming.

The way this works is that when you create a layer there is a `sticky` option that, when true, will cause the layer's features to move and scale with the map.

```javascript
map.createLayer('feature', {'renderer': 'd3Renderer', 'sticky': true_or_false});
```

This option is on by default. As part of this change, the context returned by the d3 renderer will automatically move with the map. If you add features to this context directly through d3, you no longer need to connect to `pan` and `zoom` events. There is a new event type added by the d3 component that emits a signal on the layer when the layer's scale changes. This is used, for example, in the [`pointFeature`](https://github.com/OpenGeoscience/geojs/blob/d3-refactor/src/d3/pointFeature.js#L135) class to resize the circles when the scale changes to keep them visually the same size.

One consequence of this change is that the sticky layers used by the d3 renderer have their own coordinate systems, so you have to georeference features added to it using the `layer.worldToDisplay` method rather than `map.gcsToDisplay`.

Tagging #137.