Fix issue where items could not be deselected from the selection list in some browsers (close #8151)

This commit is contained in:
Quincy Morgan
2020-11-02 09:47:06 -05:00
parent f18697b660
commit 162f97bfc8
3 changed files with 36 additions and 23 deletions

View File

@@ -1010,6 +1010,22 @@ a.hide-toggle {
.section-selected-features .feature-list-item:last-child {
border: none;
}
.ideditor[dir='ltr'] .section-selected-features .feature-list-item > button:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.ideditor[dir='rtl'] .section-selected-features .feature-list-item > button:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.ideditor[dir='ltr'] .section-selected-features .feature-list-item > button:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.ideditor[dir='rtl'] .section-selected-features .feature-list-item > button:not(:last-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
/* Preset List and Icons
------------------------------------------------------- */

View File

@@ -39,8 +39,6 @@ export function uiSectionSelectionList(context) {
}
function deselectEntity(d3_event, entity) {
d3_event.stopPropagation();
var selectedIDs = _selectedIDs.slice();
var index = selectedIDs.indexOf(entity.id);
if (index > -1) {
@@ -55,7 +53,7 @@ export function uiSectionSelectionList(context) {
.data([0]);
list = list.enter()
.append('div')
.append('ul')
.attr('class', 'feature-list')
.merge(list);
@@ -71,30 +69,22 @@ export function uiSectionSelectionList(context) {
// Enter
var enter = items.enter()
.append('button')
.append('li')
.attr('class', 'feature-list-item')
.on('click', selectEntity);
enter
.each(function(d) {
d3_select(this).on('mouseover', function() {
utilHighlightEntities([d.id], true, context);
});
d3_select(this).on('mouseout', function() {
utilHighlightEntities([d.id], false, context);
});
d3_select(this)
.on('mouseover', function() {
utilHighlightEntities([d.id], true, context);
})
.on('mouseout', function() {
utilHighlightEntities([d.id], false, context);
});
});
var label = enter
.append('div')
.attr('class', 'label');
enter
.append('button')
.attr('class', 'close')
.attr('title', t('icons.deselect'))
.on('click', deselectEntity)
.call(svgIcon('#iD-icon-close'));
.attr('class', 'label')
.on('click', selectEntity);
label
.append('span')
@@ -109,6 +99,13 @@ export function uiSectionSelectionList(context) {
.append('span')
.attr('class', 'entity-name');
enter
.append('button')
.attr('class', 'close')
.attr('title', t('icons.deselect'))
.on('click', deselectEntity)
.call(svgIcon('#iD-icon-close'));
// Update
items = items.merge(enter);

View File

@@ -155,12 +155,12 @@ export function uiSidebar(context) {
.attr('class', 'inspector-hidden inspector-wrap');
var hoverModeSelect = function(targets) {
context.container().selectAll('.feature-list-item').classed('hover', false);
context.container().selectAll('.feature-list-item button').classed('hover', false);
if (context.selectedIDs().length > 1 &&
targets && targets.length) {
var elements = context.container().selectAll('.feature-list-item')
var elements = context.container().selectAll('.feature-list-item button')
.filter(function (node) {
return targets.indexOf(node) !== -1;
});