force-graph 1.43.5 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/force-graph.js +528 -284
- package/dist/force-graph.js.map +1 -1
- package/dist/force-graph.min.js +3 -3
- package/dist/force-graph.mjs +58 -67
- package/example/medium-graph/index.html +2 -2
- package/package.json +12 -12
- package/src/force-graph.js +21 -13
package/dist/force-graph.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Version 1.
|
|
1
|
+
// Version 1.44.0 force-graph - https://github.com/vasturiano/force-graph
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
if ( ref === void 0 ) ref = {};
|
|
10
10
|
var insertAt = ref.insertAt;
|
|
11
11
|
|
|
12
|
-
if (
|
|
12
|
+
if (typeof document === 'undefined') { return; }
|
|
13
13
|
|
|
14
14
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
15
15
|
var style = document.createElement('style');
|
|
@@ -35,12 +35,31 @@
|
|
|
35
35
|
var css_248z = ".force-graph-container canvas {\n display: block;\n user-select: none;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n\n.force-graph-container .graph-tooltip {\n position: absolute;\n top: 0;\n font-family: sans-serif;\n font-size: 16px;\n padding: 4px;\n border-radius: 3px;\n color: #eee;\n background: rgba(0,0,0,0.65);\n visibility: hidden; /* by default */\n}\n\n.force-graph-container .clickable {\n cursor: pointer;\n}\n\n.force-graph-container .grabbable {\n cursor: move;\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\n.force-graph-container .grabbable:active {\n cursor: grabbing;\n cursor: -moz-grabbing;\n cursor: -webkit-grabbing;\n}\n";
|
|
36
36
|
styleInject(css_248z);
|
|
37
37
|
|
|
38
|
+
function _arrayLikeToArray$3(r, a) {
|
|
39
|
+
(null == a || a > r.length) && (a = r.length);
|
|
40
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
41
|
+
return n;
|
|
42
|
+
}
|
|
43
|
+
function _arrayWithHoles$2(r) {
|
|
44
|
+
if (Array.isArray(r)) return r;
|
|
45
|
+
}
|
|
46
|
+
function _arrayWithoutHoles$2(r) {
|
|
47
|
+
if (Array.isArray(r)) return _arrayLikeToArray$3(r);
|
|
48
|
+
}
|
|
38
49
|
function _construct(t, e, r) {
|
|
39
50
|
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
40
51
|
var o = [null];
|
|
41
52
|
o.push.apply(o, e);
|
|
42
53
|
var p = new (t.bind.apply(t, o))();
|
|
43
|
-
return
|
|
54
|
+
return p;
|
|
55
|
+
}
|
|
56
|
+
function _defineProperty(e, r, t) {
|
|
57
|
+
return (r = _toPropertyKey$2(r)) in e ? Object.defineProperty(e, r, {
|
|
58
|
+
value: t,
|
|
59
|
+
enumerable: !0,
|
|
60
|
+
configurable: !0,
|
|
61
|
+
writable: !0
|
|
62
|
+
}) : e[r] = t, e;
|
|
44
63
|
}
|
|
45
64
|
function _isNativeReflectConstruct() {
|
|
46
65
|
try {
|
|
@@ -50,6 +69,9 @@
|
|
|
50
69
|
return !!t;
|
|
51
70
|
})();
|
|
52
71
|
}
|
|
72
|
+
function _iterableToArray$2(r) {
|
|
73
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
74
|
+
}
|
|
53
75
|
function _iterableToArrayLimit$2(r, l) {
|
|
54
76
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
55
77
|
if (null != t) {
|
|
@@ -61,10 +83,7 @@
|
|
|
61
83
|
f = !0,
|
|
62
84
|
o = !1;
|
|
63
85
|
try {
|
|
64
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
65
|
-
if (Object(t) !== t) return;
|
|
66
|
-
f = !1;
|
|
67
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
86
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
68
87
|
} catch (r) {
|
|
69
88
|
o = !0, n = r;
|
|
70
89
|
} finally {
|
|
@@ -77,6 +96,12 @@
|
|
|
77
96
|
return a;
|
|
78
97
|
}
|
|
79
98
|
}
|
|
99
|
+
function _nonIterableRest$2() {
|
|
100
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
101
|
+
}
|
|
102
|
+
function _nonIterableSpread$2() {
|
|
103
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
104
|
+
}
|
|
80
105
|
function ownKeys(e, r) {
|
|
81
106
|
var t = Object.keys(e);
|
|
82
107
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -98,7 +123,13 @@
|
|
|
98
123
|
}
|
|
99
124
|
return e;
|
|
100
125
|
}
|
|
101
|
-
function
|
|
126
|
+
function _slicedToArray$2(r, e) {
|
|
127
|
+
return _arrayWithHoles$2(r) || _iterableToArrayLimit$2(r, e) || _unsupportedIterableToArray$3(r, e) || _nonIterableRest$2();
|
|
128
|
+
}
|
|
129
|
+
function _toConsumableArray$2(r) {
|
|
130
|
+
return _arrayWithoutHoles$2(r) || _iterableToArray$2(r) || _unsupportedIterableToArray$3(r) || _nonIterableSpread$2();
|
|
131
|
+
}
|
|
132
|
+
function _toPrimitive$2(t, r) {
|
|
102
133
|
if ("object" != typeof t || !t) return t;
|
|
103
134
|
var e = t[Symbol.toPrimitive];
|
|
104
135
|
if (void 0 !== e) {
|
|
@@ -108,9 +139,9 @@
|
|
|
108
139
|
}
|
|
109
140
|
return ("string" === r ? String : Number)(t);
|
|
110
141
|
}
|
|
111
|
-
function _toPropertyKey$
|
|
112
|
-
var i = _toPrimitive$
|
|
113
|
-
return "symbol" == typeof i ? i :
|
|
142
|
+
function _toPropertyKey$2(t) {
|
|
143
|
+
var i = _toPrimitive$2(t, "string");
|
|
144
|
+
return "symbol" == typeof i ? i : i + "";
|
|
114
145
|
}
|
|
115
146
|
function _typeof$1(o) {
|
|
116
147
|
"@babel/helpers - typeof";
|
|
@@ -121,60 +152,12 @@
|
|
|
121
152
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
122
153
|
}, _typeof$1(o);
|
|
123
154
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
enumerable: true,
|
|
130
|
-
configurable: true,
|
|
131
|
-
writable: true
|
|
132
|
-
});
|
|
133
|
-
} else {
|
|
134
|
-
obj[key] = value;
|
|
155
|
+
function _unsupportedIterableToArray$3(r, a) {
|
|
156
|
+
if (r) {
|
|
157
|
+
if ("string" == typeof r) return _arrayLikeToArray$3(r, a);
|
|
158
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
159
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0;
|
|
135
160
|
}
|
|
136
|
-
return obj;
|
|
137
|
-
}
|
|
138
|
-
function _setPrototypeOf(o, p) {
|
|
139
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
140
|
-
o.__proto__ = p;
|
|
141
|
-
return o;
|
|
142
|
-
};
|
|
143
|
-
return _setPrototypeOf(o, p);
|
|
144
|
-
}
|
|
145
|
-
function _slicedToArray$2(arr, i) {
|
|
146
|
-
return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray$3(arr, i) || _nonIterableRest$2();
|
|
147
|
-
}
|
|
148
|
-
function _toConsumableArray$2(arr) {
|
|
149
|
-
return _arrayWithoutHoles$2(arr) || _iterableToArray$2(arr) || _unsupportedIterableToArray$3(arr) || _nonIterableSpread$2();
|
|
150
|
-
}
|
|
151
|
-
function _arrayWithoutHoles$2(arr) {
|
|
152
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$3(arr);
|
|
153
|
-
}
|
|
154
|
-
function _arrayWithHoles$2(arr) {
|
|
155
|
-
if (Array.isArray(arr)) return arr;
|
|
156
|
-
}
|
|
157
|
-
function _iterableToArray$2(iter) {
|
|
158
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
159
|
-
}
|
|
160
|
-
function _unsupportedIterableToArray$3(o, minLen) {
|
|
161
|
-
if (!o) return;
|
|
162
|
-
if (typeof o === "string") return _arrayLikeToArray$3(o, minLen);
|
|
163
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
164
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
165
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
166
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen);
|
|
167
|
-
}
|
|
168
|
-
function _arrayLikeToArray$3(arr, len) {
|
|
169
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
170
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
171
|
-
return arr2;
|
|
172
|
-
}
|
|
173
|
-
function _nonIterableSpread$2() {
|
|
174
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
175
|
-
}
|
|
176
|
-
function _nonIterableRest$2() {
|
|
177
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
178
161
|
}
|
|
179
162
|
|
|
180
163
|
var xhtml = "http://www.w3.org/1999/xhtml";
|
|
@@ -4313,13 +4296,13 @@
|
|
|
4313
4296
|
return amount;
|
|
4314
4297
|
},
|
|
4315
4298
|
In: function (amount) {
|
|
4316
|
-
return
|
|
4299
|
+
return amount;
|
|
4317
4300
|
},
|
|
4318
4301
|
Out: function (amount) {
|
|
4319
|
-
return
|
|
4302
|
+
return amount;
|
|
4320
4303
|
},
|
|
4321
4304
|
InOut: function (amount) {
|
|
4322
|
-
return
|
|
4305
|
+
return amount;
|
|
4323
4306
|
},
|
|
4324
4307
|
}),
|
|
4325
4308
|
Quadratic: Object.freeze({
|
|
@@ -4529,33 +4512,61 @@
|
|
|
4529
4512
|
*/
|
|
4530
4513
|
var Group = /** @class */ (function () {
|
|
4531
4514
|
function Group() {
|
|
4515
|
+
var tweens = [];
|
|
4516
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4517
|
+
tweens[_i] = arguments[_i];
|
|
4518
|
+
}
|
|
4532
4519
|
this._tweens = {};
|
|
4533
4520
|
this._tweensAddedDuringUpdate = {};
|
|
4521
|
+
this.add.apply(this, tweens);
|
|
4534
4522
|
}
|
|
4535
4523
|
Group.prototype.getAll = function () {
|
|
4536
4524
|
var _this = this;
|
|
4537
|
-
return Object.keys(this._tweens).map(function (tweenId) {
|
|
4538
|
-
return _this._tweens[tweenId];
|
|
4539
|
-
});
|
|
4525
|
+
return Object.keys(this._tweens).map(function (tweenId) { return _this._tweens[tweenId]; });
|
|
4540
4526
|
};
|
|
4541
4527
|
Group.prototype.removeAll = function () {
|
|
4542
4528
|
this._tweens = {};
|
|
4543
4529
|
};
|
|
4544
|
-
Group.prototype.add = function (
|
|
4545
|
-
|
|
4546
|
-
|
|
4530
|
+
Group.prototype.add = function () {
|
|
4531
|
+
var _a;
|
|
4532
|
+
var tweens = [];
|
|
4533
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4534
|
+
tweens[_i] = arguments[_i];
|
|
4535
|
+
}
|
|
4536
|
+
for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
|
|
4537
|
+
var tween = tweens_1[_b];
|
|
4538
|
+
// Remove from any other group first, a tween can only be in one group at a time.
|
|
4539
|
+
// @ts-expect-error library internal access
|
|
4540
|
+
(_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
|
|
4541
|
+
// @ts-expect-error library internal access
|
|
4542
|
+
tween._group = this;
|
|
4543
|
+
this._tweens[tween.getId()] = tween;
|
|
4544
|
+
this._tweensAddedDuringUpdate[tween.getId()] = tween;
|
|
4545
|
+
}
|
|
4547
4546
|
};
|
|
4548
|
-
Group.prototype.remove = function (
|
|
4549
|
-
|
|
4550
|
-
|
|
4547
|
+
Group.prototype.remove = function () {
|
|
4548
|
+
var tweens = [];
|
|
4549
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4550
|
+
tweens[_i] = arguments[_i];
|
|
4551
|
+
}
|
|
4552
|
+
for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
|
|
4553
|
+
var tween = tweens_2[_a];
|
|
4554
|
+
// @ts-expect-error library internal access
|
|
4555
|
+
tween._group = undefined;
|
|
4556
|
+
delete this._tweens[tween.getId()];
|
|
4557
|
+
delete this._tweensAddedDuringUpdate[tween.getId()];
|
|
4558
|
+
}
|
|
4559
|
+
};
|
|
4560
|
+
/** Return true if all tweens in the group are not paused or playing. */
|
|
4561
|
+
Group.prototype.allStopped = function () {
|
|
4562
|
+
return this.getAll().every(function (tween) { return !tween.isPlaying(); });
|
|
4551
4563
|
};
|
|
4552
4564
|
Group.prototype.update = function (time, preserve) {
|
|
4553
4565
|
if (time === void 0) { time = now(); }
|
|
4554
|
-
if (preserve === void 0) { preserve =
|
|
4566
|
+
if (preserve === void 0) { preserve = true; }
|
|
4555
4567
|
var tweenIds = Object.keys(this._tweens);
|
|
4556
|
-
if (tweenIds.length === 0)
|
|
4557
|
-
return
|
|
4558
|
-
}
|
|
4568
|
+
if (tweenIds.length === 0)
|
|
4569
|
+
return;
|
|
4559
4570
|
// Tweens are updated in "batches". If you add a new tween during an
|
|
4560
4571
|
// update, then the new tween will be updated in the next batch.
|
|
4561
4572
|
// If you remove a tween during an update, it may or may not be updated.
|
|
@@ -4566,13 +4577,11 @@
|
|
|
4566
4577
|
for (var i = 0; i < tweenIds.length; i++) {
|
|
4567
4578
|
var tween = this._tweens[tweenIds[i]];
|
|
4568
4579
|
var autoStart = !preserve;
|
|
4569
|
-
if (tween && tween.update(time, autoStart) === false && !preserve)
|
|
4570
|
-
|
|
4571
|
-
}
|
|
4580
|
+
if (tween && tween.update(time, autoStart) === false && !preserve)
|
|
4581
|
+
this.remove(tween);
|
|
4572
4582
|
}
|
|
4573
4583
|
tweenIds = Object.keys(this._tweensAddedDuringUpdate);
|
|
4574
4584
|
}
|
|
4575
|
-
return true;
|
|
4576
4585
|
};
|
|
4577
4586
|
return Group;
|
|
4578
4587
|
}());
|
|
@@ -4681,10 +4690,7 @@
|
|
|
4681
4690
|
* Thank you all, you're awesome!
|
|
4682
4691
|
*/
|
|
4683
4692
|
var Tween = /** @class */ (function () {
|
|
4684
|
-
function Tween(
|
|
4685
|
-
if (_group === void 0) { _group = mainGroup; }
|
|
4686
|
-
this._object = _object;
|
|
4687
|
-
this._group = _group;
|
|
4693
|
+
function Tween(object, group) {
|
|
4688
4694
|
this._isPaused = false;
|
|
4689
4695
|
this._pauseStart = 0;
|
|
4690
4696
|
this._valuesStart = {};
|
|
@@ -4709,6 +4715,16 @@
|
|
|
4709
4715
|
this._isChainStopped = false;
|
|
4710
4716
|
this._propertiesAreSetUp = false;
|
|
4711
4717
|
this._goToEnd = false;
|
|
4718
|
+
this._object = object;
|
|
4719
|
+
if (typeof group === 'object') {
|
|
4720
|
+
this._group = group;
|
|
4721
|
+
group.add(this);
|
|
4722
|
+
}
|
|
4723
|
+
// Use "true" to restore old behavior (will be removed in future release).
|
|
4724
|
+
else if (group === true) {
|
|
4725
|
+
this._group = mainGroup;
|
|
4726
|
+
mainGroup.add(this);
|
|
4727
|
+
}
|
|
4712
4728
|
}
|
|
4713
4729
|
Tween.prototype.getId = function () {
|
|
4714
4730
|
return this._id;
|
|
@@ -4747,8 +4763,6 @@
|
|
|
4747
4763
|
if (this._isPlaying) {
|
|
4748
4764
|
return this;
|
|
4749
4765
|
}
|
|
4750
|
-
// eslint-disable-next-line
|
|
4751
|
-
this._group && this._group.add(this);
|
|
4752
4766
|
this._repeat = this._initialRepeat;
|
|
4753
4767
|
if (this._reversed) {
|
|
4754
4768
|
// If we were reversed (f.e. using the yoyo feature) then we need to
|
|
@@ -4865,8 +4879,6 @@
|
|
|
4865
4879
|
if (!this._isPlaying) {
|
|
4866
4880
|
return this;
|
|
4867
4881
|
}
|
|
4868
|
-
// eslint-disable-next-line
|
|
4869
|
-
this._group && this._group.remove(this);
|
|
4870
4882
|
this._isPlaying = false;
|
|
4871
4883
|
this._isPaused = false;
|
|
4872
4884
|
if (this._onStopCallback) {
|
|
@@ -4876,7 +4888,7 @@
|
|
|
4876
4888
|
};
|
|
4877
4889
|
Tween.prototype.end = function () {
|
|
4878
4890
|
this._goToEnd = true;
|
|
4879
|
-
this.update(
|
|
4891
|
+
this.update(this._startTime + this._duration);
|
|
4880
4892
|
return this;
|
|
4881
4893
|
};
|
|
4882
4894
|
Tween.prototype.pause = function (time) {
|
|
@@ -4886,8 +4898,6 @@
|
|
|
4886
4898
|
}
|
|
4887
4899
|
this._isPaused = true;
|
|
4888
4900
|
this._pauseStart = time;
|
|
4889
|
-
// eslint-disable-next-line
|
|
4890
|
-
this._group && this._group.remove(this);
|
|
4891
4901
|
return this;
|
|
4892
4902
|
};
|
|
4893
4903
|
Tween.prototype.resume = function (time) {
|
|
@@ -4898,8 +4908,6 @@
|
|
|
4898
4908
|
this._isPaused = false;
|
|
4899
4909
|
this._startTime += time - this._pauseStart;
|
|
4900
4910
|
this._pauseStart = 0;
|
|
4901
|
-
// eslint-disable-next-line
|
|
4902
|
-
this._group && this._group.add(this);
|
|
4903
4911
|
return this;
|
|
4904
4912
|
};
|
|
4905
4913
|
Tween.prototype.stopChainedTweens = function () {
|
|
@@ -4909,8 +4917,19 @@
|
|
|
4909
4917
|
return this;
|
|
4910
4918
|
};
|
|
4911
4919
|
Tween.prototype.group = function (group) {
|
|
4912
|
-
if (group
|
|
4913
|
-
|
|
4920
|
+
if (!group) {
|
|
4921
|
+
console.warn('tween.group() without args has been removed, use group.add(tween) instead.');
|
|
4922
|
+
return this;
|
|
4923
|
+
}
|
|
4924
|
+
group.add(this);
|
|
4925
|
+
return this;
|
|
4926
|
+
};
|
|
4927
|
+
/**
|
|
4928
|
+
* Removes the tween from whichever group it is in.
|
|
4929
|
+
*/
|
|
4930
|
+
Tween.prototype.remove = function () {
|
|
4931
|
+
var _a;
|
|
4932
|
+
(_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
|
|
4914
4933
|
return this;
|
|
4915
4934
|
};
|
|
4916
4935
|
Tween.prototype.delay = function (amount) {
|
|
@@ -4980,21 +4999,24 @@
|
|
|
4980
4999
|
* @returns true if the tween is still playing after the update, false
|
|
4981
5000
|
* otherwise (calling update on a paused tween still returns true because
|
|
4982
5001
|
* it is still playing, just paused).
|
|
5002
|
+
*
|
|
5003
|
+
* @param autoStart - When true, calling update will implicitly call start()
|
|
5004
|
+
* as well. Note, if you stop() or end() the tween, but are still calling
|
|
5005
|
+
* update(), it will start again!
|
|
4983
5006
|
*/
|
|
4984
5007
|
Tween.prototype.update = function (time, autoStart) {
|
|
4985
5008
|
var _this = this;
|
|
4986
5009
|
var _a;
|
|
4987
5010
|
if (time === void 0) { time = now(); }
|
|
4988
|
-
if (autoStart === void 0) { autoStart =
|
|
5011
|
+
if (autoStart === void 0) { autoStart = Tween.autoStartOnUpdate; }
|
|
4989
5012
|
if (this._isPaused)
|
|
4990
5013
|
return true;
|
|
4991
5014
|
var property;
|
|
4992
|
-
var endTime = this._startTime + this._duration;
|
|
4993
5015
|
if (!this._goToEnd && !this._isPlaying) {
|
|
4994
|
-
if (time > endTime)
|
|
4995
|
-
return false;
|
|
4996
5016
|
if (autoStart)
|
|
4997
5017
|
this.start(time, true);
|
|
5018
|
+
else
|
|
5019
|
+
return false;
|
|
4998
5020
|
}
|
|
4999
5021
|
this._goToEnd = false;
|
|
5000
5022
|
if (time < this._startTime) {
|
|
@@ -5133,6 +5155,7 @@
|
|
|
5133
5155
|
}
|
|
5134
5156
|
this._valuesEnd[property] = tmp;
|
|
5135
5157
|
};
|
|
5158
|
+
Tween.autoStartOnUpdate = false;
|
|
5136
5159
|
return Tween;
|
|
5137
5160
|
}());
|
|
5138
5161
|
/**
|
|
@@ -5146,11 +5169,246 @@
|
|
|
5146
5169
|
// Modules and CommonJS, without build hacks, and so as not to break the
|
|
5147
5170
|
// existing API.
|
|
5148
5171
|
// https://github.com/rollup/rollup/issues/1961#issuecomment-423037881
|
|
5172
|
+
/**
|
|
5173
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
5174
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
5175
|
+
* group.
|
|
5176
|
+
*
|
|
5177
|
+
* Old code:
|
|
5178
|
+
*
|
|
5179
|
+
* ```js
|
|
5180
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
5181
|
+
*
|
|
5182
|
+
* //...
|
|
5183
|
+
*
|
|
5184
|
+
* const tween = new TWEEN.Tween(obj)
|
|
5185
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5186
|
+
*
|
|
5187
|
+
* //...
|
|
5188
|
+
*
|
|
5189
|
+
* requestAnimationFrame(function loop(time) {
|
|
5190
|
+
* TWEEN.update(time)
|
|
5191
|
+
* requestAnimationFrame(loop)
|
|
5192
|
+
* })
|
|
5193
|
+
* ```
|
|
5194
|
+
*
|
|
5195
|
+
* New code:
|
|
5196
|
+
*
|
|
5197
|
+
* ```js
|
|
5198
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
5199
|
+
*
|
|
5200
|
+
* //...
|
|
5201
|
+
*
|
|
5202
|
+
* const tween = new Tween(obj)
|
|
5203
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5204
|
+
*
|
|
5205
|
+
* //...
|
|
5206
|
+
*
|
|
5207
|
+
* const group = new Group()
|
|
5208
|
+
* group.add(tween)
|
|
5209
|
+
* group.add(tween2)
|
|
5210
|
+
*
|
|
5211
|
+
* //...
|
|
5212
|
+
*
|
|
5213
|
+
* requestAnimationFrame(function loop(time) {
|
|
5214
|
+
* group.update(time)
|
|
5215
|
+
* requestAnimationFrame(loop)
|
|
5216
|
+
* })
|
|
5217
|
+
* ```
|
|
5218
|
+
*/
|
|
5149
5219
|
TWEEN.getAll.bind(TWEEN);
|
|
5220
|
+
/**
|
|
5221
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
5222
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
5223
|
+
* group.
|
|
5224
|
+
*
|
|
5225
|
+
* Old code:
|
|
5226
|
+
*
|
|
5227
|
+
* ```js
|
|
5228
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
5229
|
+
*
|
|
5230
|
+
* //...
|
|
5231
|
+
*
|
|
5232
|
+
* const tween = new TWEEN.Tween(obj)
|
|
5233
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5234
|
+
*
|
|
5235
|
+
* //...
|
|
5236
|
+
*
|
|
5237
|
+
* requestAnimationFrame(function loop(time) {
|
|
5238
|
+
* TWEEN.update(time)
|
|
5239
|
+
* requestAnimationFrame(loop)
|
|
5240
|
+
* })
|
|
5241
|
+
* ```
|
|
5242
|
+
*
|
|
5243
|
+
* New code:
|
|
5244
|
+
*
|
|
5245
|
+
* ```js
|
|
5246
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
5247
|
+
*
|
|
5248
|
+
* //...
|
|
5249
|
+
*
|
|
5250
|
+
* const tween = new Tween(obj)
|
|
5251
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5252
|
+
*
|
|
5253
|
+
* //...
|
|
5254
|
+
*
|
|
5255
|
+
* const group = new Group()
|
|
5256
|
+
* group.add(tween)
|
|
5257
|
+
* group.add(tween2)
|
|
5258
|
+
*
|
|
5259
|
+
* //...
|
|
5260
|
+
*
|
|
5261
|
+
* requestAnimationFrame(function loop(time) {
|
|
5262
|
+
* group.update(time)
|
|
5263
|
+
* requestAnimationFrame(loop)
|
|
5264
|
+
* })
|
|
5265
|
+
* ```
|
|
5266
|
+
*/
|
|
5150
5267
|
TWEEN.removeAll.bind(TWEEN);
|
|
5268
|
+
/**
|
|
5269
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
5270
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
5271
|
+
* group.
|
|
5272
|
+
*
|
|
5273
|
+
* Old code:
|
|
5274
|
+
*
|
|
5275
|
+
* ```js
|
|
5276
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
5277
|
+
*
|
|
5278
|
+
* //...
|
|
5279
|
+
*
|
|
5280
|
+
* const tween = new TWEEN.Tween(obj)
|
|
5281
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5282
|
+
*
|
|
5283
|
+
* //...
|
|
5284
|
+
*
|
|
5285
|
+
* requestAnimationFrame(function loop(time) {
|
|
5286
|
+
* TWEEN.update(time)
|
|
5287
|
+
* requestAnimationFrame(loop)
|
|
5288
|
+
* })
|
|
5289
|
+
* ```
|
|
5290
|
+
*
|
|
5291
|
+
* New code:
|
|
5292
|
+
*
|
|
5293
|
+
* ```js
|
|
5294
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
5295
|
+
*
|
|
5296
|
+
* //...
|
|
5297
|
+
*
|
|
5298
|
+
* const tween = new Tween(obj)
|
|
5299
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5300
|
+
*
|
|
5301
|
+
* //...
|
|
5302
|
+
*
|
|
5303
|
+
* const group = new Group()
|
|
5304
|
+
* group.add(tween)
|
|
5305
|
+
* group.add(tween2)
|
|
5306
|
+
*
|
|
5307
|
+
* //...
|
|
5308
|
+
*
|
|
5309
|
+
* requestAnimationFrame(function loop(time) {
|
|
5310
|
+
* group.update(time)
|
|
5311
|
+
* requestAnimationFrame(loop)
|
|
5312
|
+
* })
|
|
5313
|
+
* ```
|
|
5314
|
+
*/
|
|
5151
5315
|
TWEEN.add.bind(TWEEN);
|
|
5316
|
+
/**
|
|
5317
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
5318
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
5319
|
+
* group.
|
|
5320
|
+
*
|
|
5321
|
+
* Old code:
|
|
5322
|
+
*
|
|
5323
|
+
* ```js
|
|
5324
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
5325
|
+
*
|
|
5326
|
+
* //...
|
|
5327
|
+
*
|
|
5328
|
+
* const tween = new TWEEN.Tween(obj)
|
|
5329
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5330
|
+
*
|
|
5331
|
+
* //...
|
|
5332
|
+
*
|
|
5333
|
+
* requestAnimationFrame(function loop(time) {
|
|
5334
|
+
* TWEEN.update(time)
|
|
5335
|
+
* requestAnimationFrame(loop)
|
|
5336
|
+
* })
|
|
5337
|
+
* ```
|
|
5338
|
+
*
|
|
5339
|
+
* New code:
|
|
5340
|
+
*
|
|
5341
|
+
* ```js
|
|
5342
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
5343
|
+
*
|
|
5344
|
+
* //...
|
|
5345
|
+
*
|
|
5346
|
+
* const tween = new Tween(obj)
|
|
5347
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5348
|
+
*
|
|
5349
|
+
* //...
|
|
5350
|
+
*
|
|
5351
|
+
* const group = new Group()
|
|
5352
|
+
* group.add(tween)
|
|
5353
|
+
* group.add(tween2)
|
|
5354
|
+
*
|
|
5355
|
+
* //...
|
|
5356
|
+
*
|
|
5357
|
+
* requestAnimationFrame(function loop(time) {
|
|
5358
|
+
* group.update(time)
|
|
5359
|
+
* requestAnimationFrame(loop)
|
|
5360
|
+
* })
|
|
5361
|
+
* ```
|
|
5362
|
+
*/
|
|
5152
5363
|
TWEEN.remove.bind(TWEEN);
|
|
5153
|
-
|
|
5364
|
+
/**
|
|
5365
|
+
* @deprecated The global TWEEN Group will be removed in a following major
|
|
5366
|
+
* release. To migrate, create a `new Group()` instead of using `TWEEN` as a
|
|
5367
|
+
* group.
|
|
5368
|
+
*
|
|
5369
|
+
* Old code:
|
|
5370
|
+
*
|
|
5371
|
+
* ```js
|
|
5372
|
+
* import * as TWEEN from '@tweenjs/tween.js'
|
|
5373
|
+
*
|
|
5374
|
+
* //...
|
|
5375
|
+
*
|
|
5376
|
+
* const tween = new TWEEN.Tween(obj)
|
|
5377
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5378
|
+
*
|
|
5379
|
+
* //...
|
|
5380
|
+
*
|
|
5381
|
+
* requestAnimationFrame(function loop(time) {
|
|
5382
|
+
* TWEEN.update(time)
|
|
5383
|
+
* requestAnimationFrame(loop)
|
|
5384
|
+
* })
|
|
5385
|
+
* ```
|
|
5386
|
+
*
|
|
5387
|
+
* New code:
|
|
5388
|
+
*
|
|
5389
|
+
* ```js
|
|
5390
|
+
* import {Tween, Group} from '@tweenjs/tween.js'
|
|
5391
|
+
*
|
|
5392
|
+
* //...
|
|
5393
|
+
*
|
|
5394
|
+
* const tween = new Tween(obj)
|
|
5395
|
+
* const tween2 = new TWEEN.Tween(obj2)
|
|
5396
|
+
*
|
|
5397
|
+
* //...
|
|
5398
|
+
*
|
|
5399
|
+
* const group = new Group()
|
|
5400
|
+
* group.add(tween)
|
|
5401
|
+
* group.add(tween2)
|
|
5402
|
+
*
|
|
5403
|
+
* //...
|
|
5404
|
+
*
|
|
5405
|
+
* requestAnimationFrame(function loop(time) {
|
|
5406
|
+
* group.update(time)
|
|
5407
|
+
* requestAnimationFrame(loop)
|
|
5408
|
+
* })
|
|
5409
|
+
* ```
|
|
5410
|
+
*/
|
|
5411
|
+
TWEEN.update.bind(TWEEN);
|
|
5154
5412
|
|
|
5155
5413
|
function _iterableToArrayLimit$1(r, l) {
|
|
5156
5414
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
@@ -5163,10 +5421,7 @@
|
|
|
5163
5421
|
f = !0,
|
|
5164
5422
|
o = !1;
|
|
5165
5423
|
try {
|
|
5166
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
5167
|
-
if (Object(t) !== t) return;
|
|
5168
|
-
f = !1;
|
|
5169
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
5424
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
5170
5425
|
} catch (r) {
|
|
5171
5426
|
o = !0, n = r;
|
|
5172
5427
|
} finally {
|
|
@@ -5184,18 +5439,7 @@
|
|
|
5184
5439
|
throw new TypeError("Cannot call a class as a function");
|
|
5185
5440
|
}
|
|
5186
5441
|
}
|
|
5187
|
-
function _defineProperties$1(target, props) {
|
|
5188
|
-
for (var i = 0; i < props.length; i++) {
|
|
5189
|
-
var descriptor = props[i];
|
|
5190
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
5191
|
-
descriptor.configurable = true;
|
|
5192
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
5193
|
-
Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
|
|
5194
|
-
}
|
|
5195
|
-
}
|
|
5196
5442
|
function _createClass$1(Constructor, protoProps, staticProps) {
|
|
5197
|
-
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
5198
|
-
if (staticProps) _defineProperties$1(Constructor, staticProps);
|
|
5199
5443
|
Object.defineProperty(Constructor, "prototype", {
|
|
5200
5444
|
writable: false
|
|
5201
5445
|
});
|
|
@@ -5223,20 +5467,6 @@
|
|
|
5223
5467
|
function _nonIterableRest$1() {
|
|
5224
5468
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5225
5469
|
}
|
|
5226
|
-
function _toPrimitive$2(input, hint) {
|
|
5227
|
-
if (typeof input !== "object" || input === null) return input;
|
|
5228
|
-
var prim = input[Symbol.toPrimitive];
|
|
5229
|
-
if (prim !== undefined) {
|
|
5230
|
-
var res = prim.call(input, hint || "default");
|
|
5231
|
-
if (typeof res !== "object") return res;
|
|
5232
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
5233
|
-
}
|
|
5234
|
-
return (hint === "string" ? String : Number)(input);
|
|
5235
|
-
}
|
|
5236
|
-
function _toPropertyKey$2(arg) {
|
|
5237
|
-
var key = _toPrimitive$2(arg, "string");
|
|
5238
|
-
return typeof key === "symbol" ? key : String(key);
|
|
5239
|
-
}
|
|
5240
5470
|
|
|
5241
5471
|
var Prop = /*#__PURE__*/_createClass$1(function Prop(name, _ref) {
|
|
5242
5472
|
var _ref$default = _ref["default"],
|
|
@@ -6556,66 +6786,73 @@
|
|
|
6556
6786
|
};
|
|
6557
6787
|
}
|
|
6558
6788
|
|
|
6559
|
-
function
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6789
|
+
function _arrayLikeToArray$1(r, a) {
|
|
6790
|
+
(null == a || a > r.length) && (a = r.length);
|
|
6791
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6792
|
+
return n;
|
|
6563
6793
|
}
|
|
6564
|
-
function
|
|
6565
|
-
|
|
6566
|
-
var descriptor = props[i];
|
|
6567
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
6568
|
-
descriptor.configurable = true;
|
|
6569
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
6570
|
-
Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
|
|
6571
|
-
}
|
|
6794
|
+
function _arrayWithoutHoles$1(r) {
|
|
6795
|
+
if (Array.isArray(r)) return _arrayLikeToArray$1(r);
|
|
6572
6796
|
}
|
|
6573
|
-
function
|
|
6574
|
-
if (
|
|
6575
|
-
|
|
6576
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
6577
|
-
writable: false
|
|
6578
|
-
});
|
|
6579
|
-
return Constructor;
|
|
6797
|
+
function _assertClassBrand(e, t, n) {
|
|
6798
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
6799
|
+
throw new TypeError("Private element is not present on this object");
|
|
6580
6800
|
}
|
|
6581
|
-
function
|
|
6582
|
-
|
|
6801
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
6802
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
6583
6803
|
}
|
|
6584
|
-
function
|
|
6585
|
-
if (
|
|
6804
|
+
function _classCallCheck(a, n) {
|
|
6805
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
6586
6806
|
}
|
|
6587
|
-
function
|
|
6588
|
-
|
|
6807
|
+
function _classPrivateFieldGet2(s, a) {
|
|
6808
|
+
return s.get(_assertClassBrand(s, a));
|
|
6589
6809
|
}
|
|
6590
|
-
function
|
|
6591
|
-
|
|
6592
|
-
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
6593
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
6594
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
6595
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
6596
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
6810
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
6811
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
6597
6812
|
}
|
|
6598
|
-
function
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6813
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
6814
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
6815
|
+
}
|
|
6816
|
+
function _defineProperties(e, r) {
|
|
6817
|
+
for (var t = 0; t < r.length; t++) {
|
|
6818
|
+
var o = r[t];
|
|
6819
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey$1(o.key), o);
|
|
6820
|
+
}
|
|
6821
|
+
}
|
|
6822
|
+
function _createClass(e, r, t) {
|
|
6823
|
+
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
6824
|
+
writable: !1
|
|
6825
|
+
}), e;
|
|
6826
|
+
}
|
|
6827
|
+
function _iterableToArray$1(r) {
|
|
6828
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
6602
6829
|
}
|
|
6603
6830
|
function _nonIterableSpread$1() {
|
|
6604
6831
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
6605
6832
|
}
|
|
6606
|
-
function
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6833
|
+
function _toConsumableArray$1(r) {
|
|
6834
|
+
return _arrayWithoutHoles$1(r) || _iterableToArray$1(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread$1();
|
|
6835
|
+
}
|
|
6836
|
+
function _toPrimitive$1(t, r) {
|
|
6837
|
+
if ("object" != typeof t || !t) return t;
|
|
6838
|
+
var e = t[Symbol.toPrimitive];
|
|
6839
|
+
if (void 0 !== e) {
|
|
6840
|
+
var i = e.call(t, r);
|
|
6841
|
+
if ("object" != typeof i) return i;
|
|
6612
6842
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
6613
6843
|
}
|
|
6614
|
-
return (
|
|
6844
|
+
return (String )(t);
|
|
6615
6845
|
}
|
|
6616
|
-
function _toPropertyKey$1(
|
|
6617
|
-
var
|
|
6618
|
-
return
|
|
6846
|
+
function _toPropertyKey$1(t) {
|
|
6847
|
+
var i = _toPrimitive$1(t, "string");
|
|
6848
|
+
return "symbol" == typeof i ? i : i + "";
|
|
6849
|
+
}
|
|
6850
|
+
function _unsupportedIterableToArray$1(r, a) {
|
|
6851
|
+
if (r) {
|
|
6852
|
+
if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
|
|
6853
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
6854
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
|
|
6855
|
+
}
|
|
6619
6856
|
}
|
|
6620
6857
|
|
|
6621
6858
|
var ENTROPY = 123; // Raise numbers to prevent collisions in lower indexes
|
|
@@ -6636,42 +6873,53 @@
|
|
|
6636
6873
|
var checksum = function checksum(n, csBits) {
|
|
6637
6874
|
return n * ENTROPY % Math.pow(2, csBits);
|
|
6638
6875
|
};
|
|
6876
|
+
var _registry = /*#__PURE__*/new WeakMap();
|
|
6877
|
+
var _csBits = /*#__PURE__*/new WeakMap();
|
|
6639
6878
|
var _default = /*#__PURE__*/function () {
|
|
6640
6879
|
function _default() {
|
|
6641
6880
|
var csBits = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
|
|
6642
6881
|
_classCallCheck(this, _default);
|
|
6643
|
-
|
|
6644
|
-
this
|
|
6645
|
-
|
|
6646
|
-
|
|
6882
|
+
// Internal state
|
|
6883
|
+
_classPrivateFieldInitSpec(this, _registry, void 0);
|
|
6884
|
+
// indexed objects for rgb lookup;
|
|
6885
|
+
_classPrivateFieldInitSpec(this, _csBits, void 0);
|
|
6886
|
+
_classPrivateFieldSet2(_csBits, this, csBits);
|
|
6887
|
+
this.reset();
|
|
6888
|
+
}
|
|
6889
|
+
return _createClass(_default, [{
|
|
6890
|
+
key: "reset",
|
|
6891
|
+
value: function reset() {
|
|
6892
|
+
_classPrivateFieldSet2(_registry, this, ['__reserved for background__']);
|
|
6893
|
+
}
|
|
6894
|
+
}, {
|
|
6647
6895
|
key: "register",
|
|
6648
6896
|
value: function register(obj) {
|
|
6649
|
-
if (this.
|
|
6897
|
+
if (_classPrivateFieldGet2(_registry, this).length >= Math.pow(2, 24 - _classPrivateFieldGet2(_csBits, this))) {
|
|
6650
6898
|
// color has 24 bits (-checksum)
|
|
6651
6899
|
return null; // Registry is full
|
|
6652
6900
|
}
|
|
6653
|
-
|
|
6654
|
-
var
|
|
6655
|
-
var
|
|
6656
|
-
|
|
6657
|
-
this.registry.push(obj);
|
|
6901
|
+
var idx = _classPrivateFieldGet2(_registry, this).length;
|
|
6902
|
+
var cs = checksum(idx, _classPrivateFieldGet2(_csBits, this));
|
|
6903
|
+
var color = int2HexColor(idx + (cs << 24 - _classPrivateFieldGet2(_csBits, this)));
|
|
6904
|
+
_classPrivateFieldGet2(_registry, this).push(obj);
|
|
6658
6905
|
return color;
|
|
6659
6906
|
}
|
|
6660
6907
|
}, {
|
|
6661
6908
|
key: "lookup",
|
|
6662
6909
|
value: function lookup(color) {
|
|
6910
|
+
if (!color) return null; // invalid color
|
|
6911
|
+
|
|
6663
6912
|
var n = typeof color === 'string' ? colorStr2Int(color) : rgb2Int.apply(void 0, _toConsumableArray$1(color));
|
|
6664
6913
|
if (!n) return null; // 0 index is reserved for background
|
|
6665
6914
|
|
|
6666
|
-
var idx = n & Math.pow(2, 24 - this
|
|
6667
|
-
var cs = n >> 24 - this
|
|
6915
|
+
var idx = n & Math.pow(2, 24 - _classPrivateFieldGet2(_csBits, this)) - 1; // registry index
|
|
6916
|
+
var cs = n >> 24 - _classPrivateFieldGet2(_csBits, this) & Math.pow(2, _classPrivateFieldGet2(_csBits, this)) - 1; // extract bits reserved for checksum
|
|
6668
6917
|
|
|
6669
|
-
if (checksum(idx, this
|
|
6918
|
+
if (checksum(idx, _classPrivateFieldGet2(_csBits, this)) !== cs || idx >= _classPrivateFieldGet2(_registry, this).length) return null; // failed checksum or registry out of bounds
|
|
6670
6919
|
|
|
6671
|
-
return this
|
|
6672
|
-
}
|
|
6920
|
+
return _classPrivateFieldGet2(_registry, this)[idx];
|
|
6921
|
+
} // How many bits to reserve for checksum. Will eat away into the usable size of the registry.
|
|
6673
6922
|
}]);
|
|
6674
|
-
return _default;
|
|
6675
6923
|
}();
|
|
6676
6924
|
|
|
6677
6925
|
function d3ForceCenter(x, y, z) {
|
|
@@ -10463,107 +10711,96 @@
|
|
|
10463
10711
|
}
|
|
10464
10712
|
}
|
|
10465
10713
|
|
|
10466
|
-
function
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10714
|
+
function _arrayLikeToArray(r, a) {
|
|
10715
|
+
(null == a || a > r.length) && (a = r.length);
|
|
10716
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10717
|
+
return n;
|
|
10718
|
+
}
|
|
10719
|
+
function _arrayWithHoles(r) {
|
|
10720
|
+
if (Array.isArray(r)) return r;
|
|
10721
|
+
}
|
|
10722
|
+
function _arrayWithoutHoles(r) {
|
|
10723
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
10724
|
+
}
|
|
10725
|
+
function _iterableToArray(r) {
|
|
10726
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
10727
|
+
}
|
|
10728
|
+
function _iterableToArrayLimit(r, l) {
|
|
10729
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10730
|
+
if (null != t) {
|
|
10731
|
+
var e,
|
|
10732
|
+
n,
|
|
10733
|
+
i,
|
|
10734
|
+
u,
|
|
10735
|
+
a = [],
|
|
10736
|
+
f = !0,
|
|
10737
|
+
o = !1;
|
|
10476
10738
|
try {
|
|
10477
|
-
if (
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
10481
|
-
} catch (err) {
|
|
10482
|
-
_d = !0, _e = err;
|
|
10739
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
10740
|
+
} catch (r) {
|
|
10741
|
+
o = !0, n = r;
|
|
10483
10742
|
} finally {
|
|
10484
10743
|
try {
|
|
10485
|
-
if (!
|
|
10744
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
10486
10745
|
} finally {
|
|
10487
|
-
if (
|
|
10746
|
+
if (o) throw n;
|
|
10488
10747
|
}
|
|
10489
10748
|
}
|
|
10490
|
-
return
|
|
10749
|
+
return a;
|
|
10491
10750
|
}
|
|
10492
10751
|
}
|
|
10493
|
-
function
|
|
10494
|
-
|
|
10495
|
-
|
|
10496
|
-
|
|
10497
|
-
|
|
10498
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
10499
|
-
key = sourceKeys[i];
|
|
10500
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
10501
|
-
target[key] = source[key];
|
|
10502
|
-
}
|
|
10503
|
-
return target;
|
|
10752
|
+
function _nonIterableRest() {
|
|
10753
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10754
|
+
}
|
|
10755
|
+
function _nonIterableSpread() {
|
|
10756
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10504
10757
|
}
|
|
10505
|
-
function _objectWithoutProperties(
|
|
10506
|
-
if (
|
|
10507
|
-
var
|
|
10508
|
-
|
|
10758
|
+
function _objectWithoutProperties(e, t) {
|
|
10759
|
+
if (null == e) return {};
|
|
10760
|
+
var o,
|
|
10761
|
+
r,
|
|
10762
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
10509
10763
|
if (Object.getOwnPropertySymbols) {
|
|
10510
|
-
var
|
|
10511
|
-
for (
|
|
10512
|
-
key = sourceSymbolKeys[i];
|
|
10513
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
10514
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
10515
|
-
target[key] = source[key];
|
|
10516
|
-
}
|
|
10764
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
10765
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
10517
10766
|
}
|
|
10518
|
-
return
|
|
10519
|
-
}
|
|
10520
|
-
function _slicedToArray(arr, i) {
|
|
10521
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
10522
|
-
}
|
|
10523
|
-
function _toConsumableArray(arr) {
|
|
10524
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
10525
|
-
}
|
|
10526
|
-
function _arrayWithoutHoles(arr) {
|
|
10527
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
10528
|
-
}
|
|
10529
|
-
function _arrayWithHoles(arr) {
|
|
10530
|
-
if (Array.isArray(arr)) return arr;
|
|
10767
|
+
return i;
|
|
10531
10768
|
}
|
|
10532
|
-
function
|
|
10533
|
-
if (
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10539
|
-
|
|
10540
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10541
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
10542
|
-
}
|
|
10543
|
-
function _arrayLikeToArray(arr, len) {
|
|
10544
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
10545
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10546
|
-
return arr2;
|
|
10769
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
10770
|
+
if (null == r) return {};
|
|
10771
|
+
var t = {};
|
|
10772
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
10773
|
+
if (e.includes(n)) continue;
|
|
10774
|
+
t[n] = r[n];
|
|
10775
|
+
}
|
|
10776
|
+
return t;
|
|
10547
10777
|
}
|
|
10548
|
-
function
|
|
10549
|
-
|
|
10778
|
+
function _slicedToArray(r, e) {
|
|
10779
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
10550
10780
|
}
|
|
10551
|
-
function
|
|
10552
|
-
|
|
10781
|
+
function _toConsumableArray(r) {
|
|
10782
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
10553
10783
|
}
|
|
10554
|
-
function _toPrimitive(
|
|
10555
|
-
if (
|
|
10556
|
-
var
|
|
10557
|
-
if (
|
|
10558
|
-
var
|
|
10559
|
-
if (
|
|
10784
|
+
function _toPrimitive(t, r) {
|
|
10785
|
+
if ("object" != typeof t || !t) return t;
|
|
10786
|
+
var e = t[Symbol.toPrimitive];
|
|
10787
|
+
if (void 0 !== e) {
|
|
10788
|
+
var i = e.call(t, r );
|
|
10789
|
+
if ("object" != typeof i) return i;
|
|
10560
10790
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10561
10791
|
}
|
|
10562
|
-
return (
|
|
10792
|
+
return (String )(t);
|
|
10563
10793
|
}
|
|
10564
|
-
function _toPropertyKey(
|
|
10565
|
-
var
|
|
10566
|
-
return
|
|
10794
|
+
function _toPropertyKey(t) {
|
|
10795
|
+
var i = _toPrimitive(t, "string");
|
|
10796
|
+
return "symbol" == typeof i ? i : i + "";
|
|
10797
|
+
}
|
|
10798
|
+
function _unsupportedIterableToArray(r, a) {
|
|
10799
|
+
if (r) {
|
|
10800
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
10801
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
10802
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
10803
|
+
}
|
|
10567
10804
|
}
|
|
10568
10805
|
|
|
10569
10806
|
var index = (function () {
|
|
@@ -10627,7 +10864,6 @@
|
|
|
10627
10864
|
}
|
|
10628
10865
|
})(indexedResult); // IIFE
|
|
10629
10866
|
}
|
|
10630
|
-
|
|
10631
10867
|
var result = indexedResult;
|
|
10632
10868
|
if (flattenKeys) {
|
|
10633
10869
|
// flatten into array
|
|
@@ -11567,6 +11803,12 @@
|
|
|
11567
11803
|
links: []
|
|
11568
11804
|
},
|
|
11569
11805
|
onChange: function onChange(d, state) {
|
|
11806
|
+
// Wipe color registry if all objects are new
|
|
11807
|
+
[d.nodes, d.links].every(function (arr) {
|
|
11808
|
+
return (arr || []).every(function (d) {
|
|
11809
|
+
return !d.hasOwnProperty('__indexColor');
|
|
11810
|
+
});
|
|
11811
|
+
}) && state.colorTracker.reset();
|
|
11570
11812
|
[{
|
|
11571
11813
|
type: 'Node',
|
|
11572
11814
|
objs: d.nodes
|
|
@@ -11750,7 +11992,7 @@
|
|
|
11750
11992
|
// no animation
|
|
11751
11993
|
setCenter(finalPos);
|
|
11752
11994
|
} else {
|
|
11753
|
-
new Tween(getCenter()).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCenter).start();
|
|
11995
|
+
state.tweenGroup.add(new Tween(getCenter()).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCenter).start());
|
|
11754
11996
|
}
|
|
11755
11997
|
return this;
|
|
11756
11998
|
}
|
|
@@ -11783,14 +12025,14 @@
|
|
|
11783
12025
|
// no animation
|
|
11784
12026
|
setZoom(k);
|
|
11785
12027
|
} else {
|
|
11786
|
-
new Tween({
|
|
12028
|
+
state.tweenGroup.add(new Tween({
|
|
11787
12029
|
k: getZoom()
|
|
11788
12030
|
}).to({
|
|
11789
12031
|
k: k
|
|
11790
12032
|
}, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(function (_ref6) {
|
|
11791
12033
|
var k = _ref6.k;
|
|
11792
12034
|
return setZoom(k);
|
|
11793
|
-
}).start();
|
|
12035
|
+
}).start());
|
|
11794
12036
|
}
|
|
11795
12037
|
return this;
|
|
11796
12038
|
}
|
|
@@ -11881,7 +12123,9 @@
|
|
|
11881
12123
|
zoom: d3Zoom(),
|
|
11882
12124
|
forceGraph: new CanvasForceGraph(),
|
|
11883
12125
|
shadowGraph: new CanvasForceGraph().cooldownTicks(0).nodeColor('__indexColor').linkColor('__indexColor').isShadow(true),
|
|
11884
|
-
colorTracker: new _default()
|
|
12126
|
+
colorTracker: new _default(),
|
|
12127
|
+
// indexed objects for rgb lookup
|
|
12128
|
+
tweenGroup: new Group()
|
|
11885
12129
|
};
|
|
11886
12130
|
},
|
|
11887
12131
|
init: function init(domNode, state) {
|
|
@@ -12181,7 +12425,7 @@
|
|
|
12181
12425
|
state.forceGraph.globalScale(globalScale).tickFrame();
|
|
12182
12426
|
state.onRenderFramePost && state.onRenderFramePost(ctx, globalScale);
|
|
12183
12427
|
}
|
|
12184
|
-
update(); // update canvas animation tweens
|
|
12428
|
+
state.tweenGroup.update(); // update canvas animation tweens
|
|
12185
12429
|
|
|
12186
12430
|
state.animationFrameRequestId = requestAnimationFrame(animate);
|
|
12187
12431
|
})();
|