Merge pull request #5404 from quincylvania/selection-list-hover-highlighting

Adds hover highlighting to the selected features list
This commit is contained in:
Bryan Housel
2018-10-15 11:50:55 -04:00
committed by GitHub

View File

@@ -1,4 +1,7 @@
import { event as d3_event } from 'd3-selection';
import {
event as d3_event,
select as d3_select
} from 'd3-selection';
import { t } from '../util/locale';
import { modeSelect } from '../modes';
@@ -64,6 +67,18 @@ export function uiSelectionList(context, selectedIDs) {
.attr('class', 'feature-list-item')
.on('click', selectEntity);
enter
.each(function(d) {
// highlight the feature in the map while hovering on the list item
var selectorPrefix = d.type === 'node' ? 'g.' : 'path.';
d3_select(this).on('mouseover', function() {
context.surface().selectAll(selectorPrefix+d.id).classed('highlighted', true);
});
d3_select(this).on('mouseout', function() {
context.surface().selectAll(selectorPrefix+d.id).classed('highlighted', false);
});
});
var label = enter
.append('button')
.attr('class', 'label');