mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-19 23:14:47 +02:00
Support special styling for wikidata-tagged features
This commit is contained in:
@@ -174,6 +174,9 @@ osmEntity.prototype = {
|
||||
return Object.keys(this.tags).some(osmIsInterestingTag);
|
||||
},
|
||||
|
||||
hasWikidata: function() {
|
||||
return !!this.tags.wikidata || !!this.tags['brand:wikidata'];
|
||||
},
|
||||
|
||||
isHighwayIntersection: function() {
|
||||
return false;
|
||||
|
||||
@@ -156,7 +156,8 @@ export function svgLabels(projection, context) {
|
||||
texts.enter()
|
||||
.append('text')
|
||||
.attr('class', function(d, i) {
|
||||
return classes + ' ' + labels[i].classes + ' ' + d.id;
|
||||
var hasWd = d.hasWikidata() ? ' tag-wikidata' : '';
|
||||
return classes + ' ' + labels[i].classes + hasWd + ' ' + d.id;
|
||||
})
|
||||
.merge(texts)
|
||||
.attr('x', get(labels, 'x'))
|
||||
@@ -192,7 +193,10 @@ export function svgLabels(projection, context) {
|
||||
// enter/update
|
||||
icons.enter()
|
||||
.append('use')
|
||||
.attr('class', 'icon ' + classes)
|
||||
.attr('class', function(d) {
|
||||
var hasWd = d.hasWikidata() ? ' tag-wikidata' : '';
|
||||
return 'icon ' + classes + hasWd;
|
||||
})
|
||||
.attr('width', '17px')
|
||||
.attr('height', '17px')
|
||||
.merge(icons)
|
||||
|
||||
@@ -127,11 +127,9 @@ export function svgPoints(projection, context) {
|
||||
.attr('transform', svgPointTransform(projection))
|
||||
.call(svgTagClasses());
|
||||
|
||||
// Selecting the following implicitly
|
||||
// sets the data (point entity) on the element
|
||||
groups.select('.shadow');
|
||||
groups.select('.stroke');
|
||||
groups.select('.icon')
|
||||
groups.select('.shadow'); // propagate bound data
|
||||
groups.select('.stroke'); // propagate bound data
|
||||
groups.select('.icon') // propagate bound data
|
||||
.attr('xlink:href', function(entity) {
|
||||
var preset = context.presets().match(entity, graph);
|
||||
var picon = preset && preset.icon;
|
||||
|
||||
@@ -139,6 +139,11 @@ export function svgTagClasses() {
|
||||
}
|
||||
}
|
||||
|
||||
// If this is a wikidata-tagged item, add a class for that..
|
||||
if (t.wikidata || t['brand:wikidata']) {
|
||||
classes.push('tag-wikidata');
|
||||
}
|
||||
|
||||
return classes.join(' ').trim();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user