mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 03:11:22 +00:00
Convert lodah-es and d3 to named imports for util
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import * as d3 from 'd3';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
|
||||
|
||||
var jsonpCache = {};
|
||||
window.jsonpCache = jsonpCache;
|
||||
@@ -35,7 +36,7 @@ export function jsonpRequest(url, callback) {
|
||||
}
|
||||
|
||||
var cb = create(url),
|
||||
script = d3.select('head')
|
||||
script = d3_select('head')
|
||||
.append('script')
|
||||
.attr('type', 'text/javascript')
|
||||
.attr('src', url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as d3 from 'd3';
|
||||
import { select as d3_select } from 'd3-selection';
|
||||
import { utilFunctor } from './index';
|
||||
|
||||
|
||||
export function tooltip() {
|
||||
var tooltip = function(selection) {
|
||||
selection.each(setup);
|
||||
@@ -82,7 +83,7 @@ export function tooltip() {
|
||||
|
||||
|
||||
function setup() {
|
||||
var root = d3.select(this),
|
||||
var root = d3_select(this),
|
||||
animate = animation.apply(this, arguments),
|
||||
tip = root.selectAll('.tooltip').data([0]);
|
||||
|
||||
@@ -114,7 +115,7 @@ export function tooltip() {
|
||||
|
||||
|
||||
function show() {
|
||||
var root = d3.select(this),
|
||||
var root = d3_select(this),
|
||||
content = title.apply(this, arguments),
|
||||
tip = root.selectAll('.tooltip')
|
||||
.classed('in', true),
|
||||
@@ -152,7 +153,7 @@ export function tooltip() {
|
||||
|
||||
|
||||
function hide() {
|
||||
d3.select(this).selectAll('.tooltip')
|
||||
d3_select(this).selectAll('.tooltip')
|
||||
.classed('in', false);
|
||||
|
||||
this.tooltipVisible = false;
|
||||
@@ -172,7 +173,7 @@ export function tooltip() {
|
||||
|
||||
|
||||
function getPosition(node) {
|
||||
var mode = d3.select(node).style('position');
|
||||
var mode = d3_select(node).style('position');
|
||||
if (mode === 'absolute' || mode === 'static') {
|
||||
return {
|
||||
x: node.offsetLeft,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as d3 from 'd3';
|
||||
import _map from 'lodash-es/map';
|
||||
|
||||
import { t, textDirection } from './locale';
|
||||
import { utilDetect } from './detect';
|
||||
import { remove as removeDiacritics } from 'diacritics';
|
||||
@@ -6,8 +7,8 @@ import { fixRTLTextForSvg, rtlRegex } from './svg_paths_rtl_fix';
|
||||
|
||||
|
||||
export function utilTagText(entity) {
|
||||
return d3.entries(entity.tags).map(function(e) {
|
||||
return e.key + '=' + e.value;
|
||||
return _map(entity.tags, function(v, k) {
|
||||
return k + '=' + v;
|
||||
}).join(', ');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user