mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-12 16:52:50 +00:00
fix non-integer layer tag causing invisible features (#9933)
This commit is contained in:
@@ -247,7 +247,7 @@ export function svgLines(projection, context) {
|
||||
}
|
||||
|
||||
ways = ways.filter(getPath);
|
||||
var pathdata = utilArrayGroupBy(ways, function(way) { return way.layer(); });
|
||||
const pathdata = utilArrayGroupBy(ways, (way) => Math.trunc(way.layer()));
|
||||
|
||||
Object.keys(pathdata).forEach(function(k) {
|
||||
var v = pathdata[k];
|
||||
|
||||
@@ -111,6 +111,20 @@ describe('iD.svgLines', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('rounds layers down to the nearest whole number for rendering', () => {
|
||||
const graph = iD.coreGraph([
|
||||
iD.osmNode({id: 'a', loc: [0, 0]}),
|
||||
iD.osmNode({id: 'b', loc: [1, 1]}),
|
||||
iD.osmWay({id: 'w1', tags: {highway: 'residential', layer: '-2.5'}, nodes: ['a', 'b']}),
|
||||
]);
|
||||
surface.call(iD.svgLines(projection, context), graph, [graph.entity('w1')], none);
|
||||
|
||||
const layerGroup = surface.select('path.w1').nodes()[0].parentNode.parentNode;
|
||||
|
||||
// the feature with layer=-2.5 was rendered in layer -2
|
||||
expect(layerGroup.className.baseVal).to.eql('layergroup layer-2');
|
||||
});
|
||||
|
||||
describe('oneway-markers', function() {
|
||||
it('has marker layer for oneway ways', function() {
|
||||
// use 1e-2 to make sure segments are long enough to get
|
||||
|
||||
Reference in New Issue
Block a user