mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
Extract iD.svg.Surface
This commit is contained in:
+2
-17
@@ -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;
|
||||
|
||||
@@ -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; });
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user