Adds a button that lets users manually download individual relation members

Makes the map zoom to the chosen relation member if it is not currently visible
This commit is contained in:
Quincy Morgan
2018-10-10 20:36:53 -07:00
parent b43d6a1a56
commit 27158d77f3
2 changed files with 27 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
{
"en": {
"icons": {
"download": "download",
"information": "info",
"remove": "remove",
"undo": "undo"

View File

@@ -23,9 +23,24 @@ export function uiRawMemberEditor(context) {
var taginfo = services.taginfo,
_entityID;
function downloadMember(d) {
d3_event.preventDefault();
// display the loading indicator
d3_select(this.parentNode).classed('tag-reference-loading', true);
context.loadEntity(d.id);
}
function selectMember(d) {
d3_event.preventDefault();
var entity = context.entity(d.id);
var mapExtent = context.map().extent();
if (!entity.intersects(mapExtent, context.graph())) {
// zoom to the entity if its extent is not visible now
context.map().zoomTo(entity);
}
context.enter(modeSelect(context, [d.id]));
}
@@ -125,9 +140,19 @@ export function uiRawMemberEditor(context) {
.text(function(d) { return utilDisplayName(d.member); });
} else {
d3_select(this).append('label')
var incompleteLabel = d3_select(this).append('label')
.attr('class', 'form-label')
.text(t('inspector.incomplete', { id: d.id }));
var wrap = incompleteLabel.append('div')
.attr('class', 'form-label-button-wrap');
wrap.append('button')
.attr('class', 'download-icon')
.attr('title', t('icons.download'))
.attr('tabindex', -1)
.call(svgIcon('#iD-icon-load'))
.on('click', downloadMember);
}
});