@antv/g-lite 2.3.2 → 2.3.3-beta.1
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/index.esm.js +37 -582
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -582
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +10 -10
- package/dist/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/types/css/cssom/CSSMathOperator.d.ts +12 -0
- package/types/css/cssom/CSSMathOperator.d.ts.map +1 -0
- package/types/css/cssom/CSSNumericSumValue.d.ts +8 -0
- package/types/css/cssom/CSSNumericSumValue.d.ts.map +1 -0
- package/types/css/interfaces.d.ts +1 -0
- package/types/css/interfaces.d.ts.map +1 -1
- package/types/css/properties/CSSPropertyLocalPosition.d.ts +14 -0
- package/types/css/properties/CSSPropertyLocalPosition.d.ts.map +1 -0
- package/types/css/properties/CSSPropertyTextDecorationThickness.d.ts +8 -0
- package/types/css/properties/CSSPropertyTextDecorationThickness.d.ts.map +1 -0
- package/types/display-objects/DisplayObject.d.ts +8 -0
- package/types/display-objects/DisplayObject.d.ts.map +1 -1
- package/types/dom/MutationObserver.d.ts +19 -0
- package/types/dom/MutationObserver.d.ts.map +1 -0
- package/types/plugins/MutationObserver.d.ts +49 -0
- package/types/plugins/MutationObserver.d.ts.map +1 -0
- package/types/utils/string.d.ts +6 -0
- package/types/utils/string.d.ts.map +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* @antv/g-lite
|
|
3
3
|
* @description A core module for rendering engine implements DOM API.
|
|
4
4
|
* @version 2.3.2
|
|
5
|
-
* @date
|
|
5
|
+
* @date 2025/12/3 13:57:52
|
|
6
6
|
* @author AntVis
|
|
7
7
|
* @docs https://g.antv.antgroup.com/
|
|
8
8
|
*/
|
|
9
|
+
import RBush from 'rbush/rbush.js';
|
|
10
|
+
export { default as RBush } from 'rbush/rbush.js';
|
|
9
11
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
10
12
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
11
13
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
@@ -25,586 +27,6 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
25
27
|
import _createForOfIteratorHelper from '@babel/runtime/helpers/createForOfIteratorHelper';
|
|
26
28
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
27
29
|
|
|
28
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
29
|
-
|
|
30
|
-
var rbush = {exports: {}};
|
|
31
|
-
|
|
32
|
-
(function (module, exports) {
|
|
33
|
-
(function (global, factory) {
|
|
34
|
-
module.exports = factory() ;
|
|
35
|
-
}(commonjsGlobal, function () {
|
|
36
|
-
function quickselect(arr, k, left, right, compare) {
|
|
37
|
-
quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function quickselectStep(arr, k, left, right, compare) {
|
|
41
|
-
|
|
42
|
-
while (right > left) {
|
|
43
|
-
if (right - left > 600) {
|
|
44
|
-
var n = right - left + 1;
|
|
45
|
-
var m = k - left + 1;
|
|
46
|
-
var z = Math.log(n);
|
|
47
|
-
var s = 0.5 * Math.exp(2 * z / 3);
|
|
48
|
-
var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
|
|
49
|
-
var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
|
|
50
|
-
var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
|
|
51
|
-
quickselectStep(arr, k, newLeft, newRight, compare);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
var t = arr[k];
|
|
55
|
-
var i = left;
|
|
56
|
-
var j = right;
|
|
57
|
-
|
|
58
|
-
swap(arr, left, k);
|
|
59
|
-
if (compare(arr[right], t) > 0) { swap(arr, left, right); }
|
|
60
|
-
|
|
61
|
-
while (i < j) {
|
|
62
|
-
swap(arr, i, j);
|
|
63
|
-
i++;
|
|
64
|
-
j--;
|
|
65
|
-
while (compare(arr[i], t) < 0) { i++; }
|
|
66
|
-
while (compare(arr[j], t) > 0) { j--; }
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (compare(arr[left], t) === 0) { swap(arr, left, j); }
|
|
70
|
-
else {
|
|
71
|
-
j++;
|
|
72
|
-
swap(arr, j, right);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (j <= k) { left = j + 1; }
|
|
76
|
-
if (k <= j) { right = j - 1; }
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function swap(arr, i, j) {
|
|
81
|
-
var tmp = arr[i];
|
|
82
|
-
arr[i] = arr[j];
|
|
83
|
-
arr[j] = tmp;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function defaultCompare(a, b) {
|
|
87
|
-
return a < b ? -1 : a > b ? 1 : 0;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var RBush = function RBush(maxEntries) {
|
|
91
|
-
if ( maxEntries === void 0 ) maxEntries = 9;
|
|
92
|
-
|
|
93
|
-
// max entries in a node is 9 by default; min node fill is 40% for best performance
|
|
94
|
-
this._maxEntries = Math.max(4, maxEntries);
|
|
95
|
-
this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
|
|
96
|
-
this.clear();
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
RBush.prototype.all = function all () {
|
|
100
|
-
return this._all(this.data, []);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
RBush.prototype.search = function search (bbox) {
|
|
104
|
-
var node = this.data;
|
|
105
|
-
var result = [];
|
|
106
|
-
|
|
107
|
-
if (!intersects(bbox, node)) { return result; }
|
|
108
|
-
|
|
109
|
-
var toBBox = this.toBBox;
|
|
110
|
-
var nodesToSearch = [];
|
|
111
|
-
|
|
112
|
-
while (node) {
|
|
113
|
-
for (var i = 0; i < node.children.length; i++) {
|
|
114
|
-
var child = node.children[i];
|
|
115
|
-
var childBBox = node.leaf ? toBBox(child) : child;
|
|
116
|
-
|
|
117
|
-
if (intersects(bbox, childBBox)) {
|
|
118
|
-
if (node.leaf) { result.push(child); }
|
|
119
|
-
else if (contains(bbox, childBBox)) { this._all(child, result); }
|
|
120
|
-
else { nodesToSearch.push(child); }
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
node = nodesToSearch.pop();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return result;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
RBush.prototype.collides = function collides (bbox) {
|
|
130
|
-
var node = this.data;
|
|
131
|
-
|
|
132
|
-
if (!intersects(bbox, node)) { return false; }
|
|
133
|
-
|
|
134
|
-
var nodesToSearch = [];
|
|
135
|
-
while (node) {
|
|
136
|
-
for (var i = 0; i < node.children.length; i++) {
|
|
137
|
-
var child = node.children[i];
|
|
138
|
-
var childBBox = node.leaf ? this.toBBox(child) : child;
|
|
139
|
-
|
|
140
|
-
if (intersects(bbox, childBBox)) {
|
|
141
|
-
if (node.leaf || contains(bbox, childBBox)) { return true; }
|
|
142
|
-
nodesToSearch.push(child);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
node = nodesToSearch.pop();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return false;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
RBush.prototype.load = function load (data) {
|
|
152
|
-
if (!(data && data.length)) { return this; }
|
|
153
|
-
|
|
154
|
-
if (data.length < this._minEntries) {
|
|
155
|
-
for (var i = 0; i < data.length; i++) {
|
|
156
|
-
this.insert(data[i]);
|
|
157
|
-
}
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// recursively build the tree with the given data from scratch using OMT algorithm
|
|
162
|
-
var node = this._build(data.slice(), 0, data.length - 1, 0);
|
|
163
|
-
|
|
164
|
-
if (!this.data.children.length) {
|
|
165
|
-
// save as is if tree is empty
|
|
166
|
-
this.data = node;
|
|
167
|
-
|
|
168
|
-
} else if (this.data.height === node.height) {
|
|
169
|
-
// split root if trees have the same height
|
|
170
|
-
this._splitRoot(this.data, node);
|
|
171
|
-
|
|
172
|
-
} else {
|
|
173
|
-
if (this.data.height < node.height) {
|
|
174
|
-
// swap trees if inserted one is bigger
|
|
175
|
-
var tmpNode = this.data;
|
|
176
|
-
this.data = node;
|
|
177
|
-
node = tmpNode;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// insert the small tree into the large tree at appropriate level
|
|
181
|
-
this._insert(node, this.data.height - node.height - 1, true);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
return this;
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
RBush.prototype.insert = function insert (item) {
|
|
188
|
-
if (item) { this._insert(item, this.data.height - 1); }
|
|
189
|
-
return this;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
RBush.prototype.clear = function clear () {
|
|
193
|
-
this.data = createNode([]);
|
|
194
|
-
return this;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
RBush.prototype.remove = function remove (item, equalsFn) {
|
|
198
|
-
if (!item) { return this; }
|
|
199
|
-
|
|
200
|
-
var node = this.data;
|
|
201
|
-
var bbox = this.toBBox(item);
|
|
202
|
-
var path = [];
|
|
203
|
-
var indexes = [];
|
|
204
|
-
var i, parent, goingUp;
|
|
205
|
-
|
|
206
|
-
// depth-first iterative tree traversal
|
|
207
|
-
while (node || path.length) {
|
|
208
|
-
|
|
209
|
-
if (!node) { // go up
|
|
210
|
-
node = path.pop();
|
|
211
|
-
parent = path[path.length - 1];
|
|
212
|
-
i = indexes.pop();
|
|
213
|
-
goingUp = true;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (node.leaf) { // check current node
|
|
217
|
-
var index = findItem(item, node.children, equalsFn);
|
|
218
|
-
|
|
219
|
-
if (index !== -1) {
|
|
220
|
-
// item found, remove the item and condense tree upwards
|
|
221
|
-
node.children.splice(index, 1);
|
|
222
|
-
path.push(node);
|
|
223
|
-
this._condense(path);
|
|
224
|
-
return this;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
|
|
229
|
-
path.push(node);
|
|
230
|
-
indexes.push(i);
|
|
231
|
-
i = 0;
|
|
232
|
-
parent = node;
|
|
233
|
-
node = node.children[0];
|
|
234
|
-
|
|
235
|
-
} else if (parent) { // go right
|
|
236
|
-
i++;
|
|
237
|
-
node = parent.children[i];
|
|
238
|
-
goingUp = false;
|
|
239
|
-
|
|
240
|
-
} else { node = null; } // nothing found
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return this;
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
RBush.prototype.toBBox = function toBBox (item) { return item; };
|
|
247
|
-
|
|
248
|
-
RBush.prototype.compareMinX = function compareMinX (a, b) { return a.minX - b.minX; };
|
|
249
|
-
RBush.prototype.compareMinY = function compareMinY (a, b) { return a.minY - b.minY; };
|
|
250
|
-
|
|
251
|
-
RBush.prototype.toJSON = function toJSON () { return this.data; };
|
|
252
|
-
|
|
253
|
-
RBush.prototype.fromJSON = function fromJSON (data) {
|
|
254
|
-
this.data = data;
|
|
255
|
-
return this;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
RBush.prototype._all = function _all (node, result) {
|
|
259
|
-
var nodesToSearch = [];
|
|
260
|
-
while (node) {
|
|
261
|
-
if (node.leaf) { result.push.apply(result, node.children); }
|
|
262
|
-
else { nodesToSearch.push.apply(nodesToSearch, node.children); }
|
|
263
|
-
|
|
264
|
-
node = nodesToSearch.pop();
|
|
265
|
-
}
|
|
266
|
-
return result;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
RBush.prototype._build = function _build (items, left, right, height) {
|
|
270
|
-
|
|
271
|
-
var N = right - left + 1;
|
|
272
|
-
var M = this._maxEntries;
|
|
273
|
-
var node;
|
|
274
|
-
|
|
275
|
-
if (N <= M) {
|
|
276
|
-
// reached leaf level; return leaf
|
|
277
|
-
node = createNode(items.slice(left, right + 1));
|
|
278
|
-
calcBBox(node, this.toBBox);
|
|
279
|
-
return node;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (!height) {
|
|
283
|
-
// target height of the bulk-loaded tree
|
|
284
|
-
height = Math.ceil(Math.log(N) / Math.log(M));
|
|
285
|
-
|
|
286
|
-
// target number of root entries to maximize storage utilization
|
|
287
|
-
M = Math.ceil(N / Math.pow(M, height - 1));
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
node = createNode([]);
|
|
291
|
-
node.leaf = false;
|
|
292
|
-
node.height = height;
|
|
293
|
-
|
|
294
|
-
// split the items into M mostly square tiles
|
|
295
|
-
|
|
296
|
-
var N2 = Math.ceil(N / M);
|
|
297
|
-
var N1 = N2 * Math.ceil(Math.sqrt(M));
|
|
298
|
-
|
|
299
|
-
multiSelect(items, left, right, N1, this.compareMinX);
|
|
300
|
-
|
|
301
|
-
for (var i = left; i <= right; i += N1) {
|
|
302
|
-
|
|
303
|
-
var right2 = Math.min(i + N1 - 1, right);
|
|
304
|
-
|
|
305
|
-
multiSelect(items, i, right2, N2, this.compareMinY);
|
|
306
|
-
|
|
307
|
-
for (var j = i; j <= right2; j += N2) {
|
|
308
|
-
|
|
309
|
-
var right3 = Math.min(j + N2 - 1, right2);
|
|
310
|
-
|
|
311
|
-
// pack each entry recursively
|
|
312
|
-
node.children.push(this._build(items, j, right3, height - 1));
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
calcBBox(node, this.toBBox);
|
|
317
|
-
|
|
318
|
-
return node;
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
RBush.prototype._chooseSubtree = function _chooseSubtree (bbox, node, level, path) {
|
|
322
|
-
while (true) {
|
|
323
|
-
path.push(node);
|
|
324
|
-
|
|
325
|
-
if (node.leaf || path.length - 1 === level) { break; }
|
|
326
|
-
|
|
327
|
-
var minArea = Infinity;
|
|
328
|
-
var minEnlargement = Infinity;
|
|
329
|
-
var targetNode = (void 0);
|
|
330
|
-
|
|
331
|
-
for (var i = 0; i < node.children.length; i++) {
|
|
332
|
-
var child = node.children[i];
|
|
333
|
-
var area = bboxArea(child);
|
|
334
|
-
var enlargement = enlargedArea(bbox, child) - area;
|
|
335
|
-
|
|
336
|
-
// choose entry with the least area enlargement
|
|
337
|
-
if (enlargement < minEnlargement) {
|
|
338
|
-
minEnlargement = enlargement;
|
|
339
|
-
minArea = area < minArea ? area : minArea;
|
|
340
|
-
targetNode = child;
|
|
341
|
-
|
|
342
|
-
} else if (enlargement === minEnlargement) {
|
|
343
|
-
// otherwise choose one with the smallest area
|
|
344
|
-
if (area < minArea) {
|
|
345
|
-
minArea = area;
|
|
346
|
-
targetNode = child;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
node = targetNode || node.children[0];
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return node;
|
|
355
|
-
};
|
|
356
|
-
|
|
357
|
-
RBush.prototype._insert = function _insert (item, level, isNode) {
|
|
358
|
-
var bbox = isNode ? item : this.toBBox(item);
|
|
359
|
-
var insertPath = [];
|
|
360
|
-
|
|
361
|
-
// find the best node for accommodating the item, saving all nodes along the path too
|
|
362
|
-
var node = this._chooseSubtree(bbox, this.data, level, insertPath);
|
|
363
|
-
|
|
364
|
-
// put the item into the node
|
|
365
|
-
node.children.push(item);
|
|
366
|
-
extend(node, bbox);
|
|
367
|
-
|
|
368
|
-
// split on node overflow; propagate upwards if necessary
|
|
369
|
-
while (level >= 0) {
|
|
370
|
-
if (insertPath[level].children.length > this._maxEntries) {
|
|
371
|
-
this._split(insertPath, level);
|
|
372
|
-
level--;
|
|
373
|
-
} else { break; }
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
// adjust bboxes along the insertion path
|
|
377
|
-
this._adjustParentBBoxes(bbox, insertPath, level);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
// split overflowed node into two
|
|
381
|
-
RBush.prototype._split = function _split (insertPath, level) {
|
|
382
|
-
var node = insertPath[level];
|
|
383
|
-
var M = node.children.length;
|
|
384
|
-
var m = this._minEntries;
|
|
385
|
-
|
|
386
|
-
this._chooseSplitAxis(node, m, M);
|
|
387
|
-
|
|
388
|
-
var splitIndex = this._chooseSplitIndex(node, m, M);
|
|
389
|
-
|
|
390
|
-
var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
|
|
391
|
-
newNode.height = node.height;
|
|
392
|
-
newNode.leaf = node.leaf;
|
|
393
|
-
|
|
394
|
-
calcBBox(node, this.toBBox);
|
|
395
|
-
calcBBox(newNode, this.toBBox);
|
|
396
|
-
|
|
397
|
-
if (level) { insertPath[level - 1].children.push(newNode); }
|
|
398
|
-
else { this._splitRoot(node, newNode); }
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
RBush.prototype._splitRoot = function _splitRoot (node, newNode) {
|
|
402
|
-
// split root node
|
|
403
|
-
this.data = createNode([node, newNode]);
|
|
404
|
-
this.data.height = node.height + 1;
|
|
405
|
-
this.data.leaf = false;
|
|
406
|
-
calcBBox(this.data, this.toBBox);
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
RBush.prototype._chooseSplitIndex = function _chooseSplitIndex (node, m, M) {
|
|
410
|
-
var index;
|
|
411
|
-
var minOverlap = Infinity;
|
|
412
|
-
var minArea = Infinity;
|
|
413
|
-
|
|
414
|
-
for (var i = m; i <= M - m; i++) {
|
|
415
|
-
var bbox1 = distBBox(node, 0, i, this.toBBox);
|
|
416
|
-
var bbox2 = distBBox(node, i, M, this.toBBox);
|
|
417
|
-
|
|
418
|
-
var overlap = intersectionArea(bbox1, bbox2);
|
|
419
|
-
var area = bboxArea(bbox1) + bboxArea(bbox2);
|
|
420
|
-
|
|
421
|
-
// choose distribution with minimum overlap
|
|
422
|
-
if (overlap < minOverlap) {
|
|
423
|
-
minOverlap = overlap;
|
|
424
|
-
index = i;
|
|
425
|
-
|
|
426
|
-
minArea = area < minArea ? area : minArea;
|
|
427
|
-
|
|
428
|
-
} else if (overlap === minOverlap) {
|
|
429
|
-
// otherwise choose distribution with minimum area
|
|
430
|
-
if (area < minArea) {
|
|
431
|
-
minArea = area;
|
|
432
|
-
index = i;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
return index || M - m;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
// sorts node children by the best axis for split
|
|
441
|
-
RBush.prototype._chooseSplitAxis = function _chooseSplitAxis (node, m, M) {
|
|
442
|
-
var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
|
|
443
|
-
var compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
|
|
444
|
-
var xMargin = this._allDistMargin(node, m, M, compareMinX);
|
|
445
|
-
var yMargin = this._allDistMargin(node, m, M, compareMinY);
|
|
446
|
-
|
|
447
|
-
// if total distributions margin value is minimal for x, sort by minX,
|
|
448
|
-
// otherwise it's already sorted by minY
|
|
449
|
-
if (xMargin < yMargin) { node.children.sort(compareMinX); }
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
// total margin of all possible split distributions where each node is at least m full
|
|
453
|
-
RBush.prototype._allDistMargin = function _allDistMargin (node, m, M, compare) {
|
|
454
|
-
node.children.sort(compare);
|
|
455
|
-
|
|
456
|
-
var toBBox = this.toBBox;
|
|
457
|
-
var leftBBox = distBBox(node, 0, m, toBBox);
|
|
458
|
-
var rightBBox = distBBox(node, M - m, M, toBBox);
|
|
459
|
-
var margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
|
|
460
|
-
|
|
461
|
-
for (var i = m; i < M - m; i++) {
|
|
462
|
-
var child = node.children[i];
|
|
463
|
-
extend(leftBBox, node.leaf ? toBBox(child) : child);
|
|
464
|
-
margin += bboxMargin(leftBBox);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
for (var i$1 = M - m - 1; i$1 >= m; i$1--) {
|
|
468
|
-
var child$1 = node.children[i$1];
|
|
469
|
-
extend(rightBBox, node.leaf ? toBBox(child$1) : child$1);
|
|
470
|
-
margin += bboxMargin(rightBBox);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return margin;
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
RBush.prototype._adjustParentBBoxes = function _adjustParentBBoxes (bbox, path, level) {
|
|
477
|
-
// adjust bboxes along the given tree path
|
|
478
|
-
for (var i = level; i >= 0; i--) {
|
|
479
|
-
extend(path[i], bbox);
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
RBush.prototype._condense = function _condense (path) {
|
|
484
|
-
// go through the path, removing empty nodes and updating bboxes
|
|
485
|
-
for (var i = path.length - 1, siblings = (void 0); i >= 0; i--) {
|
|
486
|
-
if (path[i].children.length === 0) {
|
|
487
|
-
if (i > 0) {
|
|
488
|
-
siblings = path[i - 1].children;
|
|
489
|
-
siblings.splice(siblings.indexOf(path[i]), 1);
|
|
490
|
-
|
|
491
|
-
} else { this.clear(); }
|
|
492
|
-
|
|
493
|
-
} else { calcBBox(path[i], this.toBBox); }
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
function findItem(item, items, equalsFn) {
|
|
498
|
-
if (!equalsFn) { return items.indexOf(item); }
|
|
499
|
-
|
|
500
|
-
for (var i = 0; i < items.length; i++) {
|
|
501
|
-
if (equalsFn(item, items[i])) { return i; }
|
|
502
|
-
}
|
|
503
|
-
return -1;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
// calculate node's bbox from bboxes of its children
|
|
507
|
-
function calcBBox(node, toBBox) {
|
|
508
|
-
distBBox(node, 0, node.children.length, toBBox, node);
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
// min bounding rectangle of node children from k to p-1
|
|
512
|
-
function distBBox(node, k, p, toBBox, destNode) {
|
|
513
|
-
if (!destNode) { destNode = createNode(null); }
|
|
514
|
-
destNode.minX = Infinity;
|
|
515
|
-
destNode.minY = Infinity;
|
|
516
|
-
destNode.maxX = -Infinity;
|
|
517
|
-
destNode.maxY = -Infinity;
|
|
518
|
-
|
|
519
|
-
for (var i = k; i < p; i++) {
|
|
520
|
-
var child = node.children[i];
|
|
521
|
-
extend(destNode, node.leaf ? toBBox(child) : child);
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return destNode;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
function extend(a, b) {
|
|
528
|
-
a.minX = Math.min(a.minX, b.minX);
|
|
529
|
-
a.minY = Math.min(a.minY, b.minY);
|
|
530
|
-
a.maxX = Math.max(a.maxX, b.maxX);
|
|
531
|
-
a.maxY = Math.max(a.maxY, b.maxY);
|
|
532
|
-
return a;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function compareNodeMinX(a, b) { return a.minX - b.minX; }
|
|
536
|
-
function compareNodeMinY(a, b) { return a.minY - b.minY; }
|
|
537
|
-
|
|
538
|
-
function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
|
|
539
|
-
function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
|
|
540
|
-
|
|
541
|
-
function enlargedArea(a, b) {
|
|
542
|
-
return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
|
|
543
|
-
(Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
function intersectionArea(a, b) {
|
|
547
|
-
var minX = Math.max(a.minX, b.minX);
|
|
548
|
-
var minY = Math.max(a.minY, b.minY);
|
|
549
|
-
var maxX = Math.min(a.maxX, b.maxX);
|
|
550
|
-
var maxY = Math.min(a.maxY, b.maxY);
|
|
551
|
-
|
|
552
|
-
return Math.max(0, maxX - minX) *
|
|
553
|
-
Math.max(0, maxY - minY);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
function contains(a, b) {
|
|
557
|
-
return a.minX <= b.minX &&
|
|
558
|
-
a.minY <= b.minY &&
|
|
559
|
-
b.maxX <= a.maxX &&
|
|
560
|
-
b.maxY <= a.maxY;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function intersects(a, b) {
|
|
564
|
-
return b.minX <= a.maxX &&
|
|
565
|
-
b.minY <= a.maxY &&
|
|
566
|
-
b.maxX >= a.minX &&
|
|
567
|
-
b.maxY >= a.minY;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
function createNode(children) {
|
|
571
|
-
return {
|
|
572
|
-
children: children,
|
|
573
|
-
height: 1,
|
|
574
|
-
leaf: true,
|
|
575
|
-
minX: Infinity,
|
|
576
|
-
minY: Infinity,
|
|
577
|
-
maxX: -Infinity,
|
|
578
|
-
maxY: -Infinity
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
// sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
|
|
583
|
-
// combines selection algorithm with binary divide & conquer approach
|
|
584
|
-
|
|
585
|
-
function multiSelect(arr, left, right, n, compare) {
|
|
586
|
-
var stack = [left, right];
|
|
587
|
-
|
|
588
|
-
while (stack.length) {
|
|
589
|
-
right = stack.pop();
|
|
590
|
-
left = stack.pop();
|
|
591
|
-
|
|
592
|
-
if (right - left <= n) { continue; }
|
|
593
|
-
|
|
594
|
-
var mid = left + Math.ceil((right - left) / n / 2) * n;
|
|
595
|
-
quickselect(arr, mid, left, right, compare);
|
|
596
|
-
|
|
597
|
-
stack.push(left, mid, mid, right);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
return RBush;
|
|
602
|
-
|
|
603
|
-
}));
|
|
604
|
-
}(rbush));
|
|
605
|
-
|
|
606
|
-
var RBush = rbush.exports;
|
|
607
|
-
|
|
608
30
|
var Shape = /*#__PURE__*/function (Shape) {
|
|
609
31
|
Shape["GROUP"] = "g";
|
|
610
32
|
Shape["FRAGMENT"] = "fragment";
|
|
@@ -13374,6 +12796,34 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
13374
12796
|
}
|
|
13375
12797
|
}
|
|
13376
12798
|
|
|
12799
|
+
/**
|
|
12800
|
+
* batch update attributes without attributeChangedCallback, for performance
|
|
12801
|
+
* use with caution
|
|
12802
|
+
* @param attributes
|
|
12803
|
+
* @param parseOptions
|
|
12804
|
+
*/
|
|
12805
|
+
}, {
|
|
12806
|
+
key: "setAttributes",
|
|
12807
|
+
value: function setAttributes(attributes) {
|
|
12808
|
+
var parseOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12809
|
+
var _parseOptions$skipDis = parseOptions.skipDispatchAttrModifiedEvent,
|
|
12810
|
+
skipDispatchAttrModifiedEvent = _parseOptions$skipDis === void 0 ? false : _parseOptions$skipDis;
|
|
12811
|
+
var oldAttributes;
|
|
12812
|
+
var oldParsedValues;
|
|
12813
|
+
if (!skipDispatchAttrModifiedEvent) {
|
|
12814
|
+
oldAttributes = _objectSpread({}, this.attributes);
|
|
12815
|
+
oldParsedValues = _objectSpread({}, this.parsedStyle);
|
|
12816
|
+
}
|
|
12817
|
+
runtime.styleValueRegistry.processProperties(this, attributes, parseOptions);
|
|
12818
|
+
// redraw at next frame
|
|
12819
|
+
this.dirty();
|
|
12820
|
+
if (!skipDispatchAttrModifiedEvent) {
|
|
12821
|
+
for (var key in attributes) {
|
|
12822
|
+
this.dispatchAttrModifiedEvent(key, oldAttributes[key], attributes[key], oldParsedValues[key]);
|
|
12823
|
+
}
|
|
12824
|
+
}
|
|
12825
|
+
}
|
|
12826
|
+
|
|
13377
12827
|
/**
|
|
13378
12828
|
* called when attributes get changed or initialized
|
|
13379
12829
|
*/
|
|
@@ -13390,6 +12840,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
13390
12840
|
|
|
13391
12841
|
// return;
|
|
13392
12842
|
|
|
12843
|
+
this.dispatchAttrModifiedEvent(name, oldValue, value, oldParsedValue);
|
|
12844
|
+
}
|
|
12845
|
+
}, {
|
|
12846
|
+
key: "dispatchAttrModifiedEvent",
|
|
12847
|
+
value: function dispatchAttrModifiedEvent(name, oldValue, value, oldParsedValue) {
|
|
13393
12848
|
var newParsedValue = this.parsedStyle[name];
|
|
13394
12849
|
if (this.isConnected) {
|
|
13395
12850
|
attrModifiedEvent.relatedNode = this;
|
|
@@ -16801,5 +16256,5 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16801
16256
|
}]);
|
|
16802
16257
|
}(EventTarget);
|
|
16803
16258
|
|
|
16804
|
-
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Fragment, Frustum, GradientType, Group, GroupUpdater, HTML, HTMLUpdater, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax,
|
|
16259
|
+
export { AABB, AbstractRenderer, AbstractRendererPlugin, BUILT_IN_PROPERTIES, CSS, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSStyleValue, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasEvent, Circle, CircleUpdater, ClipSpaceNearZ, CustomElement, CustomElementRegistry, CustomEvent, DefaultSceneGraphSelector, DefaultSceneGraphService, DisplayObject, Document, ERROR_MSG_METHOD_NOT_IMPLEMENTED, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, Fragment, Frustum, GradientType, Group, GroupUpdater, HTML, HTMLUpdater, Image, Line, LineUpdater, Mask, MutationEvent, Node, OffscreenCanvasCreator, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertySyntax, Rect, RectUpdater, Rectangle, RenderReason, RenderingService, Shape, SortReason, Strategy, Text, TextService, TextUpdater, UnitType, attrModifiedEvent, computeLinearGradient, computeRadialGradient, convertToPath, createVec3, decompose, definedProps, deg2rad, deg2turn, destroyEvent, findClosestClipPathTarget, fromRotationTranslationScale, getAngle, getEuler, getOrCalculatePathTotalLength, grad2deg, insertedEvent, isBrowser, isCSSGradientValue, isCSSRGB, isCanvas, isDisplayObject, isFederatedEvent, isFillOrStrokeAffected, isPattern, mergeColors, parseColor, parseLength, parsePath, parseTransform, parsedTransformToMat4, propertyMetadataCache, rad2deg, removedEvent, resetEntityCounter, runtime, setDOMSize, translatePathToString, turn2deg, updateLocalTransform, updateWorldTransform };
|
|
16805
16260
|
//# sourceMappingURL=index.esm.js.map
|