mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-22 16:19:48 +02:00
bfdca7fc85
Not working in Firefox. To get it to work in Firefox, styles need to be directly applied to the path, or set in an embedded stylesheet (not sure whats going on there).
62 lines
1.9 KiB
JavaScript
62 lines
1.9 KiB
JavaScript
iD.svg.Surface = function() {
|
|
return function drawSurface(selection) {
|
|
var defs = selection.append('defs');
|
|
defs.append('marker')
|
|
.attr({
|
|
id: 'oneway-marker',
|
|
viewBox: '0 0 10 10',
|
|
refY: 2.5,
|
|
markerWidth: 2,
|
|
markerHeight: 2,
|
|
orient: 'auto'
|
|
})
|
|
.append('path')
|
|
.attr('d', 'M 0 0 L 5 2.5 L 0 5 z');
|
|
|
|
var patterns = defs.selectAll('pattern')
|
|
.data([
|
|
// pattern name, pattern image name
|
|
['wetland', 'wetland'],
|
|
['construction', 'construction'],
|
|
['cemetery', 'cemetery'],
|
|
['orchard', 'orchard'],
|
|
['farmland', 'farmland'],
|
|
['beach', 'dots'],
|
|
['scrub', 'dots'],
|
|
['meadow', 'dots']])
|
|
.enter()
|
|
.append('pattern')
|
|
.attr({
|
|
id: function(d) { return 'pattern-' + d[0]; },
|
|
width: 32,
|
|
height: 32,
|
|
patternUnits: 'userSpaceOnUse'
|
|
});
|
|
|
|
patterns.append('rect')
|
|
.attr({
|
|
x: 0,
|
|
y: 0,
|
|
width: 32,
|
|
height: 32,
|
|
'class': function(d) { return 'pattern-color-' + d[0]; }
|
|
});
|
|
|
|
patterns.append('image')
|
|
.attr({
|
|
x: 0,
|
|
y: 0,
|
|
width: 32,
|
|
height: 32
|
|
})
|
|
.attr('xlink:href', function(d) { return 'img/pattern/' + d[1] + '.png'; });
|
|
|
|
|
|
var layers = selection.selectAll('.layer')
|
|
.data(['fill', 'shadow', 'casing', 'stroke', 'text', 'hit', 'halo', 'label']);
|
|
|
|
layers.enter().append('g')
|
|
.attr('class', function(d) { return 'layer layer-' + d; });
|
|
};
|
|
};
|