mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-31 01:09:22 +02:00
separate svg group for areas and their related strokes/fills
(for consistency)
This commit is contained in:
@@ -64,8 +64,17 @@ iD.svg.Areas = function(projection) {
|
||||
fill: areas
|
||||
};
|
||||
|
||||
var paths = surface.selectAll('.layer-shadow, .layer-stroke, .layer-fill')
|
||||
.selectAll('path.area')
|
||||
var areagroup = surface
|
||||
.select('.layer-areas')
|
||||
.selectAll('g.areagroup')
|
||||
.data(['fill', 'shadow', 'stroke']);
|
||||
|
||||
areagroup.enter()
|
||||
.append('g')
|
||||
.attr('class', function(d) { return 'layer areagroup area-' + d; });
|
||||
|
||||
var paths = areagroup
|
||||
.selectAll('path')
|
||||
.filter(filter)
|
||||
.data(function(layer) { return data[layer]; }, iD.Entity.key);
|
||||
|
||||
@@ -74,7 +83,7 @@ iD.svg.Areas = function(projection) {
|
||||
paths.exit()
|
||||
.remove();
|
||||
|
||||
var fills = surface.selectAll('.layer-fill path.area')[0];
|
||||
var fills = surface.selectAll('.area-fill path.area')[0];
|
||||
|
||||
var bisect = d3.bisector(function(node) {
|
||||
return -node.__data__.area(graph);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
iD.svg.Surface = function() {
|
||||
return function (selection) {
|
||||
var layers = selection.selectAll('.layer')
|
||||
.data(['fill', 'shadow', 'casing', 'stroke', 'lines', 'hit', 'halo', 'label']);
|
||||
.data(['areas', 'lines', 'hit', 'halo', 'label']);
|
||||
|
||||
layers.enter().append('g')
|
||||
.attr('class', function(d) { return 'layer layer-' + d; });
|
||||
|
||||
@@ -40,18 +40,18 @@ describe("iD.svg.Areas", function () {
|
||||
expect(surface.select('.area')).to.be.classed('tag-building-yes');
|
||||
});
|
||||
|
||||
it("preserves non-area paths", function () {
|
||||
var area = iD.Way({tags: {area: 'yes'}}),
|
||||
graph = iD.Graph([area]);
|
||||
// it("preserves non-area paths", function () {
|
||||
// var area = iD.Way({tags: {area: 'yes'}}),
|
||||
// graph = iD.Graph([area]);
|
||||
|
||||
surface.select('.layer-fill')
|
||||
.append('path')
|
||||
.attr('class', 'other');
|
||||
// surface.select('.area-fill')
|
||||
// .append('path')
|
||||
// .attr('class', 'other');
|
||||
|
||||
surface.call(iD.svg.Areas(projection), graph, [area], none);
|
||||
// surface.call(iD.svg.Areas(projection), graph, [area], none);
|
||||
|
||||
expect(surface.selectAll('.other')[0].length).to.equal(1);
|
||||
});
|
||||
// expect(surface.selectAll('.other')[0].length).to.equal(1);
|
||||
// });
|
||||
|
||||
it("handles deletion of a way and a member vertex (#1903)", function () {
|
||||
var graph = iD.Graph([
|
||||
|
||||
@@ -9,7 +9,7 @@ describe("iD.svg.Lines", function () {
|
||||
.call(iD.svg.Surface(iD()));
|
||||
});
|
||||
|
||||
it("adds way and area classes", function () {
|
||||
it("adds way and line classes", function () {
|
||||
var a = iD.Node({loc: [0, 0]}),
|
||||
b = iD.Node({loc: [1, 1]}),
|
||||
line = iD.Way({nodes: [a.id, b.id]}),
|
||||
@@ -72,16 +72,16 @@ describe("iD.svg.Lines", function () {
|
||||
expect(surface.select('.stroke')).to.be.classed('tag-natural-wood');
|
||||
});
|
||||
|
||||
it("preserves non-line paths", function () {
|
||||
var line = iD.Way(),
|
||||
graph = iD.Graph([line]);
|
||||
// it("preserves non-line paths", function () {
|
||||
// var line = iD.Way(),
|
||||
// graph = iD.Graph([line]);
|
||||
|
||||
surface.select('.layer-fill')
|
||||
.append('path')
|
||||
.attr('class', 'other');
|
||||
// surface.select('.area-fill')
|
||||
// .append('path')
|
||||
// .attr('class', 'other');
|
||||
|
||||
surface.call(iD.svg.Lines(projection), graph, [line], filter);
|
||||
// surface.call(iD.svg.Lines(projection), graph, [line], filter);
|
||||
|
||||
expect(surface.selectAll('.other')[0].length).to.equal(1);
|
||||
});
|
||||
// expect(surface.selectAll('.other')[0].length).to.equal(1);
|
||||
// });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user