Convert lodah-es and d3 to named imports for behaviors

This commit is contained in:
Bryan Housel
2017-09-24 21:43:54 -04:00
parent a98f57cdcb
commit 75d2c45fd6
14 changed files with 259 additions and 157 deletions
+13 -9
View File
@@ -1,5 +1,9 @@
import * as d3 from 'd3';
import { utilSetTransform } from '../util/index';
import {
event as d3_event,
select as d3_select
} from 'd3-selection';
import { utilSetTransform } from '../util';
import { utilGetDimensions } from '../util/dimensions';
@@ -14,10 +18,10 @@ export function behaviorTail() {
function tail(selection) {
if (!text) return;
d3.select(window)
d3_select(window)
.on('resize.tail', function() { selectionSize = utilGetDimensions(selection); });
container = d3.select(document.body)
container = d3_select(document.body)
.append('div')
.style('display', 'none')
.attr('class', 'tail tooltip-inner');
@@ -45,22 +49,22 @@ export function behaviorTail() {
function mousemove() {
if (container.style('display') === 'none') show();
var xoffset = ((d3.event.clientX + tooltipSize[0] + xmargin) > selectionSize[0]) ?
var xoffset = ((d3_event.clientX + tooltipSize[0] + xmargin) > selectionSize[0]) ?
-tooltipSize[0] - xmargin : xmargin;
container.classed('left', xoffset > 0);
utilSetTransform(container, d3.event.clientX + xoffset, d3.event.clientY);
utilSetTransform(container, d3_event.clientX + xoffset, d3_event.clientY);
}
function mouseleave() {
if (d3.event.relatedTarget !== container.node()) {
if (d3_event.relatedTarget !== container.node()) {
container.style('display', 'none');
}
}
function mouseenter() {
if (d3.event.relatedTarget !== container.node()) {
if (d3_event.relatedTarget !== container.node()) {
show();
}
}
@@ -79,7 +83,7 @@ export function behaviorTail() {
.on('mouseenter.tail', null)
.on('mouseleave.tail', null);
d3.select(window)
d3_select(window)
.on('resize.tail', null);
};