Skip to content

Commit

Permalink
Wrap selection list geometry icon in a span
Browse files Browse the repository at this point in the history
This is important so d3 update selection can select the geometry icon but not
the close icon.
  • Loading branch information
bhousel committed Jul 26, 2016
1 parent 77fa3c9 commit 018e7f2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions modules/ui/selection_list.js
Expand Up @@ -51,7 +51,10 @@ export function SelectionList(context, selectedIDs) {

// Enter
var label = enter.append('div')
.attr('class', 'label')
.attr('class', 'label');

label.append('span')
.attr('class', 'entity-geom-icon')
.call(Icon('', 'pre-text'));

label.append('span')
Expand All @@ -60,8 +63,13 @@ export function SelectionList(context, selectedIDs) {
label.append('span')
.attr('class', 'entity-name');

label.append('span')
.attr('class', 'close')
.on('click', deselectEntity)
.call(Icon('#icon-close'));

// Update
items.selectAll('use')
items.selectAll('.entity-geom-icon use')
.attr('href', function() {
var entity = this.parentNode.parentNode.__data__;
return '#icon-' + context.geometry(entity.id);
Expand All @@ -73,11 +81,6 @@ export function SelectionList(context, selectedIDs) {
items.selectAll('.entity-name')
.text(function(entity) { return displayName(entity); });

label.append('span')
.attr('class', 'close')
.on('click', deselectEntity)
.call(Icon('#icon-close'));

// Exit
items.exit()
.remove();
Expand Down

0 comments on commit 018e7f2

Please sign in to comment.