mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Style multipolygon inner/outers as areas not lines
This commit is contained in:
@@ -210,14 +210,16 @@ export function svgLines(projection, context) {
|
||||
function shouldReverse(entity) { return entity.tags.oneway === '-1'; },
|
||||
function bothDirections(entity) {
|
||||
return entity.tags.oneway === 'reversible' || entity.tags.oneway === 'alternating';
|
||||
});
|
||||
}
|
||||
);
|
||||
onewaydata[k] = _flatten(_map(onewayArr, onewaySegments));
|
||||
|
||||
var sidedArr = _filter(v, function(d) { return d.isSided(); });
|
||||
var sidedSegments = svgMarkerSegments(
|
||||
projection, graph, 30,
|
||||
function shouldReverse() { return false; },
|
||||
function bothDirections() { return false; });
|
||||
function bothDirections() { return false; }
|
||||
);
|
||||
sideddata[k] = _flatten(_map(sidedArr, sidedSegments));
|
||||
});
|
||||
|
||||
@@ -261,10 +263,11 @@ export function svgLines(projection, context) {
|
||||
|
||||
addMarkers(layergroup, 'oneway', 'onewaygroup', onewaydata, 'url(#oneway-marker)');
|
||||
addMarkers(layergroup, 'sided', 'sidedgroup', sideddata,
|
||||
function marker(d) {
|
||||
var category = graph.entity(d.id).sidednessIdentifier();
|
||||
return 'url(#sided-marker-' + category + ')';
|
||||
});
|
||||
function marker(d) {
|
||||
var category = graph.entity(d.id).sidednessIdentifier();
|
||||
return 'url(#sided-marker-' + category + ')';
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
// Draw touch targets..
|
||||
|
||||
@@ -24,15 +24,25 @@ export function svgTagClasses() {
|
||||
var tagClasses = function(selection) {
|
||||
selection.each(function tagClassesEach(entity) {
|
||||
var value = this.className;
|
||||
var classes, primary, status;
|
||||
var primary, status;
|
||||
|
||||
if (value.baseVal !== undefined) value = value.baseVal;
|
||||
if (value.baseVal !== undefined) {
|
||||
value = value.baseVal;
|
||||
}
|
||||
|
||||
classes = value.trim().split(/\s+/).filter(function(name) {
|
||||
return name.length && !tagClassRe.test(name);
|
||||
}).join(' ');
|
||||
var t = _tags(entity);
|
||||
var isMultiPolygon = (t.type === 'multipolygon');
|
||||
var i, k, v;
|
||||
|
||||
var t = _tags(entity), i, k, v;
|
||||
// keep only base classes (nothing with `tag-`)
|
||||
var classes = value.trim().split(/\s+/)
|
||||
.filter(function(klass) {
|
||||
return klass.length && !tagClassRe.test(klass);
|
||||
})
|
||||
.map(function(klass) { // style multipolygon inner/outers as areas not lines
|
||||
return (isMultiPolygon && klass === 'line') ? 'area' : klass;
|
||||
})
|
||||
.join(' ');
|
||||
|
||||
// pick at most one primary classification tag..
|
||||
for (i = 0; i < primaries.length; i++) {
|
||||
@@ -109,9 +119,9 @@ export function svgTagClasses() {
|
||||
};
|
||||
|
||||
|
||||
tagClasses.tags = function(_) {
|
||||
tagClasses.tags = function(val) {
|
||||
if (!arguments.length) return _tags;
|
||||
_tags = _;
|
||||
_tags = val;
|
||||
return tagClasses;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user