mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°7331 - Remove unnecessary files
This commit is contained in:
5
node_modules/d3/src/arrays/ascending.js
generated
vendored
5
node_modules/d3/src/arrays/ascending.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.ascending = d3_ascending;
|
||||
|
||||
function d3_ascending(a, b) {
|
||||
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
||||
}
|
||||
36
node_modules/d3/src/arrays/bisect.js
generated
vendored
36
node_modules/d3/src/arrays/bisect.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
import "ascending";
|
||||
|
||||
function d3_bisector(compare) {
|
||||
return {
|
||||
left: function(a, x, lo, hi) {
|
||||
if (arguments.length < 3) lo = 0;
|
||||
if (arguments.length < 4) hi = a.length;
|
||||
while (lo < hi) {
|
||||
var mid = lo + hi >>> 1;
|
||||
if (compare(a[mid], x) < 0) lo = mid + 1;
|
||||
else hi = mid;
|
||||
}
|
||||
return lo;
|
||||
},
|
||||
right: function(a, x, lo, hi) {
|
||||
if (arguments.length < 3) lo = 0;
|
||||
if (arguments.length < 4) hi = a.length;
|
||||
while (lo < hi) {
|
||||
var mid = lo + hi >>> 1;
|
||||
if (compare(a[mid], x) > 0) hi = mid;
|
||||
else lo = mid + 1;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var d3_bisect = d3_bisector(d3_ascending);
|
||||
d3.bisectLeft = d3_bisect.left;
|
||||
d3.bisect = d3.bisectRight = d3_bisect.right;
|
||||
|
||||
d3.bisector = function(f) {
|
||||
return d3_bisector(f.length === 1
|
||||
? function(d, x) { return d3_ascending(f(d), x); }
|
||||
: f);
|
||||
};
|
||||
3
node_modules/d3/src/arrays/descending.js
generated
vendored
3
node_modules/d3/src/arrays/descending.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
d3.descending = function(a, b) {
|
||||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
||||
};
|
||||
6
node_modules/d3/src/arrays/deviation.js
generated
vendored
6
node_modules/d3/src/arrays/deviation.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import "variance";
|
||||
|
||||
d3.deviation = function() {
|
||||
var v = d3.variance.apply(this, arguments);
|
||||
return v ? Math.sqrt(v) : v;
|
||||
};
|
||||
5
node_modules/d3/src/arrays/entries.js
generated
vendored
5
node_modules/d3/src/arrays/entries.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.entries = function(map) {
|
||||
var entries = [];
|
||||
for (var key in map) entries.push({key: key, value: map[key]});
|
||||
return entries;
|
||||
};
|
||||
21
node_modules/d3/src/arrays/extent.js
generated
vendored
21
node_modules/d3/src/arrays/extent.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
d3.extent = function(array, f) {
|
||||
var i = -1,
|
||||
n = array.length,
|
||||
a,
|
||||
b,
|
||||
c;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = c = b; break; }
|
||||
while (++i < n) if ((b = array[i]) != null) {
|
||||
if (a > b) a = b;
|
||||
if (c < b) c = b;
|
||||
}
|
||||
} else {
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = c = b; break; }
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
|
||||
if (a > b) a = b;
|
||||
if (c < b) c = b;
|
||||
}
|
||||
}
|
||||
return [a, c];
|
||||
};
|
||||
25
node_modules/d3/src/arrays/index.js
generated
vendored
25
node_modules/d3/src/arrays/index.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
import "ascending";
|
||||
import "descending";
|
||||
import "min";
|
||||
import "max";
|
||||
import "extent";
|
||||
import "sum";
|
||||
import "mean";
|
||||
import "median";
|
||||
import "quantile";
|
||||
import "variance";
|
||||
import "deviation";
|
||||
import "bisect";
|
||||
import "shuffle";
|
||||
import "permute";
|
||||
import "pairs";
|
||||
import "zip";
|
||||
import "transpose";
|
||||
import "keys";
|
||||
import "values";
|
||||
import "entries";
|
||||
import "merge";
|
||||
import "range";
|
||||
import "nest";
|
||||
import "map";
|
||||
import "set";
|
||||
5
node_modules/d3/src/arrays/keys.js
generated
vendored
5
node_modules/d3/src/arrays/keys.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.keys = function(map) {
|
||||
var keys = [];
|
||||
for (var key in map) keys.push(key);
|
||||
return keys;
|
||||
};
|
||||
84
node_modules/d3/src/arrays/map.js
generated
vendored
84
node_modules/d3/src/arrays/map.js
generated
vendored
@@ -1,84 +0,0 @@
|
||||
import "../core/class";
|
||||
|
||||
d3.map = function(object, f) {
|
||||
var map = new d3_Map;
|
||||
if (object instanceof d3_Map) {
|
||||
object.forEach(function(key, value) { map.set(key, value); });
|
||||
} else if (Array.isArray(object)) {
|
||||
var i = -1,
|
||||
n = object.length,
|
||||
o;
|
||||
if (arguments.length === 1) while (++i < n) map.set(i, object[i]);
|
||||
else while (++i < n) map.set(f.call(object, o = object[i], i), o);
|
||||
} else {
|
||||
for (var key in object) map.set(key, object[key]);
|
||||
}
|
||||
return map;
|
||||
};
|
||||
|
||||
function d3_Map() {
|
||||
this._ = Object.create(null);
|
||||
}
|
||||
|
||||
var d3_map_proto = "__proto__",
|
||||
d3_map_zero = "\0";
|
||||
|
||||
d3_class(d3_Map, {
|
||||
has: d3_map_has,
|
||||
get: function(key) {
|
||||
return this._[d3_map_escape(key)];
|
||||
},
|
||||
set: function(key, value) {
|
||||
return this._[d3_map_escape(key)] = value;
|
||||
},
|
||||
remove: d3_map_remove,
|
||||
keys: d3_map_keys,
|
||||
values: function() {
|
||||
var values = [];
|
||||
for (var key in this._) values.push(this._[key]);
|
||||
return values;
|
||||
},
|
||||
entries: function() {
|
||||
var entries = [];
|
||||
for (var key in this._) entries.push({key: d3_map_unescape(key), value: this._[key]});
|
||||
return entries;
|
||||
},
|
||||
size: d3_map_size,
|
||||
empty: d3_map_empty,
|
||||
forEach: function(f) {
|
||||
for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
|
||||
}
|
||||
});
|
||||
|
||||
function d3_map_escape(key) {
|
||||
return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
|
||||
}
|
||||
|
||||
function d3_map_unescape(key) {
|
||||
return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
|
||||
}
|
||||
|
||||
function d3_map_has(key) {
|
||||
return d3_map_escape(key) in this._;
|
||||
}
|
||||
|
||||
function d3_map_remove(key) {
|
||||
return (key = d3_map_escape(key)) in this._ && delete this._[key];
|
||||
}
|
||||
|
||||
function d3_map_keys() {
|
||||
var keys = [];
|
||||
for (var key in this._) keys.push(d3_map_unescape(key));
|
||||
return keys;
|
||||
}
|
||||
|
||||
function d3_map_size() {
|
||||
var size = 0;
|
||||
for (var key in this._) ++size;
|
||||
return size;
|
||||
}
|
||||
|
||||
function d3_map_empty() {
|
||||
for (var key in this._) return false;
|
||||
return true;
|
||||
}
|
||||
14
node_modules/d3/src/arrays/max.js
generated
vendored
14
node_modules/d3/src/arrays/max.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
d3.max = function(array, f) {
|
||||
var i = -1,
|
||||
n = array.length,
|
||||
a,
|
||||
b;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
||||
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
|
||||
} else {
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
|
||||
}
|
||||
return a;
|
||||
};
|
||||
15
node_modules/d3/src/arrays/mean.js
generated
vendored
15
node_modules/d3/src/arrays/mean.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import "../math/number";
|
||||
|
||||
d3.mean = function(array, f) {
|
||||
var s = 0,
|
||||
n = array.length,
|
||||
a,
|
||||
i = -1,
|
||||
j = n;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;
|
||||
} else {
|
||||
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;
|
||||
}
|
||||
if (j) return s / j;
|
||||
};
|
||||
16
node_modules/d3/src/arrays/median.js
generated
vendored
16
node_modules/d3/src/arrays/median.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
import "../math/number";
|
||||
import "ascending";
|
||||
import "quantile";
|
||||
|
||||
d3.median = function(array, f) {
|
||||
var numbers = [],
|
||||
n = array.length,
|
||||
a,
|
||||
i = -1;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
|
||||
} else {
|
||||
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
|
||||
}
|
||||
if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), 0.5);
|
||||
};
|
||||
21
node_modules/d3/src/arrays/merge.js
generated
vendored
21
node_modules/d3/src/arrays/merge.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
d3.merge = function(arrays) {
|
||||
var n = arrays.length,
|
||||
m,
|
||||
i = -1,
|
||||
j = 0,
|
||||
merged,
|
||||
array;
|
||||
|
||||
while (++i < n) j += arrays[i].length;
|
||||
merged = new Array(j);
|
||||
|
||||
while (--n >= 0) {
|
||||
array = arrays[n];
|
||||
m = array.length;
|
||||
while (--m >= 0) {
|
||||
merged[--j] = array[m];
|
||||
}
|
||||
}
|
||||
|
||||
return merged;
|
||||
};
|
||||
14
node_modules/d3/src/arrays/min.js
generated
vendored
14
node_modules/d3/src/arrays/min.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
d3.min = function(array, f) {
|
||||
var i = -1,
|
||||
n = array.length,
|
||||
a,
|
||||
b;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if ((b = array[i]) != null && b >= b) { a = b; break; }
|
||||
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
|
||||
} else {
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) { a = b; break; }
|
||||
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
|
||||
}
|
||||
return a;
|
||||
};
|
||||
97
node_modules/d3/src/arrays/nest.js
generated
vendored
97
node_modules/d3/src/arrays/nest.js
generated
vendored
@@ -1,97 +0,0 @@
|
||||
import "map";
|
||||
|
||||
d3.nest = function() {
|
||||
var nest = {},
|
||||
keys = [],
|
||||
sortKeys = [],
|
||||
sortValues,
|
||||
rollup;
|
||||
|
||||
function map(mapType, array, depth) {
|
||||
if (depth >= keys.length) return rollup
|
||||
? rollup.call(nest, array) : (sortValues
|
||||
? array.sort(sortValues)
|
||||
: array);
|
||||
|
||||
var i = -1,
|
||||
n = array.length,
|
||||
key = keys[depth++],
|
||||
keyValue,
|
||||
object,
|
||||
setter,
|
||||
valuesByKey = new d3_Map,
|
||||
values;
|
||||
|
||||
while (++i < n) {
|
||||
if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
|
||||
values.push(object);
|
||||
} else {
|
||||
valuesByKey.set(keyValue, [object]);
|
||||
}
|
||||
}
|
||||
|
||||
if (mapType) {
|
||||
object = mapType();
|
||||
setter = function(keyValue, values) {
|
||||
object.set(keyValue, map(mapType, values, depth));
|
||||
};
|
||||
} else {
|
||||
object = {};
|
||||
setter = function(keyValue, values) {
|
||||
object[keyValue] = map(mapType, values, depth);
|
||||
};
|
||||
}
|
||||
|
||||
valuesByKey.forEach(setter);
|
||||
return object;
|
||||
}
|
||||
|
||||
function entries(map, depth) {
|
||||
if (depth >= keys.length) return map;
|
||||
|
||||
var array = [],
|
||||
sortKey = sortKeys[depth++];
|
||||
|
||||
map.forEach(function(key, keyMap) {
|
||||
array.push({key: key, values: entries(keyMap, depth)});
|
||||
});
|
||||
|
||||
return sortKey
|
||||
? array.sort(function(a, b) { return sortKey(a.key, b.key); })
|
||||
: array;
|
||||
}
|
||||
|
||||
nest.map = function(array, mapType) {
|
||||
return map(mapType, array, 0);
|
||||
};
|
||||
|
||||
nest.entries = function(array) {
|
||||
return entries(map(d3.map, array, 0), 0);
|
||||
};
|
||||
|
||||
nest.key = function(d) {
|
||||
keys.push(d);
|
||||
return nest;
|
||||
};
|
||||
|
||||
// Specifies the order for the most-recently specified key.
|
||||
// Note: only applies to entries. Map keys are unordered!
|
||||
nest.sortKeys = function(order) {
|
||||
sortKeys[keys.length - 1] = order;
|
||||
return nest;
|
||||
};
|
||||
|
||||
// Specifies the order for leaf values.
|
||||
// Applies to both maps and entries array.
|
||||
nest.sortValues = function(order) {
|
||||
sortValues = order;
|
||||
return nest;
|
||||
};
|
||||
|
||||
nest.rollup = function(f) {
|
||||
rollup = f;
|
||||
return nest;
|
||||
};
|
||||
|
||||
return nest;
|
||||
};
|
||||
5
node_modules/d3/src/arrays/pairs.js
generated
vendored
5
node_modules/d3/src/arrays/pairs.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.pairs = function(array) {
|
||||
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
|
||||
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
|
||||
return pairs;
|
||||
};
|
||||
5
node_modules/d3/src/arrays/permute.js
generated
vendored
5
node_modules/d3/src/arrays/permute.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.permute = function(array, indexes) {
|
||||
var i = indexes.length, permutes = new Array(i);
|
||||
while (i--) permutes[i] = array[indexes[i]];
|
||||
return permutes;
|
||||
};
|
||||
8
node_modules/d3/src/arrays/quantile.js
generated
vendored
8
node_modules/d3/src/arrays/quantile.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
// R-7 per <http://en.wikipedia.org/wiki/Quantile>
|
||||
d3.quantile = function(values, p) {
|
||||
var H = (values.length - 1) * p + 1,
|
||||
h = Math.floor(H),
|
||||
v = +values[h - 1],
|
||||
e = H - h;
|
||||
return e ? v + e * (values[h] - v) : v;
|
||||
};
|
||||
26
node_modules/d3/src/arrays/range.js
generated
vendored
26
node_modules/d3/src/arrays/range.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import "../math/abs";
|
||||
|
||||
d3.range = function(start, stop, step) {
|
||||
if (arguments.length < 3) {
|
||||
step = 1;
|
||||
if (arguments.length < 2) {
|
||||
stop = start;
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
if ((stop - start) / step === Infinity) throw new Error("infinite range");
|
||||
var range = [],
|
||||
k = d3_range_integerScale(abs(step)),
|
||||
i = -1,
|
||||
j;
|
||||
start *= k, stop *= k, step *= k;
|
||||
if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
|
||||
else while ((j = start + step * ++i) < stop) range.push(j / k);
|
||||
return range;
|
||||
};
|
||||
|
||||
function d3_range_integerScale(x) {
|
||||
var k = 1;
|
||||
while (x * k % 1) k *= 10;
|
||||
return k;
|
||||
}
|
||||
27
node_modules/d3/src/arrays/set.js
generated
vendored
27
node_modules/d3/src/arrays/set.js
generated
vendored
@@ -1,27 +0,0 @@
|
||||
import "../core/class";
|
||||
import "map";
|
||||
|
||||
d3.set = function(array) {
|
||||
var set = new d3_Set;
|
||||
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
|
||||
return set;
|
||||
};
|
||||
|
||||
function d3_Set() {
|
||||
this._ = Object.create(null);
|
||||
}
|
||||
|
||||
d3_class(d3_Set, {
|
||||
has: d3_map_has,
|
||||
add: function(key) {
|
||||
this._[d3_map_escape(key += "")] = true;
|
||||
return key;
|
||||
},
|
||||
remove: d3_map_remove,
|
||||
values: d3_map_keys,
|
||||
size: d3_map_size,
|
||||
empty: d3_map_empty,
|
||||
forEach: function(f) {
|
||||
for (var key in this._) f.call(this, d3_map_unescape(key));
|
||||
}
|
||||
});
|
||||
9
node_modules/d3/src/arrays/shuffle.js
generated
vendored
9
node_modules/d3/src/arrays/shuffle.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
d3.shuffle = function(array, i0, i1) {
|
||||
if ((m = arguments.length) < 3) { i1 = array.length; if (m < 2) i0 = 0; }
|
||||
var m = i1 - i0, t, i;
|
||||
while (m) {
|
||||
i = Math.random() * m-- | 0;
|
||||
t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;
|
||||
}
|
||||
return array;
|
||||
};
|
||||
14
node_modules/d3/src/arrays/sum.js
generated
vendored
14
node_modules/d3/src/arrays/sum.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
import "../math/number";
|
||||
|
||||
d3.sum = function(array, f) {
|
||||
var s = 0,
|
||||
n = array.length,
|
||||
a,
|
||||
i = -1;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) if (d3_numeric(a = +array[i])) s += a; // zero and null are equivalent
|
||||
} else {
|
||||
while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
|
||||
}
|
||||
return s;
|
||||
};
|
||||
15
node_modules/d3/src/arrays/transpose.js
generated
vendored
15
node_modules/d3/src/arrays/transpose.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import "min";
|
||||
|
||||
d3.transpose = function(matrix) {
|
||||
if (!(n = matrix.length)) return [];
|
||||
for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m;) {
|
||||
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) {
|
||||
row[j] = matrix[j][i];
|
||||
}
|
||||
}
|
||||
return transpose;
|
||||
};
|
||||
|
||||
function d3_transposeLength(d) {
|
||||
return d.length;
|
||||
}
|
||||
5
node_modules/d3/src/arrays/values.js
generated
vendored
5
node_modules/d3/src/arrays/values.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.values = function(map) {
|
||||
var values = [];
|
||||
for (var key in map) values.push(map[key]);
|
||||
return values;
|
||||
};
|
||||
29
node_modules/d3/src/arrays/variance.js
generated
vendored
29
node_modules/d3/src/arrays/variance.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
import "../math/number";
|
||||
|
||||
d3.variance = function(array, f) {
|
||||
var n = array.length,
|
||||
m = 0,
|
||||
a,
|
||||
d,
|
||||
s = 0,
|
||||
i = -1,
|
||||
j = 0;
|
||||
if (arguments.length === 1) {
|
||||
while (++i < n) {
|
||||
if (d3_numeric(a = d3_number(array[i]))) {
|
||||
d = a - m;
|
||||
m += d / ++j;
|
||||
s += d * (a - m);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (++i < n) {
|
||||
if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {
|
||||
d = a - m;
|
||||
m += d / ++j;
|
||||
s += d * (a - m);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j > 1) return s / (j - 1);
|
||||
};
|
||||
5
node_modules/d3/src/arrays/zip.js
generated
vendored
5
node_modules/d3/src/arrays/zip.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
import "transpose";
|
||||
|
||||
d3.zip = function() {
|
||||
return d3.transpose(arguments);
|
||||
};
|
||||
1
node_modules/d3/src/behavior/behavior.js
generated
vendored
1
node_modules/d3/src/behavior/behavior.js
generated
vendored
@@ -1 +0,0 @@
|
||||
d3.behavior = {};
|
||||
88
node_modules/d3/src/behavior/drag.js
generated
vendored
88
node_modules/d3/src/behavior/drag.js
generated
vendored
@@ -1,88 +0,0 @@
|
||||
import "../core/document";
|
||||
import "../core/identity";
|
||||
import "../core/rebind";
|
||||
import "../event/drag";
|
||||
import "../event/event";
|
||||
import "../event/mouse";
|
||||
import "../event/touch";
|
||||
import "behavior";
|
||||
|
||||
d3.behavior.drag = function() {
|
||||
var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"),
|
||||
origin = null,
|
||||
mousedown = dragstart(d3_noop, d3.mouse, d3_window, "mousemove", "mouseup"),
|
||||
touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_identity, "touchmove", "touchend");
|
||||
|
||||
function drag() {
|
||||
this.on("mousedown.drag", mousedown)
|
||||
.on("touchstart.drag", touchstart);
|
||||
}
|
||||
|
||||
function dragstart(id, position, subject, move, end) {
|
||||
return function() {
|
||||
var that = this,
|
||||
target = d3.event.target.correspondingElement || d3.event.target,
|
||||
parent = that.parentNode,
|
||||
dispatch = event.of(that, arguments),
|
||||
dragged = 0,
|
||||
dragId = id(),
|
||||
dragName = ".drag" + (dragId == null ? "" : "-" + dragId),
|
||||
dragOffset,
|
||||
dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended),
|
||||
dragRestore = d3_event_dragSuppress(target),
|
||||
position0 = position(parent, dragId);
|
||||
|
||||
if (origin) {
|
||||
dragOffset = origin.apply(that, arguments);
|
||||
dragOffset = [dragOffset.x - position0[0], dragOffset.y - position0[1]];
|
||||
} else {
|
||||
dragOffset = [0, 0];
|
||||
}
|
||||
|
||||
dispatch({type: "dragstart"});
|
||||
|
||||
function moved() {
|
||||
var position1 = position(parent, dragId), dx, dy;
|
||||
if (!position1) return; // this touch didn’t move
|
||||
|
||||
dx = position1[0] - position0[0];
|
||||
dy = position1[1] - position0[1];
|
||||
dragged |= dx | dy;
|
||||
position0 = position1;
|
||||
|
||||
dispatch({
|
||||
type: "drag",
|
||||
x: position1[0] + dragOffset[0],
|
||||
y: position1[1] + dragOffset[1],
|
||||
dx: dx,
|
||||
dy: dy
|
||||
});
|
||||
}
|
||||
|
||||
function ended() {
|
||||
if (!position(parent, dragId)) return; // this touch didn’t end
|
||||
dragSubject.on(move + dragName, null).on(end + dragName, null);
|
||||
dragRestore(dragged);
|
||||
dispatch({type: "dragend"});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
drag.origin = function(x) {
|
||||
if (!arguments.length) return origin;
|
||||
origin = x;
|
||||
return drag;
|
||||
};
|
||||
|
||||
return d3.rebind(drag, event, "on");
|
||||
};
|
||||
|
||||
// While it is possible to receive a touchstart event with more than one changed
|
||||
// touch, the event is only shared by touches on the same target; for new
|
||||
// touches targetting different elements, multiple touchstart events are
|
||||
// received even when the touches start simultaneously. Since multiple touches
|
||||
// cannot move the same target to different locations concurrently without
|
||||
// tearing the fabric of spacetime, we allow the first touch to win.
|
||||
function d3_behavior_dragTouchId() {
|
||||
return d3.event.changedTouches[0].identifier;
|
||||
}
|
||||
3
node_modules/d3/src/behavior/index.js
generated
vendored
3
node_modules/d3/src/behavior/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "behavior";
|
||||
import "drag";
|
||||
import "zoom";
|
||||
348
node_modules/d3/src/behavior/zoom.js
generated
vendored
348
node_modules/d3/src/behavior/zoom.js
generated
vendored
@@ -1,348 +0,0 @@
|
||||
import "../core/document";
|
||||
import "../core/rebind";
|
||||
import "../event/drag";
|
||||
import "../event/event";
|
||||
import "../event/mouse";
|
||||
import "../event/touches";
|
||||
import "../selection/selection";
|
||||
import "../interpolate/zoom";
|
||||
import "behavior";
|
||||
|
||||
d3.behavior.zoom = function() {
|
||||
var view = {x: 0, y: 0, k: 1},
|
||||
translate0, // translate when we started zooming (to avoid drift)
|
||||
center0, // implicit desired position of translate0 after zooming
|
||||
center, // explicit desired position of translate0 after zooming
|
||||
size = [960, 500], // viewport size; required for zoom interpolation
|
||||
scaleExtent = d3_behavior_zoomInfinity,
|
||||
duration = 250,
|
||||
zooming = 0,
|
||||
mousedown = "mousedown.zoom",
|
||||
mousemove = "mousemove.zoom",
|
||||
mouseup = "mouseup.zoom",
|
||||
mousewheelTimer,
|
||||
touchstart = "touchstart.zoom",
|
||||
touchtime, // time of last touchstart (to detect double-tap)
|
||||
event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"),
|
||||
x0,
|
||||
x1,
|
||||
y0,
|
||||
y1;
|
||||
|
||||
// Lazily determine the DOM’s support for Wheel events.
|
||||
// https://developer.mozilla.org/en-US/docs/Mozilla_event_reference/wheel
|
||||
if (!d3_behavior_zoomWheel) {
|
||||
d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() { return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1); }, "wheel")
|
||||
: "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() { return d3.event.wheelDelta; }, "mousewheel")
|
||||
: (d3_behavior_zoomDelta = function() { return -d3.event.detail; }, "MozMousePixelScroll");
|
||||
}
|
||||
|
||||
function zoom(g) {
|
||||
g .on(mousedown, mousedowned)
|
||||
.on(d3_behavior_zoomWheel + ".zoom", mousewheeled)
|
||||
.on("dblclick.zoom", dblclicked)
|
||||
.on(touchstart, touchstarted);
|
||||
}
|
||||
|
||||
zoom.event = function(g) {
|
||||
g.each(function() {
|
||||
var dispatch = event.of(this, arguments),
|
||||
view1 = view;
|
||||
if (d3_transitionInheritId) {
|
||||
d3.select(this).transition()
|
||||
.each("start.zoom", function() {
|
||||
view = this.__chart__ || {x: 0, y: 0, k: 1}; // pre-transition state
|
||||
zoomstarted(dispatch);
|
||||
})
|
||||
.tween("zoom:zoom", function() {
|
||||
var dx = size[0],
|
||||
dy = size[1],
|
||||
cx = center0 ? center0[0] : dx / 2,
|
||||
cy = center0 ? center0[1] : dy / 2,
|
||||
i = d3.interpolateZoom(
|
||||
[(cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k],
|
||||
[(cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k]
|
||||
);
|
||||
return function(t) {
|
||||
var l = i(t), k = dx / l[2];
|
||||
this.__chart__ = view = {x: cx - l[0] * k, y: cy - l[1] * k, k: k};
|
||||
zoomed(dispatch);
|
||||
};
|
||||
})
|
||||
.each("interrupt.zoom", function() {
|
||||
zoomended(dispatch);
|
||||
})
|
||||
.each("end.zoom", function() {
|
||||
zoomended(dispatch);
|
||||
});
|
||||
} else {
|
||||
this.__chart__ = view;
|
||||
zoomstarted(dispatch);
|
||||
zoomed(dispatch);
|
||||
zoomended(dispatch);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
zoom.translate = function(_) {
|
||||
if (!arguments.length) return [view.x, view.y];
|
||||
view = {x: +_[0], y: +_[1], k: view.k}; // copy-on-write
|
||||
rescale();
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.scale = function(_) {
|
||||
if (!arguments.length) return view.k;
|
||||
view = {x: view.x, y: view.y, k: null}; // copy-on-write
|
||||
scaleTo(+_);
|
||||
rescale();
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.scaleExtent = function(_) {
|
||||
if (!arguments.length) return scaleExtent;
|
||||
scaleExtent = _ == null ? d3_behavior_zoomInfinity : [+_[0], +_[1]];
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.center = function(_) {
|
||||
if (!arguments.length) return center;
|
||||
center = _ && [+_[0], +_[1]];
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.size = function(_) {
|
||||
if (!arguments.length) return size;
|
||||
size = _ && [+_[0], +_[1]];
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.duration = function(_) {
|
||||
if (!arguments.length) return duration;
|
||||
duration = +_; // TODO function based on interpolateZoom distance?
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.x = function(z) {
|
||||
if (!arguments.length) return x1;
|
||||
x1 = z;
|
||||
x0 = z.copy();
|
||||
view = {x: 0, y: 0, k: 1}; // copy-on-write
|
||||
return zoom;
|
||||
};
|
||||
|
||||
zoom.y = function(z) {
|
||||
if (!arguments.length) return y1;
|
||||
y1 = z;
|
||||
y0 = z.copy();
|
||||
view = {x: 0, y: 0, k: 1}; // copy-on-write
|
||||
return zoom;
|
||||
};
|
||||
|
||||
function location(p) {
|
||||
return [(p[0] - view.x) / view.k, (p[1] - view.y) / view.k];
|
||||
}
|
||||
|
||||
function point(l) {
|
||||
return [l[0] * view.k + view.x, l[1] * view.k + view.y];
|
||||
}
|
||||
|
||||
function scaleTo(s) {
|
||||
view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
|
||||
}
|
||||
|
||||
function translateTo(p, l) {
|
||||
l = point(l);
|
||||
view.x += p[0] - l[0];
|
||||
view.y += p[1] - l[1];
|
||||
}
|
||||
|
||||
function zoomTo(that, p, l, k) {
|
||||
that.__chart__ = {x: view.x, y: view.y, k: view.k};
|
||||
|
||||
scaleTo(Math.pow(2, k));
|
||||
translateTo(center0 = p, l);
|
||||
|
||||
that = d3.select(that);
|
||||
if (duration > 0) that = that.transition().duration(duration);
|
||||
that.call(zoom.event);
|
||||
}
|
||||
|
||||
function rescale() {
|
||||
if (x1) x1.domain(x0.range().map(function(x) { return (x - view.x) / view.k; }).map(x0.invert));
|
||||
if (y1) y1.domain(y0.range().map(function(y) { return (y - view.y) / view.k; }).map(y0.invert));
|
||||
}
|
||||
|
||||
function zoomstarted(dispatch) {
|
||||
if (!zooming++) dispatch({type: "zoomstart"});
|
||||
}
|
||||
|
||||
function zoomed(dispatch) {
|
||||
rescale();
|
||||
dispatch({type: "zoom", scale: view.k, translate: [view.x, view.y]});
|
||||
}
|
||||
|
||||
function zoomended(dispatch) {
|
||||
if (!--zooming) dispatch({type: "zoomend"}), center0 = null;
|
||||
}
|
||||
|
||||
function mousedowned() {
|
||||
var that = this,
|
||||
dispatch = event.of(that, arguments),
|
||||
dragged = 0,
|
||||
subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended),
|
||||
location0 = location(d3.mouse(that)),
|
||||
dragRestore = d3_event_dragSuppress(that);
|
||||
|
||||
d3_selection_interrupt.call(that);
|
||||
zoomstarted(dispatch);
|
||||
|
||||
function moved() {
|
||||
dragged = 1;
|
||||
translateTo(d3.mouse(that), location0);
|
||||
zoomed(dispatch);
|
||||
}
|
||||
|
||||
function ended() {
|
||||
subject.on(mousemove, null).on(mouseup, null);
|
||||
dragRestore(dragged);
|
||||
zoomended(dispatch);
|
||||
}
|
||||
}
|
||||
|
||||
// These closures persist for as long as at least one touch is active.
|
||||
function touchstarted() {
|
||||
var that = this,
|
||||
dispatch = event.of(that, arguments),
|
||||
locations0 = {}, // touchstart locations
|
||||
distance0 = 0, // distance² between initial touches
|
||||
scale0, // scale when we started touching
|
||||
zoomName = ".zoom-" + d3.event.changedTouches[0].identifier,
|
||||
touchmove = "touchmove" + zoomName,
|
||||
touchend = "touchend" + zoomName,
|
||||
targets = [],
|
||||
subject = d3.select(that),
|
||||
dragRestore = d3_event_dragSuppress(that);
|
||||
|
||||
started();
|
||||
zoomstarted(dispatch);
|
||||
|
||||
// Workaround for Chrome issue 412723: the touchstart listener must be set
|
||||
// after the touchmove listener.
|
||||
subject.on(mousedown, null).on(touchstart, started); // prevent duplicate events
|
||||
|
||||
// Updates locations of any touches in locations0.
|
||||
function relocate() {
|
||||
var touches = d3.touches(that);
|
||||
scale0 = view.k;
|
||||
touches.forEach(function(t) {
|
||||
if (t.identifier in locations0) locations0[t.identifier] = location(t);
|
||||
});
|
||||
return touches;
|
||||
}
|
||||
|
||||
// Temporarily override touchstart while gesture is active.
|
||||
function started() {
|
||||
|
||||
// Listen for touchmove and touchend on the target of touchstart.
|
||||
var target = d3.event.target;
|
||||
d3.select(target).on(touchmove, moved).on(touchend, ended);
|
||||
targets.push(target);
|
||||
|
||||
// Only track touches started on the same subject element.
|
||||
var changed = d3.event.changedTouches;
|
||||
for (var i = 0, n = changed.length; i < n; ++i) {
|
||||
locations0[changed[i].identifier] = null;
|
||||
}
|
||||
|
||||
var touches = relocate(),
|
||||
now = Date.now();
|
||||
|
||||
if (touches.length === 1) {
|
||||
if (now - touchtime < 500) { // dbltap
|
||||
var p = touches[0];
|
||||
zoomTo(that, p, locations0[p.identifier], Math.floor(Math.log(view.k) / Math.LN2) + 1);
|
||||
d3_eventPreventDefault();
|
||||
}
|
||||
touchtime = now;
|
||||
} else if (touches.length > 1) {
|
||||
var p = touches[0], q = touches[1],
|
||||
dx = p[0] - q[0], dy = p[1] - q[1];
|
||||
distance0 = dx * dx + dy * dy;
|
||||
}
|
||||
}
|
||||
|
||||
function moved() {
|
||||
var touches = d3.touches(that),
|
||||
p0, l0,
|
||||
p1, l1;
|
||||
|
||||
d3_selection_interrupt.call(that);
|
||||
|
||||
for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
|
||||
p1 = touches[i];
|
||||
if (l1 = locations0[p1.identifier]) {
|
||||
if (l0) break;
|
||||
p0 = p1, l0 = l1;
|
||||
}
|
||||
}
|
||||
|
||||
if (l1) {
|
||||
var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1,
|
||||
scale1 = distance0 && Math.sqrt(distance1 / distance0);
|
||||
p0 = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
|
||||
l0 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
|
||||
scaleTo(scale1 * scale0);
|
||||
}
|
||||
|
||||
touchtime = null;
|
||||
translateTo(p0, l0);
|
||||
zoomed(dispatch);
|
||||
}
|
||||
|
||||
function ended() {
|
||||
// If there are any globally-active touches remaining, remove the ended
|
||||
// touches from locations0.
|
||||
if (d3.event.touches.length) {
|
||||
var changed = d3.event.changedTouches;
|
||||
for (var i = 0, n = changed.length; i < n; ++i) {
|
||||
delete locations0[changed[i].identifier];
|
||||
}
|
||||
// If locations0 is not empty, then relocate and continue listening for
|
||||
// touchmove and touchend.
|
||||
for (var identifier in locations0) {
|
||||
return void relocate(); // locations may have detached due to rotation
|
||||
}
|
||||
}
|
||||
// Otherwise, remove touchmove and touchend listeners.
|
||||
d3.selectAll(targets).on(zoomName, null);
|
||||
subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
|
||||
dragRestore();
|
||||
zoomended(dispatch);
|
||||
}
|
||||
}
|
||||
|
||||
function mousewheeled() {
|
||||
var dispatch = event.of(this, arguments);
|
||||
if (mousewheelTimer) clearTimeout(mousewheelTimer);
|
||||
else d3_selection_interrupt.call(this), translate0 = location(center0 = center || d3.mouse(this)), zoomstarted(dispatch);
|
||||
mousewheelTimer = setTimeout(function() { mousewheelTimer = null; zoomended(dispatch); }, 50);
|
||||
d3_eventPreventDefault();
|
||||
scaleTo(Math.pow(2, d3_behavior_zoomDelta() * 0.002) * view.k);
|
||||
translateTo(center0, translate0);
|
||||
zoomed(dispatch);
|
||||
}
|
||||
|
||||
function dblclicked() {
|
||||
var p = d3.mouse(this),
|
||||
k = Math.log(view.k) / Math.LN2;
|
||||
|
||||
zoomTo(this, p, location(p), d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1);
|
||||
}
|
||||
|
||||
return d3.rebind(zoom, event, "on");
|
||||
};
|
||||
|
||||
var d3_behavior_zoomInfinity = [0, Infinity], // default scale extent
|
||||
d3_behavior_zoomDelta, // initialized lazily
|
||||
d3_behavior_zoomWheel;
|
||||
7
node_modules/d3/src/color/color.js
generated
vendored
7
node_modules/d3/src/color/color.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
d3.color = d3_color;
|
||||
|
||||
function d3_color() {}
|
||||
|
||||
d3_color.prototype.toString = function() {
|
||||
return this.rgb() + "";
|
||||
};
|
||||
34
node_modules/d3/src/color/hcl.js
generated
vendored
34
node_modules/d3/src/color/hcl.js
generated
vendored
@@ -1,34 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "color";
|
||||
import "lab";
|
||||
import "rgb";
|
||||
|
||||
d3.hcl = d3_hcl;
|
||||
|
||||
function d3_hcl(h, c, l) {
|
||||
return this instanceof d3_hcl ? void (this.h = +h, this.c = +c, this.l = +l)
|
||||
: arguments.length < 2 ? (h instanceof d3_hcl ? new d3_hcl(h.h, h.c, h.l)
|
||||
: (h instanceof d3_lab ? d3_lab_hcl(h.l, h.a, h.b)
|
||||
: d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b)))
|
||||
: new d3_hcl(h, c, l);
|
||||
}
|
||||
|
||||
var d3_hclPrototype = d3_hcl.prototype = new d3_color;
|
||||
|
||||
d3_hclPrototype.brighter = function(k) {
|
||||
return new d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
|
||||
};
|
||||
|
||||
d3_hclPrototype.darker = function(k) {
|
||||
return new d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
|
||||
};
|
||||
|
||||
d3_hclPrototype.rgb = function() {
|
||||
return d3_hcl_lab(this.h, this.c, this.l).rgb();
|
||||
};
|
||||
|
||||
function d3_hcl_lab(h, c, l) {
|
||||
if (isNaN(h)) h = 0;
|
||||
if (isNaN(c)) c = 0;
|
||||
return new d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
|
||||
}
|
||||
56
node_modules/d3/src/color/hsl.js
generated
vendored
56
node_modules/d3/src/color/hsl.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
import "color";
|
||||
import "rgb";
|
||||
|
||||
d3.hsl = d3_hsl;
|
||||
|
||||
function d3_hsl(h, s, l) {
|
||||
return this instanceof d3_hsl ? void (this.h = +h, this.s = +s, this.l = +l)
|
||||
: arguments.length < 2 ? (h instanceof d3_hsl ? new d3_hsl(h.h, h.s, h.l)
|
||||
: d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl))
|
||||
: new d3_hsl(h, s, l);
|
||||
}
|
||||
|
||||
var d3_hslPrototype = d3_hsl.prototype = new d3_color;
|
||||
|
||||
d3_hslPrototype.brighter = function(k) {
|
||||
k = Math.pow(0.7, arguments.length ? k : 1);
|
||||
return new d3_hsl(this.h, this.s, this.l / k);
|
||||
};
|
||||
|
||||
d3_hslPrototype.darker = function(k) {
|
||||
k = Math.pow(0.7, arguments.length ? k : 1);
|
||||
return new d3_hsl(this.h, this.s, k * this.l);
|
||||
};
|
||||
|
||||
d3_hslPrototype.rgb = function() {
|
||||
return d3_hsl_rgb(this.h, this.s, this.l);
|
||||
};
|
||||
|
||||
function d3_hsl_rgb(h, s, l) {
|
||||
var m1,
|
||||
m2;
|
||||
|
||||
/* Some simple corrections for h, s and l. */
|
||||
h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
|
||||
s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
|
||||
l = l < 0 ? 0 : l > 1 ? 1 : l;
|
||||
|
||||
/* From FvD 13.37, CSS Color Module Level 3 */
|
||||
m2 = l <= 0.5 ? l * (1 + s) : l + s - l * s;
|
||||
m1 = 2 * l - m2;
|
||||
|
||||
function v(h) {
|
||||
if (h > 360) h -= 360;
|
||||
else if (h < 0) h += 360;
|
||||
if (h < 60) return m1 + (m2 - m1) * h / 60;
|
||||
if (h < 180) return m2;
|
||||
if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
|
||||
return m1;
|
||||
}
|
||||
|
||||
function vv(h) {
|
||||
return Math.round(v(h) * 255);
|
||||
}
|
||||
|
||||
return new d3_rgb(vv(h + 120), vv(h), vv(h - 120));
|
||||
}
|
||||
6
node_modules/d3/src/color/index.js
generated
vendored
6
node_modules/d3/src/color/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import "color";
|
||||
import "rgb";
|
||||
import "hsl";
|
||||
import "hcl";
|
||||
import "lab";
|
||||
import "xyz";
|
||||
60
node_modules/d3/src/color/lab.js
generated
vendored
60
node_modules/d3/src/color/lab.js
generated
vendored
@@ -1,60 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "color";
|
||||
import "hcl";
|
||||
import "rgb";
|
||||
|
||||
d3.lab = d3_lab;
|
||||
|
||||
function d3_lab(l, a, b) {
|
||||
return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b)
|
||||
: arguments.length < 2 ? (l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b)
|
||||
: (l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l)
|
||||
: d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b)))
|
||||
: new d3_lab(l, a, b);
|
||||
}
|
||||
|
||||
// Corresponds roughly to RGB brighter/darker
|
||||
var d3_lab_K = 18;
|
||||
|
||||
// D65 standard referent
|
||||
var d3_lab_X = 0.950470,
|
||||
d3_lab_Y = 1,
|
||||
d3_lab_Z = 1.088830;
|
||||
|
||||
var d3_labPrototype = d3_lab.prototype = new d3_color;
|
||||
|
||||
d3_labPrototype.brighter = function(k) {
|
||||
return new d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
|
||||
};
|
||||
|
||||
d3_labPrototype.darker = function(k) {
|
||||
return new d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
|
||||
};
|
||||
|
||||
d3_labPrototype.rgb = function() {
|
||||
return d3_lab_rgb(this.l, this.a, this.b);
|
||||
};
|
||||
|
||||
function d3_lab_rgb(l, a, b) {
|
||||
var y = (l + 16) / 116,
|
||||
x = y + a / 500,
|
||||
z = y - b / 200;
|
||||
x = d3_lab_xyz(x) * d3_lab_X;
|
||||
y = d3_lab_xyz(y) * d3_lab_Y;
|
||||
z = d3_lab_xyz(z) * d3_lab_Z;
|
||||
return new d3_rgb(
|
||||
d3_xyz_rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z),
|
||||
d3_xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z),
|
||||
d3_xyz_rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z)
|
||||
);
|
||||
}
|
||||
|
||||
function d3_lab_hcl(l, a, b) {
|
||||
return l > 0
|
||||
? new d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l)
|
||||
: new d3_hcl(NaN, NaN, l);
|
||||
}
|
||||
|
||||
function d3_lab_xyz(x) {
|
||||
return x > 0.206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
|
||||
}
|
||||
301
node_modules/d3/src/color/rgb.js
generated
vendored
301
node_modules/d3/src/color/rgb.js
generated
vendored
@@ -1,301 +0,0 @@
|
||||
import "../arrays/map";
|
||||
import "color";
|
||||
import "hsl";
|
||||
import "lab";
|
||||
import "xyz";
|
||||
|
||||
d3.rgb = d3_rgb;
|
||||
|
||||
function d3_rgb(r, g, b) {
|
||||
return this instanceof d3_rgb ? void (this.r = ~~r, this.g = ~~g, this.b = ~~b)
|
||||
: arguments.length < 2 ? (r instanceof d3_rgb ? new d3_rgb(r.r, r.g, r.b)
|
||||
: d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb))
|
||||
: new d3_rgb(r, g, b);
|
||||
}
|
||||
|
||||
function d3_rgbNumber(value) {
|
||||
return new d3_rgb(value >> 16, value >> 8 & 0xff, value & 0xff);
|
||||
}
|
||||
|
||||
function d3_rgbString(value) {
|
||||
return d3_rgbNumber(value) + "";
|
||||
}
|
||||
|
||||
var d3_rgbPrototype = d3_rgb.prototype = new d3_color;
|
||||
|
||||
d3_rgbPrototype.brighter = function(k) {
|
||||
k = Math.pow(0.7, arguments.length ? k : 1);
|
||||
var r = this.r,
|
||||
g = this.g,
|
||||
b = this.b,
|
||||
i = 30;
|
||||
if (!r && !g && !b) return new d3_rgb(i, i, i);
|
||||
if (r && r < i) r = i;
|
||||
if (g && g < i) g = i;
|
||||
if (b && b < i) b = i;
|
||||
return new d3_rgb(Math.min(255, r / k), Math.min(255, g / k), Math.min(255, b / k));
|
||||
};
|
||||
|
||||
d3_rgbPrototype.darker = function(k) {
|
||||
k = Math.pow(0.7, arguments.length ? k : 1);
|
||||
return new d3_rgb(k * this.r, k * this.g, k * this.b);
|
||||
};
|
||||
|
||||
d3_rgbPrototype.hsl = function() {
|
||||
return d3_rgb_hsl(this.r, this.g, this.b);
|
||||
};
|
||||
|
||||
d3_rgbPrototype.toString = function() {
|
||||
return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
|
||||
};
|
||||
|
||||
function d3_rgb_hex(v) {
|
||||
return v < 0x10
|
||||
? "0" + Math.max(0, v).toString(16)
|
||||
: Math.min(255, v).toString(16);
|
||||
}
|
||||
|
||||
function d3_rgb_parse(format, rgb, hsl) {
|
||||
var r = 0, // red channel; int in [0, 255]
|
||||
g = 0, // green channel; int in [0, 255]
|
||||
b = 0, // blue channel; int in [0, 255]
|
||||
m1, // CSS color specification match
|
||||
m2, // CSS color specification type (e.g., rgb)
|
||||
color;
|
||||
|
||||
/* Handle hsl, rgb. */
|
||||
m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase());
|
||||
if (m1) {
|
||||
m2 = m1[2].split(",");
|
||||
switch (m1[1]) {
|
||||
case "hsl": {
|
||||
return hsl(
|
||||
parseFloat(m2[0]), // degrees
|
||||
parseFloat(m2[1]) / 100, // percentage
|
||||
parseFloat(m2[2]) / 100 // percentage
|
||||
);
|
||||
}
|
||||
case "rgb": {
|
||||
return rgb(
|
||||
d3_rgb_parseNumber(m2[0]),
|
||||
d3_rgb_parseNumber(m2[1]),
|
||||
d3_rgb_parseNumber(m2[2])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Named colors. */
|
||||
if (color = d3_rgb_names.get(format)) {
|
||||
return rgb(color.r, color.g, color.b);
|
||||
}
|
||||
|
||||
/* Hexadecimal colors: #rgb and #rrggbb. */
|
||||
if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) {
|
||||
if (format.length === 4) {
|
||||
r = (color & 0xf00) >> 4; r = (r >> 4) | r;
|
||||
g = (color & 0xf0); g = (g >> 4) | g;
|
||||
b = (color & 0xf); b = (b << 4) | b;
|
||||
} else if (format.length === 7) {
|
||||
r = (color & 0xff0000) >> 16;
|
||||
g = (color & 0xff00) >> 8;
|
||||
b = (color & 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
return rgb(r, g, b);
|
||||
}
|
||||
|
||||
function d3_rgb_hsl(r, g, b) {
|
||||
var min = Math.min(r /= 255, g /= 255, b /= 255),
|
||||
max = Math.max(r, g, b),
|
||||
d = max - min,
|
||||
h,
|
||||
s,
|
||||
l = (max + min) / 2;
|
||||
if (d) {
|
||||
s = l < 0.5 ? d / (max + min) : d / (2 - max - min);
|
||||
if (r == max) h = (g - b) / d + (g < b ? 6 : 0);
|
||||
else if (g == max) h = (b - r) / d + 2;
|
||||
else h = (r - g) / d + 4;
|
||||
h *= 60;
|
||||
} else {
|
||||
h = NaN;
|
||||
s = l > 0 && l < 1 ? 0 : h;
|
||||
}
|
||||
return new d3_hsl(h, s, l);
|
||||
}
|
||||
|
||||
function d3_rgb_lab(r, g, b) {
|
||||
r = d3_rgb_xyz(r);
|
||||
g = d3_rgb_xyz(g);
|
||||
b = d3_rgb_xyz(b);
|
||||
var x = d3_xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / d3_lab_X),
|
||||
y = d3_xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / d3_lab_Y),
|
||||
z = d3_xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / d3_lab_Z);
|
||||
return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
|
||||
}
|
||||
|
||||
function d3_rgb_xyz(r) {
|
||||
return (r /= 255) <= 0.04045 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
function d3_rgb_parseNumber(c) { // either integer or percentage
|
||||
var f = parseFloat(c);
|
||||
return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
|
||||
}
|
||||
|
||||
var d3_rgb_names = d3.map({
|
||||
aliceblue: 0xf0f8ff,
|
||||
antiquewhite: 0xfaebd7,
|
||||
aqua: 0x00ffff,
|
||||
aquamarine: 0x7fffd4,
|
||||
azure: 0xf0ffff,
|
||||
beige: 0xf5f5dc,
|
||||
bisque: 0xffe4c4,
|
||||
black: 0x000000,
|
||||
blanchedalmond: 0xffebcd,
|
||||
blue: 0x0000ff,
|
||||
blueviolet: 0x8a2be2,
|
||||
brown: 0xa52a2a,
|
||||
burlywood: 0xdeb887,
|
||||
cadetblue: 0x5f9ea0,
|
||||
chartreuse: 0x7fff00,
|
||||
chocolate: 0xd2691e,
|
||||
coral: 0xff7f50,
|
||||
cornflowerblue: 0x6495ed,
|
||||
cornsilk: 0xfff8dc,
|
||||
crimson: 0xdc143c,
|
||||
cyan: 0x00ffff,
|
||||
darkblue: 0x00008b,
|
||||
darkcyan: 0x008b8b,
|
||||
darkgoldenrod: 0xb8860b,
|
||||
darkgray: 0xa9a9a9,
|
||||
darkgreen: 0x006400,
|
||||
darkgrey: 0xa9a9a9,
|
||||
darkkhaki: 0xbdb76b,
|
||||
darkmagenta: 0x8b008b,
|
||||
darkolivegreen: 0x556b2f,
|
||||
darkorange: 0xff8c00,
|
||||
darkorchid: 0x9932cc,
|
||||
darkred: 0x8b0000,
|
||||
darksalmon: 0xe9967a,
|
||||
darkseagreen: 0x8fbc8f,
|
||||
darkslateblue: 0x483d8b,
|
||||
darkslategray: 0x2f4f4f,
|
||||
darkslategrey: 0x2f4f4f,
|
||||
darkturquoise: 0x00ced1,
|
||||
darkviolet: 0x9400d3,
|
||||
deeppink: 0xff1493,
|
||||
deepskyblue: 0x00bfff,
|
||||
dimgray: 0x696969,
|
||||
dimgrey: 0x696969,
|
||||
dodgerblue: 0x1e90ff,
|
||||
firebrick: 0xb22222,
|
||||
floralwhite: 0xfffaf0,
|
||||
forestgreen: 0x228b22,
|
||||
fuchsia: 0xff00ff,
|
||||
gainsboro: 0xdcdcdc,
|
||||
ghostwhite: 0xf8f8ff,
|
||||
gold: 0xffd700,
|
||||
goldenrod: 0xdaa520,
|
||||
gray: 0x808080,
|
||||
green: 0x008000,
|
||||
greenyellow: 0xadff2f,
|
||||
grey: 0x808080,
|
||||
honeydew: 0xf0fff0,
|
||||
hotpink: 0xff69b4,
|
||||
indianred: 0xcd5c5c,
|
||||
indigo: 0x4b0082,
|
||||
ivory: 0xfffff0,
|
||||
khaki: 0xf0e68c,
|
||||
lavender: 0xe6e6fa,
|
||||
lavenderblush: 0xfff0f5,
|
||||
lawngreen: 0x7cfc00,
|
||||
lemonchiffon: 0xfffacd,
|
||||
lightblue: 0xadd8e6,
|
||||
lightcoral: 0xf08080,
|
||||
lightcyan: 0xe0ffff,
|
||||
lightgoldenrodyellow: 0xfafad2,
|
||||
lightgray: 0xd3d3d3,
|
||||
lightgreen: 0x90ee90,
|
||||
lightgrey: 0xd3d3d3,
|
||||
lightpink: 0xffb6c1,
|
||||
lightsalmon: 0xffa07a,
|
||||
lightseagreen: 0x20b2aa,
|
||||
lightskyblue: 0x87cefa,
|
||||
lightslategray: 0x778899,
|
||||
lightslategrey: 0x778899,
|
||||
lightsteelblue: 0xb0c4de,
|
||||
lightyellow: 0xffffe0,
|
||||
lime: 0x00ff00,
|
||||
limegreen: 0x32cd32,
|
||||
linen: 0xfaf0e6,
|
||||
magenta: 0xff00ff,
|
||||
maroon: 0x800000,
|
||||
mediumaquamarine: 0x66cdaa,
|
||||
mediumblue: 0x0000cd,
|
||||
mediumorchid: 0xba55d3,
|
||||
mediumpurple: 0x9370db,
|
||||
mediumseagreen: 0x3cb371,
|
||||
mediumslateblue: 0x7b68ee,
|
||||
mediumspringgreen: 0x00fa9a,
|
||||
mediumturquoise: 0x48d1cc,
|
||||
mediumvioletred: 0xc71585,
|
||||
midnightblue: 0x191970,
|
||||
mintcream: 0xf5fffa,
|
||||
mistyrose: 0xffe4e1,
|
||||
moccasin: 0xffe4b5,
|
||||
navajowhite: 0xffdead,
|
||||
navy: 0x000080,
|
||||
oldlace: 0xfdf5e6,
|
||||
olive: 0x808000,
|
||||
olivedrab: 0x6b8e23,
|
||||
orange: 0xffa500,
|
||||
orangered: 0xff4500,
|
||||
orchid: 0xda70d6,
|
||||
palegoldenrod: 0xeee8aa,
|
||||
palegreen: 0x98fb98,
|
||||
paleturquoise: 0xafeeee,
|
||||
palevioletred: 0xdb7093,
|
||||
papayawhip: 0xffefd5,
|
||||
peachpuff: 0xffdab9,
|
||||
peru: 0xcd853f,
|
||||
pink: 0xffc0cb,
|
||||
plum: 0xdda0dd,
|
||||
powderblue: 0xb0e0e6,
|
||||
purple: 0x800080,
|
||||
rebeccapurple: 0x663399,
|
||||
red: 0xff0000,
|
||||
rosybrown: 0xbc8f8f,
|
||||
royalblue: 0x4169e1,
|
||||
saddlebrown: 0x8b4513,
|
||||
salmon: 0xfa8072,
|
||||
sandybrown: 0xf4a460,
|
||||
seagreen: 0x2e8b57,
|
||||
seashell: 0xfff5ee,
|
||||
sienna: 0xa0522d,
|
||||
silver: 0xc0c0c0,
|
||||
skyblue: 0x87ceeb,
|
||||
slateblue: 0x6a5acd,
|
||||
slategray: 0x708090,
|
||||
slategrey: 0x708090,
|
||||
snow: 0xfffafa,
|
||||
springgreen: 0x00ff7f,
|
||||
steelblue: 0x4682b4,
|
||||
tan: 0xd2b48c,
|
||||
teal: 0x008080,
|
||||
thistle: 0xd8bfd8,
|
||||
tomato: 0xff6347,
|
||||
turquoise: 0x40e0d0,
|
||||
violet: 0xee82ee,
|
||||
wheat: 0xf5deb3,
|
||||
white: 0xffffff,
|
||||
whitesmoke: 0xf5f5f5,
|
||||
yellow: 0xffff00,
|
||||
yellowgreen: 0x9acd32
|
||||
});
|
||||
|
||||
d3_rgb_names.forEach(function(key, value) {
|
||||
d3_rgb_names.set(key, d3_rgbNumber(value));
|
||||
});
|
||||
7
node_modules/d3/src/color/xyz.js
generated
vendored
7
node_modules/d3/src/color/xyz.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
function d3_xyz_lab(x) {
|
||||
return x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
|
||||
}
|
||||
|
||||
function d3_xyz_rgb(r) {
|
||||
return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
|
||||
}
|
||||
15
node_modules/d3/src/compat/array.js
generated
vendored
15
node_modules/d3/src/compat/array.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import "../core/array";
|
||||
import "../core/document";
|
||||
|
||||
// Redefine d3_array if the browser doesn’t support slice-based conversion.
|
||||
if (d3_document) {
|
||||
try {
|
||||
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
|
||||
} catch (e) {
|
||||
d3_array = function(list) {
|
||||
var i = list.length, array = new Array(i);
|
||||
while (i--) array[i] = list[i];
|
||||
return array;
|
||||
};
|
||||
}
|
||||
}
|
||||
3
node_modules/d3/src/compat/date.js
generated
vendored
3
node_modules/d3/src/compat/date.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
if (!Date.now) Date.now = function() {
|
||||
return +new Date;
|
||||
};
|
||||
3
node_modules/d3/src/compat/index.js
generated
vendored
3
node_modules/d3/src/compat/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "array";
|
||||
import "date";
|
||||
import "style";
|
||||
23
node_modules/d3/src/compat/style.js
generated
vendored
23
node_modules/d3/src/compat/style.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
import "../core/document";
|
||||
|
||||
// Redefine style.setProperty et al. if the browser doesn’t coerce arguments.
|
||||
if (d3_document) {
|
||||
try {
|
||||
d3_document.createElement("DIV").style.setProperty("opacity", 0, "");
|
||||
} catch (error) {
|
||||
var d3_element_prototype = this.Element.prototype,
|
||||
d3_element_setAttribute = d3_element_prototype.setAttribute,
|
||||
d3_element_setAttributeNS = d3_element_prototype.setAttributeNS,
|
||||
d3_style_prototype = this.CSSStyleDeclaration.prototype,
|
||||
d3_style_setProperty = d3_style_prototype.setProperty;
|
||||
d3_element_prototype.setAttribute = function(name, value) {
|
||||
d3_element_setAttribute.call(this, name, value + "");
|
||||
};
|
||||
d3_element_prototype.setAttributeNS = function(space, local, value) {
|
||||
d3_element_setAttributeNS.call(this, space, local, value + "");
|
||||
};
|
||||
d3_style_prototype.setProperty = function(name, value, priority) {
|
||||
d3_style_setProperty.call(this, name, value + "", priority);
|
||||
};
|
||||
}
|
||||
}
|
||||
2
node_modules/d3/src/core/array.js
generated
vendored
2
node_modules/d3/src/core/array.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
var d3_arraySlice = [].slice,
|
||||
d3_array = function(list) { return d3_arraySlice.call(list); }; // conversion for NodeLists
|
||||
8
node_modules/d3/src/core/class.js
generated
vendored
8
node_modules/d3/src/core/class.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
function d3_class(ctor, properties) {
|
||||
for (var key in properties) {
|
||||
Object.defineProperty(ctor.prototype, key, {
|
||||
value: properties[key],
|
||||
enumerable: false
|
||||
});
|
||||
}
|
||||
}
|
||||
15
node_modules/d3/src/core/document.js
generated
vendored
15
node_modules/d3/src/core/document.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
var d3_document = this.document;
|
||||
|
||||
function d3_documentElement(node) {
|
||||
return node
|
||||
&& (node.ownerDocument // node is a Node
|
||||
|| node.document // node is a Window
|
||||
|| node).documentElement; // node is a Document
|
||||
}
|
||||
|
||||
function d3_window(node) {
|
||||
return node
|
||||
&& ((node.ownerDocument && node.ownerDocument.defaultView) // node is a Node
|
||||
|| (node.document && node) // node is a Window
|
||||
|| node.defaultView); // node is a Document
|
||||
}
|
||||
5
node_modules/d3/src/core/functor.js
generated
vendored
5
node_modules/d3/src/core/functor.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
function d3_functor(v) {
|
||||
return typeof v === "function" ? v : function() { return v; };
|
||||
}
|
||||
|
||||
d3.functor = d3_functor;
|
||||
3
node_modules/d3/src/core/identity.js
generated
vendored
3
node_modules/d3/src/core/identity.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_identity(d) {
|
||||
return d;
|
||||
}
|
||||
3
node_modules/d3/src/core/index.js
generated
vendored
3
node_modules/d3/src/core/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "functor";
|
||||
import "ns";
|
||||
import "rebind";
|
||||
1
node_modules/d3/src/core/noop.js
generated
vendored
1
node_modules/d3/src/core/noop.js
generated
vendored
@@ -1 +0,0 @@
|
||||
function d3_noop() {}
|
||||
18
node_modules/d3/src/core/ns.js
generated
vendored
18
node_modules/d3/src/core/ns.js
generated
vendored
@@ -1,18 +0,0 @@
|
||||
var d3_nsXhtml = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
var d3_nsPrefix = {
|
||||
svg: "http://www.w3.org/2000/svg",
|
||||
xhtml: d3_nsXhtml,
|
||||
xlink: "http://www.w3.org/1999/xlink",
|
||||
xml: "http://www.w3.org/XML/1998/namespace",
|
||||
xmlns: "http://www.w3.org/2000/xmlns/"
|
||||
};
|
||||
|
||||
d3.ns = {
|
||||
prefix: d3_nsPrefix,
|
||||
qualify: function(name) {
|
||||
var i = name.indexOf(":"), prefix = name;
|
||||
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
||||
return d3_nsPrefix.hasOwnProperty(prefix) ? {space: d3_nsPrefix[prefix], local: name} : name;
|
||||
}
|
||||
};
|
||||
16
node_modules/d3/src/core/rebind.js
generated
vendored
16
node_modules/d3/src/core/rebind.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
// Copies a variable number of methods from source to target.
|
||||
d3.rebind = function(target, source) {
|
||||
var i = 1, n = arguments.length, method;
|
||||
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
|
||||
return target;
|
||||
};
|
||||
|
||||
// Method is assumed to be a standard D3 getter-setter:
|
||||
// If passed with no arguments, gets the value.
|
||||
// If passed with arguments, sets the value and returns the target.
|
||||
function d3_rebind(target, source, method) {
|
||||
return function() {
|
||||
var value = method.apply(source, arguments);
|
||||
return value === source ? target : value;
|
||||
};
|
||||
}
|
||||
3
node_modules/d3/src/core/source.js
generated
vendored
3
node_modules/d3/src/core/source.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_source(d) {
|
||||
return d.source;
|
||||
}
|
||||
11
node_modules/d3/src/core/subclass.js
generated
vendored
11
node_modules/d3/src/core/subclass.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
var d3_subclass = {}.__proto__?
|
||||
|
||||
// Until ECMAScript supports array subclassing, prototype injection works well.
|
||||
function(object, prototype) {
|
||||
object.__proto__ = prototype;
|
||||
}:
|
||||
|
||||
// And if your browser doesn't support __proto__, we'll use direct extension.
|
||||
function(object, prototype) {
|
||||
for (var property in prototype) object[property] = prototype[property];
|
||||
};
|
||||
3
node_modules/d3/src/core/target.js
generated
vendored
3
node_modules/d3/src/core/target.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_target(d) {
|
||||
return d.target;
|
||||
}
|
||||
3
node_modules/d3/src/core/true.js
generated
vendored
3
node_modules/d3/src/core/true.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_true() {
|
||||
return true;
|
||||
}
|
||||
10
node_modules/d3/src/core/vendor.js
generated
vendored
10
node_modules/d3/src/core/vendor.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
function d3_vendorSymbol(object, name) {
|
||||
if (name in object) return name;
|
||||
name = name.charAt(0).toUpperCase() + name.slice(1);
|
||||
for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
|
||||
var prefixName = d3_vendorPrefixes[i] + name;
|
||||
if (prefixName in object) return prefixName;
|
||||
}
|
||||
}
|
||||
|
||||
var d3_vendorPrefixes = ["webkit", "ms", "moz", "Moz", "o", "O"];
|
||||
3
node_modules/d3/src/core/zero.js
generated
vendored
3
node_modules/d3/src/core/zero.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_zero() {
|
||||
return 0;
|
||||
}
|
||||
23
node_modules/d3/src/d3.js
generated
vendored
23
node_modules/d3/src/d3.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
import "start";
|
||||
import "compat/";
|
||||
|
||||
import "arrays/";
|
||||
import "behavior/";
|
||||
import "color/";
|
||||
import "core/";
|
||||
import "dsv/";
|
||||
import "event/";
|
||||
import "format/";
|
||||
import "geo/";
|
||||
import "geom/";
|
||||
import "interpolate/";
|
||||
import "layout/";
|
||||
import "math/";
|
||||
import "scale/";
|
||||
import "selection/";
|
||||
import "svg/";
|
||||
import "time/";
|
||||
import "transition/";
|
||||
import "xhr/";
|
||||
|
||||
import "end";
|
||||
3
node_modules/d3/src/dsv/csv.js
generated
vendored
3
node_modules/d3/src/dsv/csv.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "dsv";
|
||||
|
||||
d3.csv = d3.dsv(",", "text/csv");
|
||||
136
node_modules/d3/src/dsv/dsv.js
generated
vendored
136
node_modules/d3/src/dsv/dsv.js
generated
vendored
@@ -1,136 +0,0 @@
|
||||
import "../arrays/set";
|
||||
import "../xhr/xhr";
|
||||
|
||||
d3.dsv = function(delimiter, mimeType) {
|
||||
var reFormat = new RegExp("[\"" + delimiter + "\n]"),
|
||||
delimiterCode = delimiter.charCodeAt(0);
|
||||
|
||||
function dsv(url, row, callback) {
|
||||
if (arguments.length < 3) callback = row, row = null;
|
||||
var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
|
||||
|
||||
xhr.row = function(_) {
|
||||
return arguments.length
|
||||
? xhr.response((row = _) == null ? response : typedResponse(_))
|
||||
: row;
|
||||
};
|
||||
|
||||
return xhr;
|
||||
}
|
||||
|
||||
function response(request) {
|
||||
return dsv.parse(request.responseText);
|
||||
}
|
||||
|
||||
function typedResponse(f) {
|
||||
return function(request) {
|
||||
return dsv.parse(request.responseText, f);
|
||||
};
|
||||
}
|
||||
|
||||
dsv.parse = function(text, f) {
|
||||
var o;
|
||||
return dsv.parseRows(text, function(row, i) {
|
||||
if (o) return o(row, i - 1);
|
||||
var a = new Function("d", "return {" + row.map(function(name, i) {
|
||||
return JSON.stringify(name) + ": d[" + i + "]";
|
||||
}).join(",") + "}");
|
||||
o = f ? function(row, i) { return f(a(row), i); } : a;
|
||||
});
|
||||
};
|
||||
|
||||
dsv.parseRows = function(text, f) {
|
||||
var EOL = {}, // sentinel value for end-of-line
|
||||
EOF = {}, // sentinel value for end-of-file
|
||||
rows = [], // output rows
|
||||
N = text.length,
|
||||
I = 0, // current character index
|
||||
n = 0, // the current line number
|
||||
t, // the current token
|
||||
eol; // is the current token followed by EOL?
|
||||
|
||||
function token() {
|
||||
if (I >= N) return EOF; // special case: end of file
|
||||
if (eol) return eol = false, EOL; // special case: end of line
|
||||
|
||||
// special case: quotes
|
||||
var j = I;
|
||||
if (text.charCodeAt(j) === 34) {
|
||||
var i = j;
|
||||
while (i++ < N) {
|
||||
if (text.charCodeAt(i) === 34) {
|
||||
if (text.charCodeAt(i + 1) !== 34) break;
|
||||
++i;
|
||||
}
|
||||
}
|
||||
I = i + 2;
|
||||
var c = text.charCodeAt(i + 1);
|
||||
if (c === 13) {
|
||||
eol = true;
|
||||
if (text.charCodeAt(i + 2) === 10) ++I;
|
||||
} else if (c === 10) {
|
||||
eol = true;
|
||||
}
|
||||
return text.slice(j + 1, i).replace(/""/g, "\"");
|
||||
}
|
||||
|
||||
// common case: find next delimiter or newline
|
||||
while (I < N) {
|
||||
var c = text.charCodeAt(I++), k = 1;
|
||||
if (c === 10) eol = true; // \n
|
||||
else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
|
||||
else if (c !== delimiterCode) continue;
|
||||
return text.slice(j, I - k);
|
||||
}
|
||||
|
||||
// special case: last token before EOF
|
||||
return text.slice(j);
|
||||
}
|
||||
|
||||
while ((t = token()) !== EOF) {
|
||||
var a = [];
|
||||
while (t !== EOL && t !== EOF) {
|
||||
a.push(t);
|
||||
t = token();
|
||||
}
|
||||
if (f && (a = f(a, n++)) == null) continue;
|
||||
rows.push(a);
|
||||
}
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
dsv.format = function(rows) {
|
||||
if (Array.isArray(rows[0])) return dsv.formatRows(rows); // deprecated; use formatRows
|
||||
var fieldSet = new d3_Set, fields = [];
|
||||
|
||||
// Compute unique fields in order of discovery.
|
||||
rows.forEach(function(row) {
|
||||
for (var field in row) {
|
||||
if (!fieldSet.has(field)) {
|
||||
fields.push(fieldSet.add(field));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return [fields.map(formatValue).join(delimiter)].concat(rows.map(function(row) {
|
||||
return fields.map(function(field) {
|
||||
return formatValue(row[field]);
|
||||
}).join(delimiter);
|
||||
})).join("\n");
|
||||
};
|
||||
|
||||
dsv.formatRows = function(rows) {
|
||||
return rows.map(formatRow).join("\n");
|
||||
};
|
||||
|
||||
function formatRow(row) {
|
||||
return row.map(formatValue).join(delimiter);
|
||||
}
|
||||
|
||||
function formatValue(text) {
|
||||
return reFormat.test(text) ? "\"" + text.replace(/\"/g, "\"\"") + "\"" : text;
|
||||
}
|
||||
|
||||
return dsv;
|
||||
};
|
||||
3
node_modules/d3/src/dsv/index.js
generated
vendored
3
node_modules/d3/src/dsv/index.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "dsv";
|
||||
import "csv";
|
||||
import "tsv";
|
||||
3
node_modules/d3/src/dsv/tsv.js
generated
vendored
3
node_modules/d3/src/dsv/tsv.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "dsv";
|
||||
|
||||
d3.tsv = d3.dsv("\t", "text/tab-separated-values");
|
||||
4
node_modules/d3/src/end.js
generated
vendored
4
node_modules/d3/src/end.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
if (typeof define === "function" && define.amd) this.d3 = d3, define(d3);
|
||||
else if (typeof module === "object" && module.exports) module.exports = d3;
|
||||
else this.d3 = d3;
|
||||
}();
|
||||
69
node_modules/d3/src/event/dispatch.js
generated
vendored
69
node_modules/d3/src/event/dispatch.js
generated
vendored
@@ -1,69 +0,0 @@
|
||||
import "../arrays/map";
|
||||
|
||||
d3.dispatch = function() {
|
||||
var dispatch = new d3_dispatch,
|
||||
i = -1,
|
||||
n = arguments.length;
|
||||
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
|
||||
return dispatch;
|
||||
};
|
||||
|
||||
function d3_dispatch() {}
|
||||
|
||||
d3_dispatch.prototype.on = function(type, listener) {
|
||||
var i = type.indexOf("."),
|
||||
name = "";
|
||||
|
||||
// Extract optional namespace, e.g., "click.foo"
|
||||
if (i >= 0) {
|
||||
name = type.slice(i + 1);
|
||||
type = type.slice(0, i);
|
||||
}
|
||||
|
||||
if (type) return arguments.length < 2
|
||||
? this[type].on(name)
|
||||
: this[type].on(name, listener);
|
||||
|
||||
if (arguments.length === 2) {
|
||||
if (listener == null) for (type in this) {
|
||||
if (this.hasOwnProperty(type)) this[type].on(name, null);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
function d3_dispatch_event(dispatch) {
|
||||
var listeners = [],
|
||||
listenerByName = new d3_Map;
|
||||
|
||||
function event() {
|
||||
var z = listeners, // defensive reference
|
||||
i = -1,
|
||||
n = z.length,
|
||||
l;
|
||||
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
|
||||
return dispatch;
|
||||
}
|
||||
|
||||
event.on = function(name, listener) {
|
||||
var l = listenerByName.get(name),
|
||||
i;
|
||||
|
||||
// return the current listener, if any
|
||||
if (arguments.length < 2) return l && l.on;
|
||||
|
||||
// remove the old listener, if any (with copy-on-write)
|
||||
if (l) {
|
||||
l.on = null;
|
||||
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
|
||||
listenerByName.remove(name);
|
||||
}
|
||||
|
||||
// add the new listener, if any
|
||||
if (listener) listeners.push(listenerByName.set(name, {on: listener}));
|
||||
|
||||
return dispatch;
|
||||
};
|
||||
|
||||
return event;
|
||||
}
|
||||
36
node_modules/d3/src/event/drag.js
generated
vendored
36
node_modules/d3/src/event/drag.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
import "../core/document";
|
||||
import "../core/vendor";
|
||||
import "../selection/on";
|
||||
|
||||
var d3_event_dragSelect,
|
||||
d3_event_dragId = 0;
|
||||
|
||||
function d3_event_dragSuppress(node) {
|
||||
var name = ".dragsuppress-" + ++d3_event_dragId,
|
||||
click = "click" + name,
|
||||
w = d3.select(d3_window(node))
|
||||
.on("touchmove" + name, d3_eventPreventDefault)
|
||||
.on("dragstart" + name, d3_eventPreventDefault)
|
||||
.on("selectstart" + name, d3_eventPreventDefault);
|
||||
|
||||
if (d3_event_dragSelect == null) {
|
||||
d3_event_dragSelect = "onselectstart" in node ? false
|
||||
: d3_vendorSymbol(node.style, "userSelect");
|
||||
}
|
||||
|
||||
if (d3_event_dragSelect) {
|
||||
var style = d3_documentElement(node).style,
|
||||
select = style[d3_event_dragSelect];
|
||||
style[d3_event_dragSelect] = "none";
|
||||
}
|
||||
|
||||
return function(suppressClick) {
|
||||
w.on(name, null);
|
||||
if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
|
||||
if (suppressClick) { // suppress the next click, but only if it’s immediate
|
||||
var off = function() { w.on(click, null); };
|
||||
w.on(click, function() { d3_eventPreventDefault(); off(); }, true);
|
||||
setTimeout(off, 0);
|
||||
}
|
||||
};
|
||||
}
|
||||
50
node_modules/d3/src/event/event.js
generated
vendored
50
node_modules/d3/src/event/event.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
import "dispatch";
|
||||
|
||||
d3.event = null;
|
||||
|
||||
function d3_eventPreventDefault() {
|
||||
d3.event.preventDefault();
|
||||
}
|
||||
|
||||
function d3_eventSource() {
|
||||
var e = d3.event, s;
|
||||
while (s = e.sourceEvent) e = s;
|
||||
return e;
|
||||
}
|
||||
|
||||
// Like d3.dispatch, but for custom events abstracting native UI events. These
|
||||
// events have a target component (such as a brush), a target element (such as
|
||||
// the svg:g element containing the brush) and the standard arguments `d` (the
|
||||
// target element's data) and `i` (the selection index of the target element).
|
||||
function d3_eventDispatch(target) {
|
||||
var dispatch = new d3_dispatch,
|
||||
i = 0,
|
||||
n = arguments.length;
|
||||
|
||||
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
|
||||
|
||||
// Creates a dispatch context for the specified `thiz` (typically, the target
|
||||
// DOM element that received the source event) and `argumentz` (typically, the
|
||||
// data `d` and index `i` of the target element). The returned function can be
|
||||
// used to dispatch an event to any registered listeners; the function takes a
|
||||
// single argument as input, being the event to dispatch. The event must have
|
||||
// a "type" attribute which corresponds to a type registered in the
|
||||
// constructor. This context will automatically populate the "sourceEvent" and
|
||||
// "target" attributes of the event, as well as setting the `d3.event` global
|
||||
// for the duration of the notification.
|
||||
dispatch.of = function(thiz, argumentz) {
|
||||
return function(e1) {
|
||||
try {
|
||||
var e0 =
|
||||
e1.sourceEvent = d3.event;
|
||||
e1.target = target;
|
||||
d3.event = e1;
|
||||
dispatch[e1.type].apply(thiz, argumentz);
|
||||
} finally {
|
||||
d3.event = e0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
return dispatch;
|
||||
}
|
||||
6
node_modules/d3/src/event/index.js
generated
vendored
6
node_modules/d3/src/event/index.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
import "dispatch";
|
||||
import "event";
|
||||
import "mouse";
|
||||
import "touch";
|
||||
import "touches";
|
||||
import "timer";
|
||||
39
node_modules/d3/src/event/mouse.js
generated
vendored
39
node_modules/d3/src/event/mouse.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
import "../core/document";
|
||||
import "event";
|
||||
|
||||
d3.mouse = function(container) {
|
||||
return d3_mousePoint(container, d3_eventSource());
|
||||
};
|
||||
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=44083
|
||||
var d3_mouse_bug44083 = this.navigator && /WebKit/.test(this.navigator.userAgent) ? -1 : 0;
|
||||
|
||||
function d3_mousePoint(container, e) {
|
||||
if (e.changedTouches) e = e.changedTouches[0];
|
||||
var svg = container.ownerSVGElement || container;
|
||||
if (svg.createSVGPoint) {
|
||||
var point = svg.createSVGPoint();
|
||||
if (d3_mouse_bug44083 < 0) {
|
||||
var window = d3_window(container);
|
||||
if (window.scrollX || window.scrollY) {
|
||||
svg = d3.select("body").append("svg").style({
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
border: "none"
|
||||
}, "important");
|
||||
var ctm = svg[0][0].getScreenCTM();
|
||||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
}
|
||||
if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY;
|
||||
else point.x = e.clientX, point.y = e.clientY;
|
||||
point = point.matrixTransform(container.getScreenCTM().inverse());
|
||||
return [point.x, point.y];
|
||||
}
|
||||
var rect = container.getBoundingClientRect();
|
||||
return [e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop];
|
||||
};
|
||||
82
node_modules/d3/src/event/timer.js
generated
vendored
82
node_modules/d3/src/event/timer.js
generated
vendored
@@ -1,82 +0,0 @@
|
||||
import "../core/document";
|
||||
import "../core/vendor";
|
||||
|
||||
var d3_timer_queueHead,
|
||||
d3_timer_queueTail,
|
||||
d3_timer_interval, // is an interval (or frame) active?
|
||||
d3_timer_timeout, // is a timeout active?
|
||||
d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) { setTimeout(callback, 17); };
|
||||
|
||||
// The timer will continue to fire until callback returns true.
|
||||
d3.timer = function() {
|
||||
d3_timer.apply(this, arguments);
|
||||
};
|
||||
|
||||
function d3_timer(callback, delay, then) {
|
||||
var n = arguments.length;
|
||||
if (n < 2) delay = 0;
|
||||
if (n < 3) then = Date.now();
|
||||
|
||||
// Add the callback to the tail of the queue.
|
||||
var time = then + delay, timer = {c: callback, t: time, n: null};
|
||||
if (d3_timer_queueTail) d3_timer_queueTail.n = timer;
|
||||
else d3_timer_queueHead = timer;
|
||||
d3_timer_queueTail = timer;
|
||||
|
||||
// Start animatin'!
|
||||
if (!d3_timer_interval) {
|
||||
d3_timer_timeout = clearTimeout(d3_timer_timeout);
|
||||
d3_timer_interval = 1;
|
||||
d3_timer_frame(d3_timer_step);
|
||||
}
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
function d3_timer_step() {
|
||||
var now = d3_timer_mark(),
|
||||
delay = d3_timer_sweep() - now;
|
||||
if (delay > 24) {
|
||||
if (isFinite(delay)) {
|
||||
clearTimeout(d3_timer_timeout);
|
||||
d3_timer_timeout = setTimeout(d3_timer_step, delay);
|
||||
}
|
||||
d3_timer_interval = 0;
|
||||
} else {
|
||||
d3_timer_interval = 1;
|
||||
d3_timer_frame(d3_timer_step);
|
||||
}
|
||||
}
|
||||
|
||||
d3.timer.flush = function() {
|
||||
d3_timer_mark();
|
||||
d3_timer_sweep();
|
||||
};
|
||||
|
||||
function d3_timer_mark() {
|
||||
var now = Date.now(),
|
||||
timer = d3_timer_queueHead;
|
||||
while (timer) {
|
||||
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
|
||||
timer = timer.n;
|
||||
}
|
||||
return now;
|
||||
}
|
||||
|
||||
// Flush after callbacks to avoid concurrent queue modification.
|
||||
// Returns the time of the earliest active timer, post-sweep.
|
||||
function d3_timer_sweep() {
|
||||
var t0,
|
||||
t1 = d3_timer_queueHead,
|
||||
time = Infinity;
|
||||
while (t1) {
|
||||
if (t1.c) {
|
||||
if (t1.t < time) time = t1.t;
|
||||
t1 = (t0 = t1).n;
|
||||
} else {
|
||||
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
||||
}
|
||||
}
|
||||
d3_timer_queueTail = t0;
|
||||
return time;
|
||||
}
|
||||
11
node_modules/d3/src/event/touch.js
generated
vendored
11
node_modules/d3/src/event/touch.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
import "event";
|
||||
import "mouse";
|
||||
|
||||
d3.touch = function(container, touches, identifier) {
|
||||
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
|
||||
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
|
||||
if ((touch = touches[i]).identifier === identifier) {
|
||||
return d3_mousePoint(container, touch);
|
||||
}
|
||||
}
|
||||
};
|
||||
12
node_modules/d3/src/event/touches.js
generated
vendored
12
node_modules/d3/src/event/touches.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
import "../core/array";
|
||||
import "event";
|
||||
import "mouse";
|
||||
|
||||
d3.touches = function(container, touches) {
|
||||
if (arguments.length < 2) touches = d3_eventSource().touches;
|
||||
return touches ? d3_array(touches).map(function(touch) {
|
||||
var point = d3_mousePoint(container, touch);
|
||||
point.identifier = touch.identifier;
|
||||
return point;
|
||||
}) : [];
|
||||
};
|
||||
3
node_modules/d3/src/format/collapse.js
generated
vendored
3
node_modules/d3/src/format/collapse.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_collapse(s) {
|
||||
return s.trim().replace(/\s+/g, " ");
|
||||
}
|
||||
3
node_modules/d3/src/format/format.js
generated
vendored
3
node_modules/d3/src/format/format.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import "../locale/en-US";
|
||||
|
||||
d3.format = d3_locale_enUS.numberFormat;
|
||||
24
node_modules/d3/src/format/formatPrefix.js
generated
vendored
24
node_modules/d3/src/format/formatPrefix.js
generated
vendored
@@ -1,24 +0,0 @@
|
||||
import "precision";
|
||||
import "round";
|
||||
import "../math/abs";
|
||||
|
||||
var d3_formatPrefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(d3_formatPrefix);
|
||||
|
||||
d3.formatPrefix = function(value, precision) {
|
||||
var i = 0;
|
||||
if (value = +value) {
|
||||
if (value < 0) value *= -1;
|
||||
if (precision) value = d3.round(value, d3_format_precision(value, precision));
|
||||
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
|
||||
i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
|
||||
}
|
||||
return d3_formatPrefixes[8 + i / 3];
|
||||
};
|
||||
|
||||
function d3_formatPrefix(d, i) {
|
||||
var k = Math.pow(10, abs(8 - i) * 3);
|
||||
return {
|
||||
scale: i > 8 ? function(d) { return d / k; } : function(d) { return d * k; },
|
||||
symbol: d
|
||||
};
|
||||
}
|
||||
4
node_modules/d3/src/format/index.js
generated
vendored
4
node_modules/d3/src/format/index.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
import "format";
|
||||
import "formatPrefix";
|
||||
import "requote";
|
||||
import "round";
|
||||
3
node_modules/d3/src/format/precision.js
generated
vendored
3
node_modules/d3/src/format/precision.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
function d3_format_precision(x, p) {
|
||||
return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
|
||||
}
|
||||
5
node_modules/d3/src/format/requote.js
generated
vendored
5
node_modules/d3/src/format/requote.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.requote = function(s) {
|
||||
return s.replace(d3_requote_re, "\\$&");
|
||||
};
|
||||
|
||||
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
|
||||
5
node_modules/d3/src/format/round.js
generated
vendored
5
node_modules/d3/src/format/round.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
d3.round = function(x, n) {
|
||||
return n
|
||||
? Math.round(x * (n = Math.pow(10, n))) / n
|
||||
: Math.round(x);
|
||||
};
|
||||
129
node_modules/d3/src/geo/albers-usa.js
generated
vendored
129
node_modules/d3/src/geo/albers-usa.js
generated
vendored
@@ -1,129 +0,0 @@
|
||||
import "albers";
|
||||
import "conic-equal-area";
|
||||
import "geo";
|
||||
|
||||
// A composite projection for the United States, configured by default for
|
||||
// 960×500. Also works quite well at 960×600 with scale 1285. The set of
|
||||
// standard parallels for each region comes from USGS, which is published here:
|
||||
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
|
||||
d3.geo.albersUsa = function() {
|
||||
var lower48 = d3.geo.albers();
|
||||
|
||||
// EPSG:3338
|
||||
var alaska = d3.geo.conicEqualArea()
|
||||
.rotate([154, 0])
|
||||
.center([-2, 58.5])
|
||||
.parallels([55, 65]);
|
||||
|
||||
// ESRI:102007
|
||||
var hawaii = d3.geo.conicEqualArea()
|
||||
.rotate([157, 0])
|
||||
.center([-3, 19.9])
|
||||
.parallels([8, 18]);
|
||||
|
||||
var point,
|
||||
pointStream = {point: function(x, y) { point = [x, y]; }},
|
||||
lower48Point,
|
||||
alaskaPoint,
|
||||
hawaiiPoint;
|
||||
|
||||
function albersUsa(coordinates) {
|
||||
var x = coordinates[0], y = coordinates[1];
|
||||
point = null;
|
||||
(lower48Point(x, y), point)
|
||||
|| (alaskaPoint(x, y), point)
|
||||
|| hawaiiPoint(x, y);
|
||||
return point;
|
||||
}
|
||||
|
||||
albersUsa.invert = function(coordinates) {
|
||||
var k = lower48.scale(),
|
||||
t = lower48.translate(),
|
||||
x = (coordinates[0] - t[0]) / k,
|
||||
y = (coordinates[1] - t[1]) / k;
|
||||
return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska
|
||||
: y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii
|
||||
: lower48).invert(coordinates);
|
||||
};
|
||||
|
||||
// A naïve multi-projection stream.
|
||||
// The projections must have mutually exclusive clip regions on the sphere,
|
||||
// as this will avoid emitting interleaving lines and polygons.
|
||||
albersUsa.stream = function(stream) {
|
||||
var lower48Stream = lower48.stream(stream),
|
||||
alaskaStream = alaska.stream(stream),
|
||||
hawaiiStream = hawaii.stream(stream);
|
||||
return {
|
||||
point: function(x, y) {
|
||||
lower48Stream.point(x, y);
|
||||
alaskaStream.point(x, y);
|
||||
hawaiiStream.point(x, y);
|
||||
},
|
||||
sphere: function() {
|
||||
lower48Stream.sphere();
|
||||
alaskaStream.sphere();
|
||||
hawaiiStream.sphere();
|
||||
},
|
||||
lineStart: function() {
|
||||
lower48Stream.lineStart();
|
||||
alaskaStream.lineStart();
|
||||
hawaiiStream.lineStart();
|
||||
},
|
||||
lineEnd: function() {
|
||||
lower48Stream.lineEnd();
|
||||
alaskaStream.lineEnd();
|
||||
hawaiiStream.lineEnd();
|
||||
},
|
||||
polygonStart: function() {
|
||||
lower48Stream.polygonStart();
|
||||
alaskaStream.polygonStart();
|
||||
hawaiiStream.polygonStart();
|
||||
},
|
||||
polygonEnd: function() {
|
||||
lower48Stream.polygonEnd();
|
||||
alaskaStream.polygonEnd();
|
||||
hawaiiStream.polygonEnd();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
albersUsa.precision = function(_) {
|
||||
if (!arguments.length) return lower48.precision();
|
||||
lower48.precision(_);
|
||||
alaska.precision(_);
|
||||
hawaii.precision(_);
|
||||
return albersUsa;
|
||||
};
|
||||
|
||||
albersUsa.scale = function(_) {
|
||||
if (!arguments.length) return lower48.scale();
|
||||
lower48.scale(_);
|
||||
alaska.scale(_ * 0.35);
|
||||
hawaii.scale(_);
|
||||
return albersUsa.translate(lower48.translate());
|
||||
};
|
||||
|
||||
albersUsa.translate = function(_) {
|
||||
if (!arguments.length) return lower48.translate();
|
||||
var k = lower48.scale(), x = +_[0], y = +_[1];
|
||||
|
||||
lower48Point = lower48
|
||||
.translate(_)
|
||||
.clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]])
|
||||
.stream(pointStream).point;
|
||||
|
||||
alaskaPoint = alaska
|
||||
.translate([x - 0.307 * k, y + 0.201 * k])
|
||||
.clipExtent([[x - 0.425 * k + ε, y + 0.120 * k + ε], [x - 0.214 * k - ε, y + 0.234 * k - ε]])
|
||||
.stream(pointStream).point;
|
||||
|
||||
hawaiiPoint = hawaii
|
||||
.translate([x - 0.205 * k, y + 0.212 * k])
|
||||
.clipExtent([[x - 0.214 * k + ε, y + 0.166 * k + ε], [x - 0.115 * k - ε, y + 0.234 * k - ε]])
|
||||
.stream(pointStream).point;
|
||||
|
||||
return albersUsa;
|
||||
};
|
||||
|
||||
return albersUsa.scale(1070);
|
||||
};
|
||||
11
node_modules/d3/src/geo/albers.js
generated
vendored
11
node_modules/d3/src/geo/albers.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
import "conic-equal-area";
|
||||
import "geo";
|
||||
|
||||
// ESRI:102003
|
||||
d3.geo.albers = function() {
|
||||
return d3.geo.conicEqualArea()
|
||||
.rotate([96, 0])
|
||||
.center([-0.6, 38.7])
|
||||
.parallels([29.5, 45.5])
|
||||
.scale(1070);
|
||||
};
|
||||
69
node_modules/d3/src/geo/area.js
generated
vendored
69
node_modules/d3/src/geo/area.js
generated
vendored
@@ -1,69 +0,0 @@
|
||||
import "../core/noop";
|
||||
import "../math/adder";
|
||||
import "../math/trigonometry";
|
||||
import "geo";
|
||||
import "stream";
|
||||
|
||||
d3.geo.area = function(object) {
|
||||
d3_geo_areaSum = 0;
|
||||
d3.geo.stream(object, d3_geo_area);
|
||||
return d3_geo_areaSum;
|
||||
};
|
||||
|
||||
var d3_geo_areaSum,
|
||||
d3_geo_areaRingSum = new d3_adder;
|
||||
|
||||
var d3_geo_area = {
|
||||
sphere: function() { d3_geo_areaSum += 4 * π; },
|
||||
point: d3_noop,
|
||||
lineStart: d3_noop,
|
||||
lineEnd: d3_noop,
|
||||
|
||||
// Only count area for polygon rings.
|
||||
polygonStart: function() {
|
||||
d3_geo_areaRingSum.reset();
|
||||
d3_geo_area.lineStart = d3_geo_areaRingStart;
|
||||
},
|
||||
polygonEnd: function() {
|
||||
var area = 2 * d3_geo_areaRingSum;
|
||||
d3_geo_areaSum += area < 0 ? 4 * π + area : area;
|
||||
d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
|
||||
}
|
||||
};
|
||||
|
||||
function d3_geo_areaRingStart() {
|
||||
var λ00, φ00, λ0, cosφ0, sinφ0; // start point and previous point
|
||||
|
||||
// For the first point, …
|
||||
d3_geo_area.point = function(λ, φ) {
|
||||
d3_geo_area.point = nextPoint;
|
||||
λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), sinφ0 = Math.sin(φ);
|
||||
};
|
||||
|
||||
// For subsequent points, …
|
||||
function nextPoint(λ, φ) {
|
||||
λ *= d3_radians;
|
||||
φ = φ * d3_radians / 2 + π / 4; // half the angular distance from south pole
|
||||
|
||||
// Spherical excess E for a spherical triangle with vertices: south pole,
|
||||
// previous point, current point. Uses a formula derived from Cagnoli’s
|
||||
// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
|
||||
var dλ = λ - λ0,
|
||||
sdλ = dλ >= 0 ? 1 : -1,
|
||||
adλ = sdλ * dλ,
|
||||
cosφ = Math.cos(φ),
|
||||
sinφ = Math.sin(φ),
|
||||
k = sinφ0 * sinφ,
|
||||
u = cosφ0 * cosφ + k * Math.cos(adλ),
|
||||
v = k * sdλ * Math.sin(adλ);
|
||||
d3_geo_areaRingSum.add(Math.atan2(v, u));
|
||||
|
||||
// Advance the previous points.
|
||||
λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
|
||||
}
|
||||
|
||||
// For the last point, return to the start.
|
||||
d3_geo_area.lineEnd = function() {
|
||||
nextPoint(λ00, φ00);
|
||||
};
|
||||
}
|
||||
12
node_modules/d3/src/geo/azimuthal-equal-area.js
generated
vendored
12
node_modules/d3/src/geo/azimuthal-equal-area.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
import "azimuthal";
|
||||
import "geo";
|
||||
import "projection";
|
||||
|
||||
var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(
|
||||
function(cosλcosφ) { return Math.sqrt(2 / (1 + cosλcosφ)); },
|
||||
function(ρ) { return 2 * Math.asin(ρ / 2); }
|
||||
);
|
||||
|
||||
(d3.geo.azimuthalEqualArea = function() {
|
||||
return d3_geo_projection(d3_geo_azimuthalEqualArea);
|
||||
}).raw = d3_geo_azimuthalEqualArea;
|
||||
13
node_modules/d3/src/geo/azimuthal-equidistant.js
generated
vendored
13
node_modules/d3/src/geo/azimuthal-equidistant.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
import "../core/identity";
|
||||
import "azimuthal";
|
||||
import "geo";
|
||||
import "projection";
|
||||
|
||||
var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(
|
||||
function(cosλcosφ) { var c = Math.acos(cosλcosφ); return c && c / Math.sin(c); },
|
||||
d3_identity
|
||||
);
|
||||
|
||||
(d3.geo.azimuthalEquidistant = function() {
|
||||
return d3_geo_projection(d3_geo_azimuthalEquidistant);
|
||||
}).raw = d3_geo_azimuthalEquidistant;
|
||||
25
node_modules/d3/src/geo/azimuthal.js
generated
vendored
25
node_modules/d3/src/geo/azimuthal.js
generated
vendored
@@ -1,25 +0,0 @@
|
||||
// Abstract azimuthal projection.
|
||||
function d3_geo_azimuthal(scale, angle) {
|
||||
function azimuthal(λ, φ) {
|
||||
var cosλ = Math.cos(λ),
|
||||
cosφ = Math.cos(φ),
|
||||
k = scale(cosλ * cosφ);
|
||||
return [
|
||||
k * cosφ * Math.sin(λ),
|
||||
k * Math.sin(φ)
|
||||
];
|
||||
}
|
||||
|
||||
azimuthal.invert = function(x, y) {
|
||||
var ρ = Math.sqrt(x * x + y * y),
|
||||
c = angle(ρ),
|
||||
sinc = Math.sin(c),
|
||||
cosc = Math.cos(c);
|
||||
return [
|
||||
Math.atan2(x * sinc, ρ * cosc),
|
||||
Math.asin(ρ && y * sinc / ρ)
|
||||
];
|
||||
};
|
||||
|
||||
return azimuthal;
|
||||
}
|
||||
168
node_modules/d3/src/geo/bounds.js
generated
vendored
168
node_modules/d3/src/geo/bounds.js
generated
vendored
@@ -1,168 +0,0 @@
|
||||
import "../math/abs";
|
||||
import "geo";
|
||||
import "stream";
|
||||
import "area";
|
||||
import "cartesian";
|
||||
import "spherical";
|
||||
|
||||
d3.geo.bounds = (function() {
|
||||
var λ0, φ0, λ1, φ1, // bounds
|
||||
λ_, // previous λ-coordinate
|
||||
λ__, φ__, // first point
|
||||
p0, // previous 3D point
|
||||
dλSum,
|
||||
ranges,
|
||||
range;
|
||||
|
||||
var bound = {
|
||||
point: point,
|
||||
lineStart: lineStart,
|
||||
lineEnd: lineEnd,
|
||||
|
||||
polygonStart: function() {
|
||||
bound.point = ringPoint;
|
||||
bound.lineStart = ringStart;
|
||||
bound.lineEnd = ringEnd;
|
||||
dλSum = 0;
|
||||
d3_geo_area.polygonStart();
|
||||
},
|
||||
polygonEnd: function() {
|
||||
d3_geo_area.polygonEnd();
|
||||
bound.point = point;
|
||||
bound.lineStart = lineStart;
|
||||
bound.lineEnd = lineEnd;
|
||||
if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90);
|
||||
else if (dλSum > ε) φ1 = 90;
|
||||
else if (dλSum < -ε) φ0 = -90;
|
||||
range[0] = λ0, range[1] = λ1;
|
||||
}
|
||||
};
|
||||
|
||||
function point(λ, φ) {
|
||||
ranges.push(range = [λ0 = λ, λ1 = λ]);
|
||||
if (φ < φ0) φ0 = φ;
|
||||
if (φ > φ1) φ1 = φ;
|
||||
}
|
||||
|
||||
function linePoint(λ, φ) {
|
||||
var p = d3_geo_cartesian([λ * d3_radians, φ * d3_radians]);
|
||||
if (p0) {
|
||||
var normal = d3_geo_cartesianCross(p0, p),
|
||||
equatorial = [normal[1], -normal[0], 0],
|
||||
inflection = d3_geo_cartesianCross(equatorial, normal);
|
||||
d3_geo_cartesianNormalize(inflection);
|
||||
inflection = d3_geo_spherical(inflection);
|
||||
var dλ = λ - λ_,
|
||||
s = dλ > 0 ? 1 : -1,
|
||||
λi = inflection[0] * d3_degrees * s,
|
||||
antimeridian = abs(dλ) > 180;
|
||||
if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
|
||||
var φi = inflection[1] * d3_degrees;
|
||||
if (φi > φ1) φ1 = φi;
|
||||
} else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
|
||||
var φi = -inflection[1] * d3_degrees;
|
||||
if (φi < φ0) φ0 = φi;
|
||||
} else {
|
||||
if (φ < φ0) φ0 = φ;
|
||||
if (φ > φ1) φ1 = φ;
|
||||
}
|
||||
if (antimeridian) {
|
||||
if (λ < λ_) {
|
||||
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
|
||||
} else {
|
||||
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
|
||||
}
|
||||
} else {
|
||||
if (λ1 >= λ0) {
|
||||
if (λ < λ0) λ0 = λ;
|
||||
if (λ > λ1) λ1 = λ;
|
||||
} else {
|
||||
if (λ > λ_) {
|
||||
if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
|
||||
} else {
|
||||
if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
point(λ, φ);
|
||||
}
|
||||
p0 = p, λ_ = λ;
|
||||
}
|
||||
|
||||
function lineStart() { bound.point = linePoint; }
|
||||
function lineEnd() {
|
||||
range[0] = λ0, range[1] = λ1;
|
||||
bound.point = point;
|
||||
p0 = null;
|
||||
}
|
||||
|
||||
function ringPoint(λ, φ) {
|
||||
if (p0) {
|
||||
var dλ = λ - λ_;
|
||||
dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ;
|
||||
} else λ__ = λ, φ__ = φ;
|
||||
d3_geo_area.point(λ, φ);
|
||||
linePoint(λ, φ);
|
||||
}
|
||||
|
||||
function ringStart() {
|
||||
d3_geo_area.lineStart();
|
||||
}
|
||||
|
||||
function ringEnd() {
|
||||
ringPoint(λ__, φ__);
|
||||
d3_geo_area.lineEnd();
|
||||
if (abs(dλSum) > ε) λ0 = -(λ1 = 180);
|
||||
range[0] = λ0, range[1] = λ1;
|
||||
p0 = null;
|
||||
}
|
||||
|
||||
// Finds the left-right distance between two longitudes.
|
||||
// This is almost the same as (λ1 - λ0 + 360°) % 360°, except that we want
|
||||
// the distance between ±180° to be 360°.
|
||||
function angle(λ0, λ1) { return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1; }
|
||||
|
||||
function compareRanges(a, b) { return a[0] - b[0]; }
|
||||
|
||||
function withinRange(x, range) {
|
||||
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
|
||||
}
|
||||
|
||||
return function(feature) {
|
||||
φ1 = λ1 = -(λ0 = φ0 = Infinity);
|
||||
ranges = [];
|
||||
|
||||
d3.geo.stream(feature, bound);
|
||||
|
||||
var n = ranges.length;
|
||||
if (n) {
|
||||
// First, sort ranges by their minimum longitudes.
|
||||
ranges.sort(compareRanges);
|
||||
|
||||
// Then, merge any ranges that overlap.
|
||||
for (var i = 1, a = ranges[0], b, merged = [a]; i < n; ++i) {
|
||||
b = ranges[i];
|
||||
if (withinRange(b[0], a) || withinRange(b[1], a)) {
|
||||
if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
|
||||
if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];
|
||||
} else {
|
||||
merged.push(a = b);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, find the largest gap between the merged ranges.
|
||||
// The final bounding box will be the inverse of this gap.
|
||||
var best = -Infinity, dλ;
|
||||
for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {
|
||||
b = merged[i];
|
||||
if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1];
|
||||
}
|
||||
}
|
||||
ranges = range = null;
|
||||
|
||||
return λ0 === Infinity || φ0 === Infinity
|
||||
? [[NaN, NaN], [NaN, NaN]]
|
||||
: [[λ0, φ0], [λ1, φ1]];
|
||||
};
|
||||
})();
|
||||
47
node_modules/d3/src/geo/cartesian.js
generated
vendored
47
node_modules/d3/src/geo/cartesian.js
generated
vendored
@@ -1,47 +0,0 @@
|
||||
// TODO
|
||||
// cross and scale return new vectors,
|
||||
// whereas add and normalize operate in-place
|
||||
|
||||
function d3_geo_cartesian(spherical) {
|
||||
var λ = spherical[0],
|
||||
φ = spherical[1],
|
||||
cosφ = Math.cos(φ);
|
||||
return [
|
||||
cosφ * Math.cos(λ),
|
||||
cosφ * Math.sin(λ),
|
||||
Math.sin(φ)
|
||||
];
|
||||
}
|
||||
|
||||
function d3_geo_cartesianDot(a, b) {
|
||||
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
||||
}
|
||||
|
||||
function d3_geo_cartesianCross(a, b) {
|
||||
return [
|
||||
a[1] * b[2] - a[2] * b[1],
|
||||
a[2] * b[0] - a[0] * b[2],
|
||||
a[0] * b[1] - a[1] * b[0]
|
||||
];
|
||||
}
|
||||
|
||||
function d3_geo_cartesianAdd(a, b) {
|
||||
a[0] += b[0];
|
||||
a[1] += b[1];
|
||||
a[2] += b[2];
|
||||
}
|
||||
|
||||
function d3_geo_cartesianScale(vector, k) {
|
||||
return [
|
||||
vector[0] * k,
|
||||
vector[1] * k,
|
||||
vector[2] * k
|
||||
];
|
||||
}
|
||||
|
||||
function d3_geo_cartesianNormalize(d) {
|
||||
var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
|
||||
d[0] /= l;
|
||||
d[1] /= l;
|
||||
d[2] /= l;
|
||||
}
|
||||
149
node_modules/d3/src/geo/centroid.js
generated
vendored
149
node_modules/d3/src/geo/centroid.js
generated
vendored
@@ -1,149 +0,0 @@
|
||||
import "../core/noop";
|
||||
import "../math/trigonometry";
|
||||
import "geo";
|
||||
import "stream";
|
||||
|
||||
d3.geo.centroid = function(object) {
|
||||
d3_geo_centroidW0 = d3_geo_centroidW1 =
|
||||
d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 =
|
||||
d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 =
|
||||
d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
|
||||
d3.geo.stream(object, d3_geo_centroid);
|
||||
|
||||
var x = d3_geo_centroidX2,
|
||||
y = d3_geo_centroidY2,
|
||||
z = d3_geo_centroidZ2,
|
||||
m = x * x + y * y + z * z;
|
||||
|
||||
// If the area-weighted centroid is undefined, fall back to length-weighted centroid.
|
||||
if (m < ε2) {
|
||||
x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;
|
||||
// If the feature has zero length, fall back to arithmetic mean of point vectors.
|
||||
if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;
|
||||
m = x * x + y * y + z * z;
|
||||
// If the feature still has an undefined centroid, then return.
|
||||
if (m < ε2) return [NaN, NaN];
|
||||
}
|
||||
|
||||
return [Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees];
|
||||
};
|
||||
|
||||
var d3_geo_centroidW0,
|
||||
d3_geo_centroidW1,
|
||||
d3_geo_centroidX0,
|
||||
d3_geo_centroidY0,
|
||||
d3_geo_centroidZ0,
|
||||
d3_geo_centroidX1,
|
||||
d3_geo_centroidY1,
|
||||
d3_geo_centroidZ1,
|
||||
d3_geo_centroidX2,
|
||||
d3_geo_centroidY2,
|
||||
d3_geo_centroidZ2;
|
||||
|
||||
var d3_geo_centroid = {
|
||||
sphere: d3_noop,
|
||||
point: d3_geo_centroidPoint,
|
||||
lineStart: d3_geo_centroidLineStart,
|
||||
lineEnd: d3_geo_centroidLineEnd,
|
||||
polygonStart: function() {
|
||||
d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
|
||||
},
|
||||
polygonEnd: function() {
|
||||
d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
|
||||
}
|
||||
};
|
||||
|
||||
// Arithmetic mean of Cartesian vectors.
|
||||
function d3_geo_centroidPoint(λ, φ) {
|
||||
λ *= d3_radians;
|
||||
var cosφ = Math.cos(φ *= d3_radians);
|
||||
d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
|
||||
}
|
||||
|
||||
function d3_geo_centroidPointXYZ(x, y, z) {
|
||||
++d3_geo_centroidW0;
|
||||
d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;
|
||||
d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;
|
||||
d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;
|
||||
}
|
||||
|
||||
function d3_geo_centroidLineStart() {
|
||||
var x0, y0, z0; // previous point
|
||||
|
||||
d3_geo_centroid.point = function(λ, φ) {
|
||||
λ *= d3_radians;
|
||||
var cosφ = Math.cos(φ *= d3_radians);
|
||||
x0 = cosφ * Math.cos(λ);
|
||||
y0 = cosφ * Math.sin(λ);
|
||||
z0 = Math.sin(φ);
|
||||
d3_geo_centroid.point = nextPoint;
|
||||
d3_geo_centroidPointXYZ(x0, y0, z0);
|
||||
};
|
||||
|
||||
function nextPoint(λ, φ) {
|
||||
λ *= d3_radians;
|
||||
var cosφ = Math.cos(φ *= d3_radians),
|
||||
x = cosφ * Math.cos(λ),
|
||||
y = cosφ * Math.sin(λ),
|
||||
z = Math.sin(φ),
|
||||
w = Math.atan2(
|
||||
Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w),
|
||||
x0 * x + y0 * y + z0 * z);
|
||||
d3_geo_centroidW1 += w;
|
||||
d3_geo_centroidX1 += w * (x0 + (x0 = x));
|
||||
d3_geo_centroidY1 += w * (y0 + (y0 = y));
|
||||
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
|
||||
d3_geo_centroidPointXYZ(x0, y0, z0);
|
||||
}
|
||||
}
|
||||
|
||||
function d3_geo_centroidLineEnd() {
|
||||
d3_geo_centroid.point = d3_geo_centroidPoint;
|
||||
}
|
||||
|
||||
// See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
|
||||
// J. Applied Mechanics 42, 239 (1975).
|
||||
function d3_geo_centroidRingStart() {
|
||||
var λ00, φ00, // first point
|
||||
x0, y0, z0; // previous point
|
||||
|
||||
d3_geo_centroid.point = function(λ, φ) {
|
||||
λ00 = λ, φ00 = φ;
|
||||
d3_geo_centroid.point = nextPoint;
|
||||
λ *= d3_radians;
|
||||
var cosφ = Math.cos(φ *= d3_radians);
|
||||
x0 = cosφ * Math.cos(λ);
|
||||
y0 = cosφ * Math.sin(λ);
|
||||
z0 = Math.sin(φ);
|
||||
d3_geo_centroidPointXYZ(x0, y0, z0);
|
||||
};
|
||||
|
||||
d3_geo_centroid.lineEnd = function() {
|
||||
nextPoint(λ00, φ00);
|
||||
d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
|
||||
d3_geo_centroid.point = d3_geo_centroidPoint;
|
||||
};
|
||||
|
||||
function nextPoint(λ, φ) {
|
||||
λ *= d3_radians;
|
||||
var cosφ = Math.cos(φ *= d3_radians),
|
||||
x = cosφ * Math.cos(λ),
|
||||
y = cosφ * Math.sin(λ),
|
||||
z = Math.sin(φ),
|
||||
cx = y0 * z - z0 * y,
|
||||
cy = z0 * x - x0 * z,
|
||||
cz = x0 * y - y0 * x,
|
||||
m = Math.sqrt(cx * cx + cy * cy + cz * cz),
|
||||
u = x0 * x + y0 * y + z0 * z,
|
||||
v = m && -d3_acos(u) / m, // area weight
|
||||
w = Math.atan2(m, u); // line weight
|
||||
d3_geo_centroidX2 += v * cx;
|
||||
d3_geo_centroidY2 += v * cy;
|
||||
d3_geo_centroidZ2 += v * cz;
|
||||
d3_geo_centroidW1 += w;
|
||||
d3_geo_centroidX1 += w * (x0 + (x0 = x));
|
||||
d3_geo_centroidY1 += w * (y0 + (y0 = y));
|
||||
d3_geo_centroidZ1 += w * (z0 + (z0 = z));
|
||||
d3_geo_centroidPointXYZ(x0, y0, z0);
|
||||
}
|
||||
}
|
||||
81
node_modules/d3/src/geo/circle.js
generated
vendored
81
node_modules/d3/src/geo/circle.js
generated
vendored
@@ -1,81 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "cartesian";
|
||||
import "geo";
|
||||
import "rotation";
|
||||
import "spherical";
|
||||
|
||||
d3.geo.circle = function() {
|
||||
var origin = [0, 0],
|
||||
angle,
|
||||
precision = 6,
|
||||
interpolate;
|
||||
|
||||
function circle() {
|
||||
var center = typeof origin === "function" ? origin.apply(this, arguments) : origin,
|
||||
rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert,
|
||||
ring = [];
|
||||
|
||||
interpolate(null, null, 1, {
|
||||
point: function(x, y) {
|
||||
ring.push(x = rotate(x, y));
|
||||
x[0] *= d3_degrees, x[1] *= d3_degrees;
|
||||
}
|
||||
});
|
||||
|
||||
return {type: "Polygon", coordinates: [ring]};
|
||||
}
|
||||
|
||||
circle.origin = function(x) {
|
||||
if (!arguments.length) return origin;
|
||||
origin = x;
|
||||
return circle;
|
||||
};
|
||||
|
||||
circle.angle = function(x) {
|
||||
if (!arguments.length) return angle;
|
||||
interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
|
||||
return circle;
|
||||
};
|
||||
|
||||
circle.precision = function(_) {
|
||||
if (!arguments.length) return precision;
|
||||
interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
|
||||
return circle;
|
||||
};
|
||||
|
||||
return circle.angle(90);
|
||||
};
|
||||
|
||||
// Interpolates along a circle centered at [0°, 0°], with a given radius and
|
||||
// precision.
|
||||
function d3_geo_circleInterpolate(radius, precision) {
|
||||
var cr = Math.cos(radius),
|
||||
sr = Math.sin(radius);
|
||||
return function(from, to, direction, listener) {
|
||||
var step = direction * precision;
|
||||
if (from != null) {
|
||||
from = d3_geo_circleAngle(cr, from);
|
||||
to = d3_geo_circleAngle(cr, to);
|
||||
if (direction > 0 ? from < to: from > to) from += direction * τ;
|
||||
} else {
|
||||
from = radius + direction * τ;
|
||||
to = radius - 0.5 * step;
|
||||
}
|
||||
for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) {
|
||||
listener.point((point = d3_geo_spherical([
|
||||
cr,
|
||||
-sr * Math.cos(t),
|
||||
-sr * Math.sin(t)
|
||||
]))[0], point[1]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Signed angle of a cartesian point relative to [cr, 0, 0].
|
||||
function d3_geo_circleAngle(cr, point) {
|
||||
var a = d3_geo_cartesian(point);
|
||||
a[0] -= cr;
|
||||
d3_geo_cartesianNormalize(a);
|
||||
var angle = d3_acos(-a[1]);
|
||||
return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
|
||||
}
|
||||
95
node_modules/d3/src/geo/clip-antimeridian.js
generated
vendored
95
node_modules/d3/src/geo/clip-antimeridian.js
generated
vendored
@@ -1,95 +0,0 @@
|
||||
import "../core/true";
|
||||
import "../math/abs";
|
||||
import "../math/trigonometry";
|
||||
import "clip";
|
||||
|
||||
var d3_geo_clipAntimeridian = d3_geo_clip(
|
||||
d3_true,
|
||||
d3_geo_clipAntimeridianLine,
|
||||
d3_geo_clipAntimeridianInterpolate,
|
||||
[-π, -π / 2]);
|
||||
|
||||
// Takes a line and cuts into visible segments. Return values:
|
||||
// 0: there were intersections or the line was empty.
|
||||
// 1: no intersections.
|
||||
// 2: there were intersections, and the first and last segments should be
|
||||
// rejoined.
|
||||
function d3_geo_clipAntimeridianLine(listener) {
|
||||
var λ0 = NaN,
|
||||
φ0 = NaN,
|
||||
sλ0 = NaN,
|
||||
clean; // no intersections
|
||||
|
||||
return {
|
||||
lineStart: function() {
|
||||
listener.lineStart();
|
||||
clean = 1;
|
||||
},
|
||||
point: function(λ1, φ1) {
|
||||
var sλ1 = λ1 > 0 ? π : -π,
|
||||
dλ = abs(λ1 - λ0);
|
||||
if (abs(dλ - π) < ε) { // line crosses a pole
|
||||
listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ);
|
||||
listener.point(sλ0, φ0);
|
||||
listener.lineEnd();
|
||||
listener.lineStart();
|
||||
listener.point(sλ1, φ0);
|
||||
listener.point(λ1, φ0);
|
||||
clean = 0;
|
||||
} else if (sλ0 !== sλ1 && dλ >= π) { // line crosses antimeridian
|
||||
// handle degeneracies
|
||||
if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
|
||||
if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
|
||||
φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
|
||||
listener.point(sλ0, φ0);
|
||||
listener.lineEnd();
|
||||
listener.lineStart();
|
||||
listener.point(sλ1, φ0);
|
||||
clean = 0;
|
||||
}
|
||||
listener.point(λ0 = λ1, φ0 = φ1);
|
||||
sλ0 = sλ1;
|
||||
},
|
||||
lineEnd: function() {
|
||||
listener.lineEnd();
|
||||
λ0 = φ0 = NaN;
|
||||
},
|
||||
// if there are intersections, we always rejoin the first and last segments.
|
||||
clean: function() { return 2 - clean; }
|
||||
};
|
||||
}
|
||||
|
||||
function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
|
||||
var cosφ0,
|
||||
cosφ1,
|
||||
sinλ0_λ1 = Math.sin(λ0 - λ1);
|
||||
return abs(sinλ0_λ1) > ε
|
||||
? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1)
|
||||
- Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0))
|
||||
/ (cosφ0 * cosφ1 * sinλ0_λ1))
|
||||
: (φ0 + φ1) / 2;
|
||||
}
|
||||
|
||||
function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
|
||||
var φ;
|
||||
if (from == null) {
|
||||
φ = direction * halfπ;
|
||||
listener.point(-π, φ);
|
||||
listener.point( 0, φ);
|
||||
listener.point( π, φ);
|
||||
listener.point( π, 0);
|
||||
listener.point( π, -φ);
|
||||
listener.point( 0, -φ);
|
||||
listener.point(-π, -φ);
|
||||
listener.point(-π, 0);
|
||||
listener.point(-π, φ);
|
||||
} else if (abs(from[0] - to[0]) > ε) {
|
||||
var s = from[0] < to[0] ? π : -π;
|
||||
φ = direction * s / 2;
|
||||
listener.point(-s, φ);
|
||||
listener.point( 0, φ);
|
||||
listener.point( s, φ);
|
||||
} else {
|
||||
listener.point(to[0], to[1]);
|
||||
}
|
||||
}
|
||||
178
node_modules/d3/src/geo/clip-circle.js
generated
vendored
178
node_modules/d3/src/geo/clip-circle.js
generated
vendored
@@ -1,178 +0,0 @@
|
||||
import "../math/abs";
|
||||
import "../math/trigonometry";
|
||||
import "cartesian";
|
||||
import "clip";
|
||||
import "circle";
|
||||
import "spherical";
|
||||
import "point-in-polygon";
|
||||
|
||||
// Clip features against a small circle centered at [0°, 0°].
|
||||
function d3_geo_clipCircle(radius) {
|
||||
var cr = Math.cos(radius),
|
||||
smallRadius = cr > 0,
|
||||
notHemisphere = abs(cr) > ε, // TODO optimise for this common case
|
||||
interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
|
||||
|
||||
return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-π, radius - π]);
|
||||
|
||||
function visible(λ, φ) {
|
||||
return Math.cos(λ) * Math.cos(φ) > cr;
|
||||
}
|
||||
|
||||
// Takes a line and cuts into visible segments. Return values used for
|
||||
// polygon clipping:
|
||||
// 0: there were intersections or the line was empty.
|
||||
// 1: no intersections.
|
||||
// 2: there were intersections, and the first and last segments should be
|
||||
// rejoined.
|
||||
function clipLine(listener) {
|
||||
var point0, // previous point
|
||||
c0, // code for previous point
|
||||
v0, // visibility of previous point
|
||||
v00, // visibility of first point
|
||||
clean; // no intersections
|
||||
return {
|
||||
lineStart: function() {
|
||||
v00 = v0 = false;
|
||||
clean = 1;
|
||||
},
|
||||
point: function(λ, φ) {
|
||||
var point1 = [λ, φ],
|
||||
point2,
|
||||
v = visible(λ, φ),
|
||||
c = smallRadius
|
||||
? v ? 0 : code(λ, φ)
|
||||
: v ? code(λ + (λ < 0 ? π : -π), φ) : 0;
|
||||
if (!point0 && (v00 = v0 = v)) listener.lineStart();
|
||||
// Handle degeneracies.
|
||||
// TODO ignore if not clipping polygons.
|
||||
if (v !== v0) {
|
||||
point2 = intersect(point0, point1);
|
||||
if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
|
||||
point1[0] += ε;
|
||||
point1[1] += ε;
|
||||
v = visible(point1[0], point1[1]);
|
||||
}
|
||||
}
|
||||
if (v !== v0) {
|
||||
clean = 0;
|
||||
if (v) {
|
||||
// outside going in
|
||||
listener.lineStart();
|
||||
point2 = intersect(point1, point0);
|
||||
listener.point(point2[0], point2[1]);
|
||||
} else {
|
||||
// inside going out
|
||||
point2 = intersect(point0, point1);
|
||||
listener.point(point2[0], point2[1]);
|
||||
listener.lineEnd();
|
||||
}
|
||||
point0 = point2;
|
||||
} else if (notHemisphere && point0 && smallRadius ^ v) {
|
||||
var t;
|
||||
// If the codes for two points are different, or are both zero,
|
||||
// and there this segment intersects with the small circle.
|
||||
if (!(c & c0) && (t = intersect(point1, point0, true))) {
|
||||
clean = 0;
|
||||
if (smallRadius) {
|
||||
listener.lineStart();
|
||||
listener.point(t[0][0], t[0][1]);
|
||||
listener.point(t[1][0], t[1][1]);
|
||||
listener.lineEnd();
|
||||
} else {
|
||||
listener.point(t[1][0], t[1][1]);
|
||||
listener.lineEnd();
|
||||
listener.lineStart();
|
||||
listener.point(t[0][0], t[0][1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {
|
||||
listener.point(point1[0], point1[1]);
|
||||
}
|
||||
point0 = point1, v0 = v, c0 = c;
|
||||
},
|
||||
lineEnd: function() {
|
||||
if (v0) listener.lineEnd();
|
||||
point0 = null;
|
||||
},
|
||||
// Rejoin first and last segments if there were intersections and the first
|
||||
// and last points were visible.
|
||||
clean: function() { return clean | ((v00 && v0) << 1); }
|
||||
};
|
||||
}
|
||||
|
||||
// Intersects the great circle between a and b with the clip circle.
|
||||
function intersect(a, b, two) {
|
||||
var pa = d3_geo_cartesian(a),
|
||||
pb = d3_geo_cartesian(b);
|
||||
|
||||
// We have two planes, n1.p = d1 and n2.p = d2.
|
||||
// Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2).
|
||||
var n1 = [1, 0, 0], // normal
|
||||
n2 = d3_geo_cartesianCross(pa, pb),
|
||||
n2n2 = d3_geo_cartesianDot(n2, n2),
|
||||
n1n2 = n2[0], // d3_geo_cartesianDot(n1, n2),
|
||||
determinant = n2n2 - n1n2 * n1n2;
|
||||
|
||||
// Two polar points.
|
||||
if (!determinant) return !two && a;
|
||||
|
||||
var c1 = cr * n2n2 / determinant,
|
||||
c2 = -cr * n1n2 / determinant,
|
||||
n1xn2 = d3_geo_cartesianCross(n1, n2),
|
||||
A = d3_geo_cartesianScale(n1, c1),
|
||||
B = d3_geo_cartesianScale(n2, c2);
|
||||
d3_geo_cartesianAdd(A, B);
|
||||
|
||||
// Solve |p(t)|^2 = 1.
|
||||
var u = n1xn2,
|
||||
w = d3_geo_cartesianDot(A, u),
|
||||
uu = d3_geo_cartesianDot(u, u),
|
||||
t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);
|
||||
|
||||
if (t2 < 0) return;
|
||||
|
||||
var t = Math.sqrt(t2),
|
||||
q = d3_geo_cartesianScale(u, (-w - t) / uu);
|
||||
d3_geo_cartesianAdd(q, A);
|
||||
q = d3_geo_spherical(q);
|
||||
if (!two) return q;
|
||||
|
||||
// Two intersection points.
|
||||
var λ0 = a[0],
|
||||
λ1 = b[0],
|
||||
φ0 = a[1],
|
||||
φ1 = b[1],
|
||||
z;
|
||||
if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;
|
||||
var δλ = λ1 - λ0,
|
||||
polar = abs(δλ - π) < ε,
|
||||
meridian = polar || δλ < ε;
|
||||
|
||||
if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;
|
||||
|
||||
// Check that the first point is between a and b.
|
||||
if (meridian
|
||||
? polar
|
||||
? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1)
|
||||
: φ0 <= q[1] && q[1] <= φ1
|
||||
: δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {
|
||||
var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);
|
||||
d3_geo_cartesianAdd(q1, A);
|
||||
return [q, d3_geo_spherical(q1)];
|
||||
}
|
||||
}
|
||||
|
||||
// Generates a 4-bit vector representing the location of a point relative to
|
||||
// the small circle's bounding box.
|
||||
function code(λ, φ) {
|
||||
var r = smallRadius ? radius : π - radius,
|
||||
code = 0;
|
||||
if (λ < -r) code |= 1; // left
|
||||
else if (λ > r) code |= 2; // right
|
||||
if (φ < -r) code |= 4; // below
|
||||
else if (φ > r) code |= 8; // above
|
||||
return code;
|
||||
}
|
||||
}
|
||||
196
node_modules/d3/src/geo/clip-extent.js
generated
vendored
196
node_modules/d3/src/geo/clip-extent.js
generated
vendored
@@ -1,196 +0,0 @@
|
||||
import "../arrays/merge";
|
||||
import "../math/abs";
|
||||
import "../math/trigonometry";
|
||||
import "../geom/clip-line";
|
||||
import "geo";
|
||||
import "clip";
|
||||
import "clip-polygon";
|
||||
|
||||
var d3_geo_clipExtentMAX = 1e9;
|
||||
|
||||
d3.geo.clipExtent = function() {
|
||||
var x0, y0, x1, y1,
|
||||
stream,
|
||||
clip,
|
||||
clipExtent = {
|
||||
stream: function(output) {
|
||||
if (stream) stream.valid = false;
|
||||
stream = clip(output);
|
||||
stream.valid = true; // allow caching by d3.geo.path
|
||||
return stream;
|
||||
},
|
||||
extent: function(_) {
|
||||
if (!arguments.length) return [[x0, y0], [x1, y1]];
|
||||
clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]);
|
||||
if (stream) stream.valid = false, stream = null;
|
||||
return clipExtent;
|
||||
}
|
||||
};
|
||||
return clipExtent.extent([[0, 0], [960, 500]]);
|
||||
};
|
||||
|
||||
function d3_geo_clipExtent(x0, y0, x1, y1) {
|
||||
return function(listener) {
|
||||
var listener_ = listener,
|
||||
bufferListener = d3_geo_clipBufferListener(),
|
||||
clipLine = d3_geom_clipLine(x0, y0, x1, y1),
|
||||
segments,
|
||||
polygon,
|
||||
ring;
|
||||
|
||||
var clip = {
|
||||
point: point,
|
||||
lineStart: lineStart,
|
||||
lineEnd: lineEnd,
|
||||
polygonStart: function() {
|
||||
listener = bufferListener;
|
||||
segments = [];
|
||||
polygon = [];
|
||||
clean = true;
|
||||
},
|
||||
polygonEnd: function() {
|
||||
listener = listener_;
|
||||
segments = d3.merge(segments);
|
||||
var clipStartInside = insidePolygon([x0, y1]),
|
||||
inside = clean && clipStartInside,
|
||||
visible = segments.length;
|
||||
if (inside || visible) {
|
||||
listener.polygonStart();
|
||||
if (inside) {
|
||||
listener.lineStart();
|
||||
interpolate(null, null, 1, listener);
|
||||
listener.lineEnd();
|
||||
}
|
||||
if (visible) {
|
||||
d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener);
|
||||
}
|
||||
listener.polygonEnd();
|
||||
}
|
||||
segments = polygon = ring = null;
|
||||
}
|
||||
};
|
||||
|
||||
function insidePolygon(p) {
|
||||
var wn = 0, // the winding number counter
|
||||
n = polygon.length,
|
||||
y = p[1];
|
||||
|
||||
for (var i = 0; i < n; ++i) {
|
||||
for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {
|
||||
b = v[j];
|
||||
if (a[1] <= y) {
|
||||
if (b[1] > y && d3_cross2d(a, b, p) > 0) ++wn;
|
||||
} else {
|
||||
if (b[1] <= y && d3_cross2d(a, b, p) < 0) --wn;
|
||||
}
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
return wn !== 0;
|
||||
}
|
||||
|
||||
function interpolate(from, to, direction, listener) {
|
||||
var a = 0, a1 = 0;
|
||||
if (from == null ||
|
||||
(a = corner(from, direction)) !== (a1 = corner(to, direction)) ||
|
||||
comparePoints(from, to) < 0 ^ direction > 0) {
|
||||
do {
|
||||
listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
|
||||
} while ((a = (a + direction + 4) % 4) !== a1);
|
||||
} else {
|
||||
listener.point(to[0], to[1]);
|
||||
}
|
||||
}
|
||||
|
||||
function pointVisible(x, y) {
|
||||
return x0 <= x && x <= x1 && y0 <= y && y <= y1;
|
||||
}
|
||||
|
||||
function point(x, y) {
|
||||
if (pointVisible(x, y)) listener.point(x, y);
|
||||
}
|
||||
|
||||
var x__, y__, v__, // first point
|
||||
x_, y_, v_, // previous point
|
||||
first,
|
||||
clean;
|
||||
|
||||
function lineStart() {
|
||||
clip.point = linePoint;
|
||||
if (polygon) polygon.push(ring = []);
|
||||
first = true;
|
||||
v_ = false;
|
||||
x_ = y_ = NaN;
|
||||
}
|
||||
|
||||
function lineEnd() {
|
||||
// TODO rather than special-case polygons, simply handle them separately.
|
||||
// Ideally, coincident intersection points should be jittered to avoid
|
||||
// clipping issues.
|
||||
if (segments) {
|
||||
linePoint(x__, y__);
|
||||
if (v__ && v_) bufferListener.rejoin();
|
||||
segments.push(bufferListener.buffer());
|
||||
}
|
||||
clip.point = point;
|
||||
if (v_) listener.lineEnd();
|
||||
}
|
||||
|
||||
function linePoint(x, y) {
|
||||
x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x));
|
||||
y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y));
|
||||
var v = pointVisible(x, y);
|
||||
if (polygon) ring.push([x, y]);
|
||||
if (first) {
|
||||
x__ = x, y__ = y, v__ = v;
|
||||
first = false;
|
||||
if (v) {
|
||||
listener.lineStart();
|
||||
listener.point(x, y);
|
||||
}
|
||||
} else {
|
||||
if (v && v_) listener.point(x, y);
|
||||
else {
|
||||
var l = {a: {x: x_, y: y_}, b: {x: x, y: y}};
|
||||
if (clipLine(l)) {
|
||||
if (!v_) {
|
||||
listener.lineStart();
|
||||
listener.point(l.a.x, l.a.y);
|
||||
}
|
||||
listener.point(l.b.x, l.b.y);
|
||||
if (!v) listener.lineEnd();
|
||||
clean = false;
|
||||
} else if (v) {
|
||||
listener.lineStart();
|
||||
listener.point(x, y);
|
||||
clean = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
x_ = x, y_ = y, v_ = v;
|
||||
}
|
||||
|
||||
return clip;
|
||||
};
|
||||
|
||||
function corner(p, direction) {
|
||||
return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3
|
||||
: abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1
|
||||
: abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0
|
||||
: direction > 0 ? 3 : 2; // abs(p[1] - y1) < ε
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
return comparePoints(a.x, b.x);
|
||||
}
|
||||
|
||||
function comparePoints(a, b) {
|
||||
var ca = corner(a, 1),
|
||||
cb = corner(b, 1);
|
||||
return ca !== cb ? ca - cb
|
||||
: ca === 0 ? b[1] - a[1]
|
||||
: ca === 1 ? a[0] - b[0]
|
||||
: ca === 2 ? a[1] - b[1]
|
||||
: b[0] - a[0];
|
||||
}
|
||||
}
|
||||
104
node_modules/d3/src/geo/clip-polygon.js
generated
vendored
104
node_modules/d3/src/geo/clip-polygon.js
generated
vendored
@@ -1,104 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "spherical";
|
||||
|
||||
// General spherical polygon clipping algorithm: takes a polygon, cuts it into
|
||||
// visible line segments and rejoins the segments by interpolating along the
|
||||
// clip edge.
|
||||
function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) {
|
||||
var subject = [],
|
||||
clip = [];
|
||||
|
||||
segments.forEach(function(segment) {
|
||||
if ((n = segment.length - 1) <= 0) return;
|
||||
var n, p0 = segment[0], p1 = segment[n];
|
||||
|
||||
// If the first and last points of a segment are coincident, then treat as
|
||||
// a closed ring.
|
||||
// TODO if all rings are closed, then the winding order of the exterior
|
||||
// ring should be checked.
|
||||
if (d3_geo_sphericalEqual(p0, p1)) {
|
||||
listener.lineStart();
|
||||
for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
|
||||
listener.lineEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true),
|
||||
b = new d3_geo_clipPolygonIntersection(p0, null, a, false);
|
||||
a.o = b;
|
||||
subject.push(a);
|
||||
clip.push(b);
|
||||
a = new d3_geo_clipPolygonIntersection(p1, segment, null, false);
|
||||
b = new d3_geo_clipPolygonIntersection(p1, null, a, true);
|
||||
a.o = b;
|
||||
subject.push(a);
|
||||
clip.push(b);
|
||||
});
|
||||
clip.sort(compare);
|
||||
d3_geo_clipPolygonLinkCircular(subject);
|
||||
d3_geo_clipPolygonLinkCircular(clip);
|
||||
if (!subject.length) return;
|
||||
|
||||
for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) {
|
||||
clip[i].e = entry = !entry;
|
||||
}
|
||||
|
||||
var start = subject[0],
|
||||
points,
|
||||
point;
|
||||
while (1) {
|
||||
// Find first unvisited intersection.
|
||||
var current = start,
|
||||
isSubject = true;
|
||||
while (current.v) if ((current = current.n) === start) return;
|
||||
points = current.z;
|
||||
listener.lineStart();
|
||||
do {
|
||||
current.v = current.o.v = true;
|
||||
if (current.e) {
|
||||
if (isSubject) {
|
||||
for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]);
|
||||
} else {
|
||||
interpolate(current.x, current.n.x, 1, listener);
|
||||
}
|
||||
current = current.n;
|
||||
} else {
|
||||
if (isSubject) {
|
||||
points = current.p.z;
|
||||
for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]);
|
||||
} else {
|
||||
interpolate(current.x, current.p.x, -1, listener);
|
||||
}
|
||||
current = current.p;
|
||||
}
|
||||
current = current.o;
|
||||
points = current.z;
|
||||
isSubject = !isSubject;
|
||||
} while (!current.v);
|
||||
listener.lineEnd();
|
||||
}
|
||||
}
|
||||
|
||||
function d3_geo_clipPolygonLinkCircular(array) {
|
||||
if (!(n = array.length)) return;
|
||||
var n,
|
||||
i = 0,
|
||||
a = array[0],
|
||||
b;
|
||||
while (++i < n) {
|
||||
a.n = b = array[i];
|
||||
b.p = a;
|
||||
a = b;
|
||||
}
|
||||
a.n = b = array[0];
|
||||
b.p = a;
|
||||
}
|
||||
|
||||
function d3_geo_clipPolygonIntersection(point, points, other, entry) {
|
||||
this.x = point;
|
||||
this.z = points;
|
||||
this.o = other; // another intersection
|
||||
this.e = entry; // is an entry?
|
||||
this.v = false; // visited
|
||||
this.n = this.p = null; // next & previous
|
||||
}
|
||||
149
node_modules/d3/src/geo/clip.js
generated
vendored
149
node_modules/d3/src/geo/clip.js
generated
vendored
@@ -1,149 +0,0 @@
|
||||
import "../arrays/merge";
|
||||
import "../core/noop";
|
||||
import "../math/trigonometry";
|
||||
import "clip-polygon";
|
||||
|
||||
function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) {
|
||||
return function(rotate, listener) {
|
||||
var line = clipLine(listener),
|
||||
rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]);
|
||||
|
||||
var clip = {
|
||||
point: point,
|
||||
lineStart: lineStart,
|
||||
lineEnd: lineEnd,
|
||||
polygonStart: function() {
|
||||
clip.point = pointRing;
|
||||
clip.lineStart = ringStart;
|
||||
clip.lineEnd = ringEnd;
|
||||
segments = [];
|
||||
polygon = [];
|
||||
},
|
||||
polygonEnd: function() {
|
||||
clip.point = point;
|
||||
clip.lineStart = lineStart;
|
||||
clip.lineEnd = lineEnd;
|
||||
|
||||
segments = d3.merge(segments);
|
||||
var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon);
|
||||
if (segments.length) {
|
||||
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
|
||||
d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener);
|
||||
} else if (clipStartInside) {
|
||||
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
|
||||
listener.lineStart();
|
||||
interpolate(null, null, 1, listener);
|
||||
listener.lineEnd();
|
||||
}
|
||||
if (polygonStarted) listener.polygonEnd(), polygonStarted = false;
|
||||
segments = polygon = null;
|
||||
},
|
||||
sphere: function() {
|
||||
listener.polygonStart();
|
||||
listener.lineStart();
|
||||
interpolate(null, null, 1, listener);
|
||||
listener.lineEnd();
|
||||
listener.polygonEnd();
|
||||
}
|
||||
};
|
||||
|
||||
function point(λ, φ) {
|
||||
var point = rotate(λ, φ);
|
||||
if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ);
|
||||
}
|
||||
function pointLine(λ, φ) {
|
||||
var point = rotate(λ, φ);
|
||||
line.point(point[0], point[1]);
|
||||
}
|
||||
function lineStart() { clip.point = pointLine; line.lineStart(); }
|
||||
function lineEnd() { clip.point = point; line.lineEnd(); }
|
||||
|
||||
var segments;
|
||||
|
||||
var buffer = d3_geo_clipBufferListener(),
|
||||
ringListener = clipLine(buffer),
|
||||
polygonStarted = false,
|
||||
polygon,
|
||||
ring;
|
||||
|
||||
function pointRing(λ, φ) {
|
||||
ring.push([λ, φ]);
|
||||
var point = rotate(λ, φ);
|
||||
ringListener.point(point[0], point[1]);
|
||||
}
|
||||
|
||||
function ringStart() {
|
||||
ringListener.lineStart();
|
||||
ring = [];
|
||||
}
|
||||
|
||||
function ringEnd() {
|
||||
pointRing(ring[0][0], ring[0][1]);
|
||||
ringListener.lineEnd();
|
||||
|
||||
var clean = ringListener.clean(),
|
||||
ringSegments = buffer.buffer(),
|
||||
segment,
|
||||
n = ringSegments.length;
|
||||
|
||||
ring.pop();
|
||||
polygon.push(ring);
|
||||
ring = null;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
// No intersections.
|
||||
if (clean & 1) {
|
||||
segment = ringSegments[0];
|
||||
var n = segment.length - 1,
|
||||
i = -1,
|
||||
point;
|
||||
if (n > 0) {
|
||||
if (!polygonStarted) listener.polygonStart(), polygonStarted = true;
|
||||
listener.lineStart();
|
||||
while (++i < n) listener.point((point = segment[i])[0], point[1]);
|
||||
listener.lineEnd();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Rejoin connected segments.
|
||||
// TODO reuse bufferListener.rejoin()?
|
||||
if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
|
||||
|
||||
segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
|
||||
}
|
||||
|
||||
return clip;
|
||||
};
|
||||
}
|
||||
|
||||
function d3_geo_clipSegmentLength1(segment) {
|
||||
return segment.length > 1;
|
||||
}
|
||||
|
||||
function d3_geo_clipBufferListener() {
|
||||
var lines = [],
|
||||
line;
|
||||
return {
|
||||
lineStart: function() { lines.push(line = []); },
|
||||
point: function(λ, φ) { line.push([λ, φ]); },
|
||||
lineEnd: d3_noop,
|
||||
buffer: function() {
|
||||
var buffer = lines;
|
||||
lines = [];
|
||||
line = null;
|
||||
return buffer;
|
||||
},
|
||||
rejoin: function() {
|
||||
if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Intersection points are sorted along the clip edge. For both antimeridian
|
||||
// cutting and circle clipping, the same comparison is used.
|
||||
function d3_geo_clipSort(a, b) {
|
||||
return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1])
|
||||
- ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);
|
||||
}
|
||||
12
node_modules/d3/src/geo/compose.js
generated
vendored
12
node_modules/d3/src/geo/compose.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
function d3_geo_compose(a, b) {
|
||||
|
||||
function compose(x, y) {
|
||||
return x = a(x, y), b(x[0], x[1]);
|
||||
}
|
||||
|
||||
if (a.invert && b.invert) compose.invert = function(x, y) {
|
||||
return x = b.invert(x, y), x && a.invert(x[0], x[1]);
|
||||
};
|
||||
|
||||
return compose;
|
||||
}
|
||||
39
node_modules/d3/src/geo/conic-conformal.js
generated
vendored
39
node_modules/d3/src/geo/conic-conformal.js
generated
vendored
@@ -1,39 +0,0 @@
|
||||
import "../math/abs";
|
||||
import "../math/trigonometry";
|
||||
import "conic";
|
||||
import "geo";
|
||||
import "projection";
|
||||
|
||||
function d3_geo_conicConformal(φ0, φ1) {
|
||||
var cosφ0 = Math.cos(φ0),
|
||||
t = function(φ) { return Math.tan(π / 4 + φ / 2); },
|
||||
n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)),
|
||||
F = cosφ0 * Math.pow(t(φ0), n) / n;
|
||||
|
||||
if (!n) return d3_geo_mercator;
|
||||
|
||||
function forward(λ, φ) {
|
||||
if (F > 0) { if (φ < -halfπ + ε) φ = -halfπ + ε; }
|
||||
else { if (φ > halfπ - ε) φ = halfπ - ε; }
|
||||
var ρ = F / Math.pow(t(φ), n);
|
||||
return [
|
||||
ρ * Math.sin(n * λ),
|
||||
F - ρ * Math.cos(n * λ)
|
||||
];
|
||||
}
|
||||
|
||||
forward.invert = function(x, y) {
|
||||
var ρ0_y = F - y,
|
||||
ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
|
||||
return [
|
||||
Math.atan2(x, ρ0_y) / n,
|
||||
2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ
|
||||
];
|
||||
};
|
||||
|
||||
return forward;
|
||||
}
|
||||
|
||||
(d3.geo.conicConformal = function() {
|
||||
return d3_geo_conic(d3_geo_conicConformal);
|
||||
}).raw = d3_geo_conicConformal;
|
||||
33
node_modules/d3/src/geo/conic-equal-area.js
generated
vendored
33
node_modules/d3/src/geo/conic-equal-area.js
generated
vendored
@@ -1,33 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "geo";
|
||||
import "conic";
|
||||
import "projection";
|
||||
|
||||
function d3_geo_conicEqualArea(φ0, φ1) {
|
||||
var sinφ0 = Math.sin(φ0),
|
||||
n = (sinφ0 + Math.sin(φ1)) / 2,
|
||||
C = 1 + sinφ0 * (2 * n - sinφ0),
|
||||
ρ0 = Math.sqrt(C) / n;
|
||||
|
||||
function forward(λ, φ) {
|
||||
var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
|
||||
return [
|
||||
ρ * Math.sin(λ *= n),
|
||||
ρ0 - ρ * Math.cos(λ)
|
||||
];
|
||||
}
|
||||
|
||||
forward.invert = function(x, y) {
|
||||
var ρ0_y = ρ0 - y;
|
||||
return [
|
||||
Math.atan2(x, ρ0_y) / n,
|
||||
d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n))
|
||||
];
|
||||
};
|
||||
|
||||
return forward;
|
||||
}
|
||||
|
||||
(d3.geo.conicEqualArea = function() {
|
||||
return d3_geo_conic(d3_geo_conicEqualArea);
|
||||
}).raw = d3_geo_conicEqualArea;
|
||||
36
node_modules/d3/src/geo/conic-equidistant.js
generated
vendored
36
node_modules/d3/src/geo/conic-equidistant.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
import "../math/abs";
|
||||
import "../math/trigonometry";
|
||||
import "conic";
|
||||
import "equirectangular";
|
||||
import "geo";
|
||||
import "projection";
|
||||
|
||||
function d3_geo_conicEquidistant(φ0, φ1) {
|
||||
var cosφ0 = Math.cos(φ0),
|
||||
n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0),
|
||||
G = cosφ0 / n + φ0;
|
||||
|
||||
if (abs(n) < ε) return d3_geo_equirectangular;
|
||||
|
||||
function forward(λ, φ) {
|
||||
var ρ = G - φ;
|
||||
return [
|
||||
ρ * Math.sin(n * λ),
|
||||
G - ρ * Math.cos(n * λ)
|
||||
];
|
||||
}
|
||||
|
||||
forward.invert = function(x, y) {
|
||||
var ρ0_y = G - y;
|
||||
return [
|
||||
Math.atan2(x, ρ0_y) / n,
|
||||
G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y)
|
||||
];
|
||||
};
|
||||
|
||||
return forward;
|
||||
}
|
||||
|
||||
(d3.geo.conicEquidistant = function() {
|
||||
return d3_geo_conic(d3_geo_conicEquidistant);
|
||||
}).raw = d3_geo_conicEquidistant;
|
||||
16
node_modules/d3/src/geo/conic.js
generated
vendored
16
node_modules/d3/src/geo/conic.js
generated
vendored
@@ -1,16 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "projection";
|
||||
|
||||
function d3_geo_conic(projectAt) {
|
||||
var φ0 = 0,
|
||||
φ1 = π / 3,
|
||||
m = d3_geo_projectionMutator(projectAt),
|
||||
p = m(φ0, φ1);
|
||||
|
||||
p.parallels = function(_) {
|
||||
if (!arguments.length) return [φ0 / π * 180, φ1 / π * 180];
|
||||
return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
|
||||
};
|
||||
|
||||
return p;
|
||||
}
|
||||
13
node_modules/d3/src/geo/distance.js
generated
vendored
13
node_modules/d3/src/geo/distance.js
generated
vendored
@@ -1,13 +0,0 @@
|
||||
import "../math/trigonometry";
|
||||
import "geo";
|
||||
|
||||
// Length returned in radians; multiply by radius for distance.
|
||||
d3.geo.distance = function(a, b) {
|
||||
var Δλ = (b[0] - a[0]) * d3_radians,
|
||||
φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians,
|
||||
sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ),
|
||||
sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0),
|
||||
sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1),
|
||||
t;
|
||||
return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
|
||||
};
|
||||
10
node_modules/d3/src/geo/equirectangular.js
generated
vendored
10
node_modules/d3/src/geo/equirectangular.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
import "geo";
|
||||
import "projection";
|
||||
|
||||
function d3_geo_equirectangular(λ, φ) {
|
||||
return [λ, φ];
|
||||
}
|
||||
|
||||
(d3.geo.equirectangular = function() {
|
||||
return d3_geo_projection(d3_geo_equirectangular);
|
||||
}).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
|
||||
1
node_modules/d3/src/geo/geo.js
generated
vendored
1
node_modules/d3/src/geo/geo.js
generated
vendored
@@ -1 +0,0 @@
|
||||
d3.geo = {};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user