Handle both target GeoJSON and osmEntity in hover

(fixes test and allows hover on the area fills again)
This commit is contained in:
Bryan Housel
2018-01-01 22:53:40 -05:00
parent 6881205d43
commit ddaa828ec9
+8 -2
View File
@@ -6,6 +6,7 @@ import {
} from 'd3-selection';
import { d3keybinding as d3_keybinding } from '../lib/d3.keybinding.js';
import { osmEntity } from '../osm';
import { utilRebind } from '../util/rebind';
@@ -106,9 +107,14 @@ export function behaviorHover(context) {
_selection.selectAll('.hover-suppressed')
.classed('hover-suppressed', false);
var entity = datum && datum.properties && datum.properties.entity;
if (entity && entity.id !== _newId) {
var entity;
if (datum instanceof osmEntity) {
entity = datum;
} else {
entity = datum && datum.properties && datum.properties.entity;
}
if (entity && entity.id !== _newId) {
// If drawing a way, don't hover on a node that was just placed. #3974
var mode = context.mode() && context.mode().id;
if ((mode === 'draw-line' || mode === 'draw-area') && !_newId && entity.type === 'node') {