Nicen favorite preset mode button tooltips

This commit is contained in:
Quincy Morgan
2019-02-27 12:03:10 -05:00
parent af5012107f
commit 4fabb4aac8
3 changed files with 30 additions and 3 deletions

View File

@@ -25,6 +25,14 @@ en:
title: Note
description: "Spotted an issue? Let other mappers know."
tail: Click on the map to add a note.
add_preset:
title: "Add {feature}"
point:
title: "Add {feature} as a point"
line:
title: "Add {feature} as a line"
area:
title: "Add {feature} as an area"
browse:
title: Browse
description: Pan and zoom the map.

12
dist/locales/en.json vendored
View File

@@ -31,6 +31,18 @@
"description": "Spotted an issue? Let other mappers know.",
"tail": "Click on the map to add a note."
},
"add_preset": {
"title": "Add {feature}",
"point": {
"title": "Add {feature} as a point"
},
"line": {
"title": "Add {feature} as a line"
},
"area": {
"title": "Add {feature} as an area"
}
},
"browse": {
"title": "Browse",
"description": "Pan and zoom the map."

View File

@@ -103,12 +103,19 @@ export function uiModes(context) {
var markerClass = 'add-favorite add-preset-' + preset.name()
.replace(/\s+/g, '_')
+ '-' + d.geom; //replace spaces with underscores to avoid css interpretation
var presetName = t('presets.presets.' + preset.id + '.name');
var relevantMatchingGeometry = preset.geometry.filter(function(geometry) {
return ['point', 'line', 'area'].indexOf(geometry) !== -1;
});
var tooltipTitleID = 'modes.add_preset.title';
if (relevantMatchingGeometry.length !== 1) {
tooltipTitleID = 'modes.add_preset.' + d.geom + '.title'
}
var favoriteMode = {
id: markerClass,
button: markerClass,
title: t('presets.presets.' + preset.id + '.name'),
description: [t('operations.add.title'), t('presets.presets.' + preset.id + '.name'), t('geometry.' + d.geom)].join(' '),
title: presetName,
description: t(tooltipTitleID, { feature: presetName }),
key: '',
icon: icon,
preset: preset,