Fix the width of the add-tag and add-relation buttons

(closes #5729)
This commit is contained in:
Bryan Housel
2019-01-18 13:48:17 -05:00
parent 46beb31e74
commit 4e3def9ce8
3 changed files with 88 additions and 55 deletions
+33 -17
View File
@@ -187,12 +187,13 @@ export function uiRawMembershipEditor(context) {
itemsEnter.each(function(d){
// highlight the relation in the map while hovering on the list item
d3_select(this).on('mouseover', function() {
utilHighlightEntity(d.relation.id, true, context);
});
d3_select(this).on('mouseout', function() {
utilHighlightEntity(d.relation.id, false, context);
});
d3_select(this)
.on('mouseover', function() {
utilHighlightEntity(d.relation.id, true, context);
})
.on('mouseout', function() {
utilHighlightEntity(d.relation.id, false, context);
});
});
var labelEnter = itemsEnter
@@ -281,11 +282,11 @@ export function uiRawMembershipEditor(context) {
.append('button')
.attr('tabindex', -1)
.attr('class', 'remove form-field-button member-delete')
.call(svgIcon('#iD-operation-delete'))
.on('click', function() {
list.selectAll('.member-row-new')
.remove();
})
.call(svgIcon('#iD-operation-delete'));
});
// Update
newMembership = newMembership
@@ -301,18 +302,33 @@ export function uiRawMembershipEditor(context) {
);
var addrel = selection.selectAll('.add-relation')
// Container for the Add button
var addRow = selection.selectAll('.add-row')
.data([0]);
// Enter
var addrelEnter = addrel.enter()
.append('button')
.attr('class', 'add-relation');
// enter
var addRowEnter = addRow.enter()
.append('div')
.attr('class', 'add-row');
// Update
addrel
.merge(addrelEnter)
.call(svgIcon('#iD-icon-plus', 'light'))
addRowEnter
.append('button')
.attr('class', 'add-relation')
.call(svgIcon('#iD-icon-plus', 'light'));
addRowEnter
.append('div')
.attr('class', 'space-value'); // preserve space
addRowEnter
.append('div')
.attr('class', 'space-buttons'); // preserve space
// update
addRow = addRow
.merge(addRowEnter);
addRow.select('.add-relation')
.on('click', function() {
_showBlank = true;
content(selection);
+21 -7
View File
@@ -67,6 +67,7 @@ export function uiRawTagEditor(context) {
_newRow = '';
}
// List of tags
var list = wrap.selectAll('.tag-list')
.data([0]);
@@ -75,16 +76,30 @@ export function uiRawTagEditor(context) {
.attr('class', 'tag-list')
.merge(list);
var newTag = wrap.selectAll('.add-tag')
.data([0]);
newTag.enter()
// Container for the Add button
var addRowEnter = wrap.selectAll('.add-row')
.data([0])
.enter()
.append('div')
.attr('class', 'add-row');
addRowEnter
.append('button')
.attr('class', 'add-tag')
.on('click', addTag)
.call(svgIcon('#iD-icon-plus', 'light'));
.call(svgIcon('#iD-icon-plus', 'light'))
.on('click', addTag);
addRowEnter
.append('div')
.attr('class', 'space-value'); // preserve space
addRowEnter
.append('div')
.attr('class', 'space-buttons'); // preserve space
// Tag list items
var items = list.selectAll('.tag-row')
.data(entries, function(d) { return d.key; });
@@ -92,8 +107,8 @@ export function uiRawTagEditor(context) {
.each(unbind)
.remove();
// Enter
// Enter
var enter = items.enter()
.append('li')
.attr('class', 'tag-row')
@@ -133,7 +148,6 @@ export function uiRawTagEditor(context) {
// Update
items = items
.merge(enter)
.sort(function(a, b) {