mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-21 15:56:56 +02:00
Begin d3 v4 update
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { rebind } from '../util/rebind';
|
||||
import { d3keybinding } from '../../js/lib/d3.keybinding.js';
|
||||
import * as d3 from 'd3';
|
||||
import { Entity } from '../core/index';
|
||||
/*
|
||||
The hover behavior adds the `.hover` class on mouseover to all elements to which
|
||||
@@ -15,8 +18,8 @@ export function Hover() {
|
||||
target;
|
||||
|
||||
function keydown() {
|
||||
if (altDisables && d3.event.keyCode === d3.keybinding.modifierCodes.alt) {
|
||||
dispatch.hover(null);
|
||||
if (altDisables && d3.event.keyCode === d3keybinding.modifierCodes.alt) {
|
||||
dispatch.call("hover", this, null);
|
||||
selection.selectAll('.hover')
|
||||
.classed('hover-suppressed', true)
|
||||
.classed('hover', false);
|
||||
@@ -24,8 +27,8 @@ export function Hover() {
|
||||
}
|
||||
|
||||
function keyup() {
|
||||
if (altDisables && d3.event.keyCode === d3.keybinding.modifierCodes.alt) {
|
||||
dispatch.hover(target ? target.id : null);
|
||||
if (altDisables && d3.event.keyCode === d3keybinding.modifierCodes.alt) {
|
||||
dispatch.call("hover", this, target ? target.id : null);
|
||||
selection.selectAll('.hover-suppressed')
|
||||
.classed('hover-suppressed', false)
|
||||
.classed('hover', true);
|
||||
@@ -59,9 +62,9 @@ export function Hover() {
|
||||
selection.selectAll(selector)
|
||||
.classed(suppressed ? 'hover-suppressed' : 'hover', true);
|
||||
|
||||
dispatch.hover(target.id);
|
||||
dispatch.call("hover", this, target.id);
|
||||
} else {
|
||||
dispatch.hover(null);
|
||||
dispatch.call("hover", this, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,5 +127,5 @@ export function Hover() {
|
||||
return hover;
|
||||
};
|
||||
|
||||
return d3.rebind(hover, dispatch, 'on');
|
||||
return rebind(hover, dispatch, 'on');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user