Extract iD.svg.Surface

This commit is contained in:
John Firebaugh
2013-01-11 16:01:39 -08:00
parent 45fd260d8f
commit acaaab5dc9
7 changed files with 31 additions and 31 deletions
+2 -17
View File
@@ -41,23 +41,8 @@ iD.Map = function() {
if (d3.event.button == 2) {
d3.event.stopPropagation();
}
});
surface.append('defs')
.append('clipPath')
.attr('id', 'clip')
.append('rect')
.attr('id', 'clip-rect')
.attr({ x: 0, y: 0 });
var clip = surface.append('g')
.attr('clip-path', 'url(#clip)');
var layers = clip.selectAll('.layer')
.data(['fill', 'casing', 'stroke', 'text', 'hit']);
layers.enter().append('g')
.attr('class', function(d) { return 'layer layer-' + d; });
})
.call(iD.svg.Surface());
map.size(selection.size());
map.surface = surface;
+19
View File
@@ -0,0 +1,19 @@
iD.svg.Surface = function() {
return function(selection) {
selection.append('defs')
.append('clipPath')
.attr('id', 'clip')
.append('rect')
.attr('id', 'clip-rect')
.attr({ x: 0, y: 0 });
var clip = selection.append('g')
.attr('clip-path', 'url(#clip)');
var layers = clip.selectAll('.layer')
.data(['fill', 'casing', 'stroke', 'text', 'hit']);
layers.enter().append('g')
.attr('class', function(d) { return 'layer layer-' + d; });
};
};