From a054db647213bdcbbc876a36aaee75d01a8e3a4b Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Thu, 4 Apr 2019 17:56:01 -0700 Subject: [PATCH] Fix issue where hover-highlighting wouldn't disappear upon removing a relation from a member or a member from a relation (close #5612) --- modules/ui/raw_member_editor.js | 6 ++++-- modules/ui/raw_membership_editor.js | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/ui/raw_member_editor.js b/modules/ui/raw_member_editor.js index 69474753f..52dc9f4aa 100644 --- a/modules/ui/raw_member_editor.js +++ b/modules/ui/raw_member_editor.js @@ -69,6 +69,10 @@ export function uiRawMemberEditor(context) { function deleteMember(d) { + + // remove the hover-highlight styling + utilHighlightEntities([d.id], false, context); + context.perform( actionDeleteMember(d.relation.id, d.index), t('operations.delete_member.annotation') @@ -77,8 +81,6 @@ export function uiRawMemberEditor(context) { if (!context.hasEntity(d.relation.id)) { context.enter(modeBrowse(context)); } - - utilHighlightEntities([d.id], false, context); } diff --git a/modules/ui/raw_membership_editor.js b/modules/ui/raw_membership_editor.js index 971337b26..d3b36f3f7 100644 --- a/modules/ui/raw_membership_editor.js +++ b/modules/ui/raw_membership_editor.js @@ -87,6 +87,9 @@ export function uiRawMembershipEditor(context) { this.blur(); // avoid keeping focus on the button if (d === 0) return; // called on newrow (shoudn't happen) + // remove the hover-highlight styling + utilHighlightEntities([d.relation.id], false, context); + context.perform( actionDeleteMember(d.relation.id, d.index), t('operations.delete_member.annotation') @@ -184,16 +187,13 @@ export function uiRawMembershipEditor(context) { .append('li') .attr('class', 'member-row member-row-normal form-field'); - itemsEnter.each(function(d){ - // highlight the relation in the map while hovering on the list item - d3_select(this) - .on('mouseover', function() { - utilHighlightEntities([d.relation.id], true, context); - }) - .on('mouseout', function() { - utilHighlightEntities([d.relation.id], false, context); - }); - }); + // highlight the relation in the map while hovering on the list item + itemsEnter.on('mouseover', function(d) { + utilHighlightEntities([d.relation.id], true, context); + }) + .on('mouseout', function(d) { + utilHighlightEntities([d.relation.id], false, context); + }); var labelEnter = itemsEnter .append('label')