mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-14 21:28:11 +02:00
don't show empty tooltips in backgrounds list
This commit is contained in:
@@ -79,6 +79,13 @@ export function rendererBackgroundSource(data) {
|
||||
};
|
||||
|
||||
|
||||
source.hasDescription = function() {
|
||||
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
|
||||
var descriptionText = localizer.tInfo('imagery.' + id_safe + '.description', { default: escape(_description) }).text;
|
||||
return descriptionText !== '';
|
||||
};
|
||||
|
||||
|
||||
source.description = function() {
|
||||
var id_safe = source.id.replace(/\./g, '<TX_DOT>');
|
||||
return t.append('imagery.' + id_safe + '.description', { default: escape(_description) });
|
||||
|
||||
@@ -142,7 +142,7 @@ export function uiSectionBackgroundList(context) {
|
||||
var item = d3_select(this).select('label');
|
||||
var span = item.select('span');
|
||||
var placement = (i < nodes.length / 2) ? 'bottom' : 'top';
|
||||
var description = d.description();
|
||||
var hasDescription = d.hasDescription();
|
||||
var isOverflowing = (span.property('clientWidth') !== span.property('scrollWidth'));
|
||||
|
||||
item.call(uiTooltip().destroyAny);
|
||||
@@ -153,10 +153,10 @@ export function uiSectionBackgroundList(context) {
|
||||
.title(() => t.append('background.switch'))
|
||||
.keys([uiCmd('⌘' + t('background.key'))])
|
||||
);
|
||||
} else if (description || isOverflowing) {
|
||||
} else if (hasDescription || isOverflowing) {
|
||||
item.call(uiTooltip()
|
||||
.placement(placement)
|
||||
.title(() => description || d.label())
|
||||
.title(() => hasDescription ? d.description() : d.label())
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user