@antv/g 5.4.0 → 5.5.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/components/Transform.d.ts +5 -1
- package/dist/components/Transform.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/css/interfaces.d.ts +1 -1
- package/dist/css/interfaces.d.ts.map +1 -1
- package/dist/css/parser/path.d.ts +2 -2
- package/dist/css/parser/path.d.ts.map +1 -1
- package/dist/css/parser/transform.d.ts +1 -0
- package/dist/css/parser/transform.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
- package/dist/display-objects/Circle.d.ts.map +1 -1
- package/dist/display-objects/DisplayObject.d.ts +2 -0
- package/dist/display-objects/DisplayObject.d.ts.map +1 -1
- package/dist/display-objects/Ellipse.d.ts.map +1 -1
- package/dist/dom/interfaces.d.ts +0 -1
- package/dist/dom/interfaces.d.ts.map +1 -1
- package/dist/index.esm.js +564 -198
- package/dist/index.js +524 -156
- package/dist/index.umd.js +1453 -525
- package/dist/index.umd.min.js +2 -2
- package/dist/services/SceneGraphService.d.ts +6 -2
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/types.d.ts +0 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/interpolation.d.ts.map +1 -1
- package/dist/utils/string.d.ts +4 -1
- package/dist/utils/string.d.ts.map +1 -1
- package/package.json +6 -5
package/dist/index.esm.js
CHANGED
|
@@ -4,11 +4,12 @@ import RBush from 'rbush';
|
|
|
4
4
|
export { default as RBush } from 'rbush';
|
|
5
5
|
import 'reflect-metadata';
|
|
6
6
|
import { __decorate, __param, __metadata } from 'tslib';
|
|
7
|
-
import { vec3, mat3, mat4, quat, vec4 } from 'gl-matrix';
|
|
7
|
+
import { vec3, mat3, mat4, quat as quat$1, vec2, vec4 } from 'gl-matrix';
|
|
8
8
|
import { EventEmitter } from 'eventemitter3';
|
|
9
9
|
import { color } from 'd3-color';
|
|
10
|
-
import { normalizePath, path2Curve, getPathBBoxTotalLength, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, getPointAtLength } from '@antv/util';
|
|
10
|
+
import { path2String, normalizePath, path2Curve, getPathBBoxTotalLength, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, getPointAtLength } from '@antv/util';
|
|
11
11
|
import { Polyline as Polyline$1, Line as Line$1 } from '@antv/g-math';
|
|
12
|
+
import decomposeMatrix from 'mat4-decompose';
|
|
12
13
|
import { requestAnimationFrame as requestAnimationFrame$1, cancelAnimationFrame as cancelAnimationFrame$1 } from 'request-animation-frame-polyfill';
|
|
13
14
|
|
|
14
15
|
function _regeneratorRuntime() {
|
|
@@ -1233,7 +1234,7 @@ var convertToDash = function convertToDash(str) {
|
|
|
1233
1234
|
return "-" + letter.toLowerCase();
|
|
1234
1235
|
}); // Remove first dash
|
|
1235
1236
|
|
|
1236
|
-
return str.charAt(0) === '-' ? str.
|
|
1237
|
+
return str.charAt(0) === '-' ? str.substring(1) : str;
|
|
1237
1238
|
};
|
|
1238
1239
|
/**
|
|
1239
1240
|
Easing Functions from anime.js, they are tried and true, so, its better to use them instead of other alternatives
|
|
@@ -2332,20 +2333,45 @@ function calculateIterationProgress(activeDuration, localTime, timing) {
|
|
|
2332
2333
|
return timing.easingFunction(directedProgress);
|
|
2333
2334
|
}
|
|
2334
2335
|
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2336
|
+
/**
|
|
2337
|
+
* @see https://github.com/lodash/lodash/blob/master/memoize.js
|
|
2338
|
+
*/
|
|
2339
|
+
function memoize(func, resolver) {
|
|
2340
|
+
if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
|
|
2341
|
+
throw new TypeError('Expected a function');
|
|
2339
2342
|
}
|
|
2340
2343
|
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2344
|
+
var memoized = function memoized() {
|
|
2345
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2346
|
+
args[_key] = arguments[_key];
|
|
2347
|
+
}
|
|
2346
2348
|
|
|
2347
|
-
|
|
2349
|
+
var key = resolver ? resolver.apply(this, args) : args[0];
|
|
2350
|
+
var cache = memoized.cache;
|
|
2351
|
+
|
|
2352
|
+
if (cache.has(key)) {
|
|
2353
|
+
return cache.get(key);
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
var result = func.apply(this, args);
|
|
2357
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
2358
|
+
return result;
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
memoized.cache = new (memoize.Cache || Map)();
|
|
2362
|
+
return memoized;
|
|
2348
2363
|
}
|
|
2364
|
+
memoize.Cache = Map;
|
|
2365
|
+
|
|
2366
|
+
var camelCase = memoize(function (str) {
|
|
2367
|
+
if (str === void 0) {
|
|
2368
|
+
str = '';
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
return str.replace(/-([a-z])/g, function (g) {
|
|
2372
|
+
return g[1].toUpperCase();
|
|
2373
|
+
});
|
|
2374
|
+
});
|
|
2349
2375
|
function isString(str) {
|
|
2350
2376
|
if (!isNil(str) && typeof str === 'string') {
|
|
2351
2377
|
return true;
|
|
@@ -2551,45 +2577,33 @@ var FORMAT_ATTR_MAP = {
|
|
|
2551
2577
|
alias: 'img'
|
|
2552
2578
|
}
|
|
2553
2579
|
};
|
|
2554
|
-
function
|
|
2555
|
-
var _map$values;
|
|
2556
|
-
|
|
2580
|
+
var formatAttributeName = memoize(function (name) {
|
|
2557
2581
|
var attributeName = camelCase(name);
|
|
2558
2582
|
var map = FORMAT_ATTR_MAP[attributeName];
|
|
2559
2583
|
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
/**
|
|
2565
|
-
* @see https://github.com/lodash/lodash/blob/master/memoize.js
|
|
2566
|
-
*/
|
|
2567
|
-
function memoize(func, resolver) {
|
|
2568
|
-
if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
|
|
2569
|
-
throw new TypeError('Expected a function');
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
var memoized = function memoized() {
|
|
2573
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2574
|
-
args[_key] = arguments[_key];
|
|
2575
|
-
}
|
|
2576
|
-
|
|
2577
|
-
var key = resolver ? resolver.apply(this, args) : args[0];
|
|
2578
|
-
var cache = memoized.cache;
|
|
2579
|
-
|
|
2580
|
-
if (cache.has(key)) {
|
|
2581
|
-
return cache.get(key);
|
|
2582
|
-
}
|
|
2584
|
+
return [attributeName, map];
|
|
2585
|
+
});
|
|
2586
|
+
function formatAttribute(name, value) {
|
|
2587
|
+
var _map$values;
|
|
2583
2588
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
};
|
|
2589
|
+
var _formatAttributeName = formatAttributeName(name),
|
|
2590
|
+
attributeName = _formatAttributeName[0],
|
|
2591
|
+
map = _formatAttributeName[1];
|
|
2588
2592
|
|
|
2589
|
-
|
|
2590
|
-
return
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
+
var attributeValue = isString(value) && (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
|
|
2594
|
+
return [attributeName, attributeValue];
|
|
2595
|
+
} // export const formatAttribute = memoize(
|
|
2596
|
+
// (name: string, value: any): [string, any] => {
|
|
2597
|
+
// let attributeName = camelCase(name);
|
|
2598
|
+
// const map = FORMAT_ATTR_MAP[attributeName];
|
|
2599
|
+
// attributeName = map?.alias || attributeName;
|
|
2600
|
+
// const attributeValue = map?.values?.[value] || value;
|
|
2601
|
+
// return [attributeName, attributeValue];
|
|
2602
|
+
// },
|
|
2603
|
+
// (name: string, value: any) => {
|
|
2604
|
+
// return `${name}${value}`;
|
|
2605
|
+
// },
|
|
2606
|
+
// );
|
|
2593
2607
|
|
|
2594
2608
|
var Shape;
|
|
2595
2609
|
|
|
@@ -8186,7 +8200,7 @@ function mergeNumberLists(left, right) {
|
|
|
8186
8200
|
}];
|
|
8187
8201
|
}
|
|
8188
8202
|
|
|
8189
|
-
function
|
|
8203
|
+
var memoizedParsePath = memoize(function (path) {
|
|
8190
8204
|
var absolutePath;
|
|
8191
8205
|
|
|
8192
8206
|
try {
|
|
@@ -8218,11 +8232,6 @@ function parsePath(path, object) {
|
|
|
8218
8232
|
height = _getPathBBoxTotalLeng.height,
|
|
8219
8233
|
length = _getPathBBoxTotalLeng.length;
|
|
8220
8234
|
|
|
8221
|
-
if (object) {
|
|
8222
|
-
object.parsedStyle.defX = x;
|
|
8223
|
-
object.parsedStyle.defY = y;
|
|
8224
|
-
}
|
|
8225
|
-
|
|
8226
8235
|
return {
|
|
8227
8236
|
absolutePath: absolutePath,
|
|
8228
8237
|
hasArc: hasArc,
|
|
@@ -8234,6 +8243,18 @@ function parsePath(path, object) {
|
|
|
8234
8243
|
zCommandIndexes: zCommandIndexes,
|
|
8235
8244
|
rect: new Rectangle(x, y, width, height)
|
|
8236
8245
|
};
|
|
8246
|
+
}, function (path) {
|
|
8247
|
+
return isString(path) ? path : path2String(path);
|
|
8248
|
+
});
|
|
8249
|
+
function parsePath(path, object) {
|
|
8250
|
+
var result = memoizedParsePath(path);
|
|
8251
|
+
|
|
8252
|
+
if (object) {
|
|
8253
|
+
object.parsedStyle.defX = result.rect.x;
|
|
8254
|
+
object.parsedStyle.defY = result.rect.y;
|
|
8255
|
+
}
|
|
8256
|
+
|
|
8257
|
+
return result;
|
|
8237
8258
|
}
|
|
8238
8259
|
function mergePaths(left, right, object) {
|
|
8239
8260
|
var curve1 = left.curve;
|
|
@@ -8490,22 +8511,23 @@ function id$1(x) {
|
|
|
8490
8511
|
|
|
8491
8512
|
|
|
8492
8513
|
var transformFunctions = {
|
|
8493
|
-
//
|
|
8494
|
-
|
|
8514
|
+
// @ts-ignore
|
|
8515
|
+
matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id$1],
|
|
8516
|
+
matrix3d: ['NNNNNNNNNNNNNNNN', id$1],
|
|
8495
8517
|
rotate: ['A'],
|
|
8496
8518
|
rotatex: ['A'],
|
|
8497
8519
|
rotatey: ['A'],
|
|
8498
8520
|
rotatez: ['A'],
|
|
8499
8521
|
rotate3d: ['NNNA'],
|
|
8500
|
-
|
|
8522
|
+
perspective: ['L'],
|
|
8501
8523
|
scale: ['Nn', cast([_, _, CSS.number(1)]), id$1],
|
|
8502
8524
|
scalex: ['N', cast([_, CSS.number(1), CSS.number(1)]), cast([_, CSS.number(1)])],
|
|
8503
8525
|
scaley: ['N', cast([CSS.number(1), _, CSS.number(1)]), cast([CSS.number(1), _])],
|
|
8504
8526
|
scalez: ['N', cast([CSS.number(1), CSS.number(1), _])],
|
|
8505
8527
|
scale3d: ['NNN', id$1],
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8528
|
+
skew: ['Aa', null, id$1],
|
|
8529
|
+
skewx: ['A', null, cast([_, Odeg])],
|
|
8530
|
+
skewy: ['A', null, cast([Odeg, _])],
|
|
8509
8531
|
translate: ['Tt', cast([_, _, Opx]), id$1],
|
|
8510
8532
|
translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
|
|
8511
8533
|
translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
|
|
@@ -8598,33 +8620,289 @@ function parseTransform(string) {
|
|
|
8598
8620
|
}
|
|
8599
8621
|
|
|
8600
8622
|
return [];
|
|
8601
|
-
}
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8623
|
+
}
|
|
8624
|
+
function convertItemToMatrix(item) {
|
|
8625
|
+
var x;
|
|
8626
|
+
var y;
|
|
8627
|
+
var z;
|
|
8628
|
+
var angle;
|
|
8629
|
+
|
|
8630
|
+
switch (item.t) {
|
|
8631
|
+
case 'rotatex':
|
|
8632
|
+
angle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8633
|
+
return [1, 0, 0, 0, 0, Math.cos(angle), Math.sin(angle), 0, 0, -Math.sin(angle), Math.cos(angle), 0, 0, 0, 0, 1];
|
|
8634
|
+
|
|
8635
|
+
case 'rotatey':
|
|
8636
|
+
angle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8637
|
+
return [Math.cos(angle), 0, -Math.sin(angle), 0, 0, 1, 0, 0, Math.sin(angle), 0, Math.cos(angle), 0, 0, 0, 0, 1];
|
|
8638
|
+
|
|
8639
|
+
case 'rotate':
|
|
8640
|
+
case 'rotatez':
|
|
8641
|
+
angle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8642
|
+
return [Math.cos(angle), Math.sin(angle), 0, 0, -Math.sin(angle), Math.cos(angle), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8643
|
+
|
|
8644
|
+
case 'rotate3d':
|
|
8645
|
+
x = item.d[0].value;
|
|
8646
|
+
y = item.d[1].value;
|
|
8647
|
+
z = item.d[2].value;
|
|
8648
|
+
angle = deg2rad(convertAngleUnit(item.d[3]));
|
|
8649
|
+
var sqrLength = x * x + y * y + z * z;
|
|
8650
|
+
|
|
8651
|
+
if (sqrLength === 0) {
|
|
8652
|
+
x = 1;
|
|
8653
|
+
y = 0;
|
|
8654
|
+
z = 0;
|
|
8655
|
+
} else if (sqrLength !== 1) {
|
|
8656
|
+
var length = Math.sqrt(sqrLength);
|
|
8657
|
+
x /= length;
|
|
8658
|
+
y /= length;
|
|
8659
|
+
z /= length;
|
|
8660
|
+
}
|
|
8661
|
+
|
|
8662
|
+
var s = Math.sin(angle / 2);
|
|
8663
|
+
var sc = s * Math.cos(angle / 2);
|
|
8664
|
+
var sq = s * s;
|
|
8665
|
+
return [1 - 2 * (y * y + z * z) * sq, 2 * (x * y * sq + z * sc), 2 * (x * z * sq - y * sc), 0, 2 * (x * y * sq - z * sc), 1 - 2 * (x * x + z * z) * sq, 2 * (y * z * sq + x * sc), 0, 2 * (x * z * sq + y * sc), 2 * (y * z * sq - x * sc), 1 - 2 * (x * x + y * y) * sq, 0, 0, 0, 0, 1];
|
|
8666
|
+
|
|
8667
|
+
case 'scale':
|
|
8668
|
+
return [item.d[0].value, 0, 0, 0, 0, item.d[1].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8669
|
+
|
|
8670
|
+
case 'scalex':
|
|
8671
|
+
return [item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8672
|
+
|
|
8673
|
+
case 'scaley':
|
|
8674
|
+
return [1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8675
|
+
|
|
8676
|
+
case 'scalez':
|
|
8677
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1];
|
|
8678
|
+
|
|
8679
|
+
case 'scale3d':
|
|
8680
|
+
return [item.d[0].value, 0, 0, 0, 0, item.d[1].value, 0, 0, 0, 0, item.d[2].value, 0, 0, 0, 0, 1];
|
|
8681
|
+
|
|
8682
|
+
case 'skew':
|
|
8683
|
+
var xAngle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8684
|
+
var yAngle = deg2rad(convertAngleUnit(item.d[1]));
|
|
8685
|
+
return [1, Math.tan(yAngle), 0, 0, Math.tan(xAngle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8686
|
+
|
|
8687
|
+
case 'skewx':
|
|
8688
|
+
angle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8689
|
+
return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8690
|
+
|
|
8691
|
+
case 'skewy':
|
|
8692
|
+
angle = deg2rad(convertAngleUnit(item.d[0]));
|
|
8693
|
+
return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8694
|
+
|
|
8695
|
+
case 'translate':
|
|
8696
|
+
// TODO: pass target
|
|
8697
|
+
x = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8698
|
+
y = convertPercentUnit(item.d[1], 0, null) || 0;
|
|
8699
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, 0, 1];
|
|
8700
|
+
|
|
8701
|
+
case 'translatex':
|
|
8702
|
+
x = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8703
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, 0, 0, 1];
|
|
8704
|
+
|
|
8705
|
+
case 'translatey':
|
|
8706
|
+
y = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8707
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, y, 0, 1];
|
|
8708
|
+
|
|
8709
|
+
case 'translatez':
|
|
8710
|
+
z = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8711
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, z, 1];
|
|
8712
|
+
|
|
8713
|
+
case 'translate3d':
|
|
8714
|
+
x = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8715
|
+
y = convertPercentUnit(item.d[1], 0, null) || 0;
|
|
8716
|
+
z = convertPercentUnit(item.d[2], 0, null) || 0;
|
|
8717
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1];
|
|
8718
|
+
|
|
8719
|
+
case 'perspective':
|
|
8720
|
+
var t = convertPercentUnit(item.d[0], 0, null) || 0;
|
|
8721
|
+
var p = t ? -1 / t : 0;
|
|
8722
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, p, 0, 0, 0, 1];
|
|
8723
|
+
|
|
8724
|
+
case 'matrix':
|
|
8725
|
+
return [item.d[0].value, item.d[1].value, 0, 0, item.d[2].value, item.d[3].value, 0, 0, 0, 0, 1, 0, item.d[4].value, item.d[5].value, 0, 1];
|
|
8726
|
+
|
|
8727
|
+
case 'matrix3d':
|
|
8728
|
+
return item.d.map(function (d) {
|
|
8729
|
+
return d.value;
|
|
8730
|
+
});
|
|
8731
|
+
}
|
|
8732
|
+
}
|
|
8733
|
+
|
|
8734
|
+
function multiplyMatrices(a, b) {
|
|
8735
|
+
return [a[0] * b[0] + a[4] * b[1] + a[8] * b[2] + a[12] * b[3], a[1] * b[0] + a[5] * b[1] + a[9] * b[2] + a[13] * b[3], a[2] * b[0] + a[6] * b[1] + a[10] * b[2] + a[14] * b[3], a[3] * b[0] + a[7] * b[1] + a[11] * b[2] + a[15] * b[3], a[0] * b[4] + a[4] * b[5] + a[8] * b[6] + a[12] * b[7], a[1] * b[4] + a[5] * b[5] + a[9] * b[6] + a[13] * b[7], a[2] * b[4] + a[6] * b[5] + a[10] * b[6] + a[14] * b[7], a[3] * b[4] + a[7] * b[5] + a[11] * b[6] + a[15] * b[7], a[0] * b[8] + a[4] * b[9] + a[8] * b[10] + a[12] * b[11], a[1] * b[8] + a[5] * b[9] + a[9] * b[10] + a[13] * b[11], a[2] * b[8] + a[6] * b[9] + a[10] * b[10] + a[14] * b[11], a[3] * b[8] + a[7] * b[9] + a[11] * b[10] + a[15] * b[11], a[0] * b[12] + a[4] * b[13] + a[8] * b[14] + a[12] * b[15], a[1] * b[12] + a[5] * b[13] + a[9] * b[14] + a[13] * b[15], a[2] * b[12] + a[6] * b[13] + a[10] * b[14] + a[14] * b[15], a[3] * b[12] + a[7] * b[13] + a[11] * b[14] + a[15] * b[15]];
|
|
8736
|
+
}
|
|
8737
|
+
|
|
8738
|
+
function convertToMatrix(transformList) {
|
|
8739
|
+
if (transformList.length === 0) {
|
|
8740
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
8741
|
+
}
|
|
8742
|
+
|
|
8743
|
+
return transformList.map(convertItemToMatrix).reduce(multiplyMatrices);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8746
|
+
function makeMatrixDecomposition(transformList) {
|
|
8747
|
+
var translate = [0, 0, 0];
|
|
8748
|
+
var scale = [0, 0, 0];
|
|
8749
|
+
var skew = [0, 0, 0];
|
|
8750
|
+
var perspective = [0, 0, 0, 1];
|
|
8751
|
+
var quaternion = [0, 0, 0, 1];
|
|
8752
|
+
decomposeMatrix(convertToMatrix(transformList), translate, scale, skew, perspective, quaternion);
|
|
8753
|
+
return [translate, scale, skew, quaternion, perspective];
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8756
|
+
var composeMatrix = function () {
|
|
8757
|
+
function multiply(a, b) {
|
|
8758
|
+
var result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
|
|
8759
|
+
|
|
8760
|
+
for (var i = 0; i < 4; i++) {
|
|
8761
|
+
for (var j = 0; j < 4; j++) {
|
|
8762
|
+
for (var k = 0; k < 4; k++) {
|
|
8763
|
+
result[i][j] += b[i][k] * a[k][j];
|
|
8764
|
+
}
|
|
8765
|
+
}
|
|
8766
|
+
}
|
|
8767
|
+
|
|
8768
|
+
return result;
|
|
8769
|
+
}
|
|
8770
|
+
|
|
8771
|
+
function is2D(m) {
|
|
8772
|
+
return m[0][2] == 0 && m[0][3] == 0 && m[1][2] == 0 && m[1][3] == 0 && m[2][0] == 0 && m[2][1] == 0 && m[2][2] == 1 && m[2][3] == 0 && m[3][2] == 0 && m[3][3] == 1;
|
|
8773
|
+
}
|
|
8774
|
+
|
|
8775
|
+
function composeMatrix(translate, scale, skew, quat, perspective) {
|
|
8776
|
+
var matrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
|
|
8777
|
+
|
|
8778
|
+
for (var i = 0; i < 4; i++) {
|
|
8779
|
+
matrix[i][3] = perspective[i];
|
|
8780
|
+
}
|
|
8781
|
+
|
|
8782
|
+
for (var _i = 0; _i < 3; _i++) {
|
|
8783
|
+
for (var j = 0; j < 3; j++) {
|
|
8784
|
+
matrix[3][_i] += translate[j] * matrix[j][_i];
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
|
|
8788
|
+
var x = quat[0],
|
|
8789
|
+
y = quat[1],
|
|
8790
|
+
z = quat[2],
|
|
8791
|
+
w = quat[3];
|
|
8792
|
+
var rotMatrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
|
|
8793
|
+
rotMatrix[0][0] = 1 - 2 * (y * y + z * z);
|
|
8794
|
+
rotMatrix[0][1] = 2 * (x * y - z * w);
|
|
8795
|
+
rotMatrix[0][2] = 2 * (x * z + y * w);
|
|
8796
|
+
rotMatrix[1][0] = 2 * (x * y + z * w);
|
|
8797
|
+
rotMatrix[1][1] = 1 - 2 * (x * x + z * z);
|
|
8798
|
+
rotMatrix[1][2] = 2 * (y * z - x * w);
|
|
8799
|
+
rotMatrix[2][0] = 2 * (x * z - y * w);
|
|
8800
|
+
rotMatrix[2][1] = 2 * (y * z + x * w);
|
|
8801
|
+
rotMatrix[2][2] = 1 - 2 * (x * x + y * y);
|
|
8802
|
+
matrix = multiply(matrix, rotMatrix);
|
|
8803
|
+
var temp = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
|
|
8804
|
+
|
|
8805
|
+
if (skew[2]) {
|
|
8806
|
+
temp[2][1] = skew[2];
|
|
8807
|
+
matrix = multiply(matrix, temp);
|
|
8808
|
+
}
|
|
8809
|
+
|
|
8810
|
+
if (skew[1]) {
|
|
8811
|
+
temp[2][1] = 0;
|
|
8812
|
+
temp[2][0] = skew[0];
|
|
8813
|
+
matrix = multiply(matrix, temp);
|
|
8814
|
+
}
|
|
8815
|
+
|
|
8816
|
+
if (skew[0]) {
|
|
8817
|
+
temp[2][0] = 0;
|
|
8818
|
+
temp[1][0] = skew[0];
|
|
8819
|
+
matrix = multiply(matrix, temp);
|
|
8820
|
+
}
|
|
8821
|
+
|
|
8822
|
+
for (var _i2 = 0; _i2 < 3; _i2++) {
|
|
8823
|
+
for (var _j = 0; _j < 3; _j++) {
|
|
8824
|
+
matrix[_i2][_j] *= scale[_i2];
|
|
8825
|
+
}
|
|
8826
|
+
}
|
|
8827
|
+
|
|
8828
|
+
if (is2D(matrix)) {
|
|
8829
|
+
return [matrix[0][0], matrix[0][1], matrix[1][0], matrix[1][1], matrix[3][0], matrix[3][1]];
|
|
8830
|
+
}
|
|
8831
|
+
|
|
8832
|
+
return matrix[0].concat(matrix[1], matrix[2], matrix[3]);
|
|
8833
|
+
}
|
|
8834
|
+
|
|
8835
|
+
return composeMatrix;
|
|
8836
|
+
}();
|
|
8837
|
+
|
|
8838
|
+
function numberToLongString(x) {
|
|
8839
|
+
return x.toFixed(6).replace('.000000', '');
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
function mergeMatrices(left, right) {
|
|
8843
|
+
var leftArgs;
|
|
8844
|
+
var rightArgs; // @ts-ignore
|
|
8845
|
+
|
|
8846
|
+
if (left.decompositionPair !== right) {
|
|
8847
|
+
// @ts-ignore
|
|
8848
|
+
left.decompositionPair = right;
|
|
8849
|
+
leftArgs = makeMatrixDecomposition(left);
|
|
8850
|
+
} // @ts-ignore
|
|
8851
|
+
|
|
8852
|
+
|
|
8853
|
+
if (right.decompositionPair !== left) {
|
|
8854
|
+
// @ts-ignore
|
|
8855
|
+
right.decompositionPair = left;
|
|
8856
|
+
rightArgs = makeMatrixDecomposition(right);
|
|
8857
|
+
}
|
|
8858
|
+
|
|
8859
|
+
if (leftArgs[0] === null || rightArgs[0] === null) return [// @ts-ignore
|
|
8860
|
+
[false], // @ts-ignore
|
|
8861
|
+
[true], // @ts-ignore
|
|
8862
|
+
function (x) {
|
|
8863
|
+
return x ? right[0].d : left[0].d;
|
|
8864
|
+
}];
|
|
8865
|
+
leftArgs[0].push(0);
|
|
8866
|
+
rightArgs[0].push(1);
|
|
8867
|
+
return [leftArgs, rightArgs, // @ts-ignore
|
|
8868
|
+
function (list) {
|
|
8869
|
+
// @ts-ignore
|
|
8870
|
+
var q = quat(leftArgs[0][3], rightArgs[0][3], list[5]);
|
|
8871
|
+
var mat = composeMatrix(list[0], list[1], list[2], q, list[4]);
|
|
8872
|
+
var stringifiedArgs = mat.map(numberToLongString).join(',');
|
|
8873
|
+
return stringifiedArgs;
|
|
8874
|
+
}];
|
|
8875
|
+
}
|
|
8876
|
+
|
|
8877
|
+
function dot(v1, v2) {
|
|
8878
|
+
var result = 0;
|
|
8879
|
+
|
|
8880
|
+
for (var i = 0; i < v1.length; i++) {
|
|
8881
|
+
result += v1[i] * v2[i];
|
|
8882
|
+
}
|
|
8883
|
+
|
|
8884
|
+
return result;
|
|
8885
|
+
}
|
|
8886
|
+
|
|
8887
|
+
function quat(fromQ, toQ, f) {
|
|
8888
|
+
var product = dot(fromQ, toQ);
|
|
8889
|
+
product = clamp(product, -1.0, 1.0);
|
|
8890
|
+
var quat = [];
|
|
8891
|
+
|
|
8892
|
+
if (product === 1.0) {
|
|
8893
|
+
quat = fromQ;
|
|
8894
|
+
} else {
|
|
8895
|
+
var theta = Math.acos(product);
|
|
8896
|
+
var w = Math.sin(f * theta) * 1 / Math.sqrt(1 - product * product);
|
|
8897
|
+
|
|
8898
|
+
for (var i = 0; i < 4; i++) {
|
|
8899
|
+
quat.push(fromQ[i] * (Math.cos(f * theta) - product * w) + toQ[i] * w);
|
|
8900
|
+
}
|
|
8901
|
+
}
|
|
8902
|
+
|
|
8903
|
+
return quat;
|
|
8904
|
+
} // scalex/y/z -> scale
|
|
8905
|
+
|
|
8628
8906
|
|
|
8629
8907
|
function typeTo2D(type) {
|
|
8630
8908
|
return type.replace(/[xy]/, '');
|
|
@@ -8654,7 +8932,7 @@ function mergeTransforms(left, right, target) {
|
|
|
8654
8932
|
type = _left$i.t,
|
|
8655
8933
|
args = _left$i.d; // none -> scale(1)/translateX(0)
|
|
8656
8934
|
|
|
8657
|
-
var defaultValue = type.
|
|
8935
|
+
var defaultValue = type.substring(0, 5) === 'scale' ? 1 : 0;
|
|
8658
8936
|
right.push({
|
|
8659
8937
|
t: type,
|
|
8660
8938
|
d: args.map(function (arg) {
|
|
@@ -8679,21 +8957,31 @@ function mergeTransforms(left, right, target) {
|
|
|
8679
8957
|
var rightResult = [];
|
|
8680
8958
|
var types = []; // merge matrix() with matrix3d()
|
|
8681
8959
|
|
|
8682
|
-
if (left.length !== right.length)
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8960
|
+
if (left.length !== right.length) {
|
|
8961
|
+
var merged = mergeMatrices(left, right); // @ts-ignore
|
|
8962
|
+
|
|
8963
|
+
leftResult = [merged[0]]; // @ts-ignore
|
|
8964
|
+
|
|
8965
|
+
rightResult = [merged[1]];
|
|
8966
|
+
types = [['matrix', [merged[2]]]];
|
|
8967
|
+
} else {
|
|
8968
|
+
for (var _i3 = 0; _i3 < left.length; _i3++) {
|
|
8969
|
+
var leftType = left[_i3].t;
|
|
8970
|
+
var rightType = right[_i3].t;
|
|
8971
|
+
var leftArgs = left[_i3].d;
|
|
8972
|
+
var rightArgs = right[_i3].d;
|
|
8688
8973
|
var leftFunctionData = transformFunctions[leftType];
|
|
8689
8974
|
var rightFunctionData = transformFunctions[rightType];
|
|
8690
8975
|
var type = void 0;
|
|
8691
8976
|
|
|
8692
8977
|
if (isMatrixOrPerspective(leftType, rightType)) {
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8978
|
+
var _merged = mergeMatrices([left[_i3]], [right[_i3]]); // @ts-ignore
|
|
8979
|
+
|
|
8980
|
+
|
|
8981
|
+
leftResult.push(_merged[0]); // @ts-ignore
|
|
8982
|
+
|
|
8983
|
+
rightResult.push(_merged[1]);
|
|
8984
|
+
types.push(['matrix', [_merged[2]]]);
|
|
8697
8985
|
continue;
|
|
8698
8986
|
} else if (leftType === rightType) {
|
|
8699
8987
|
type = leftType;
|
|
@@ -8710,10 +8998,13 @@ function mergeTransforms(left, right, target) {
|
|
|
8710
8998
|
|
|
8711
8999
|
rightArgs = rightFunctionData[1](rightArgs);
|
|
8712
9000
|
} else {
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
9001
|
+
var _merged2 = mergeMatrices(left, right); // @ts-ignore
|
|
9002
|
+
|
|
9003
|
+
|
|
9004
|
+
leftResult = [_merged2[0]]; // @ts-ignore
|
|
9005
|
+
|
|
9006
|
+
rightResult = [_merged2[1]];
|
|
9007
|
+
types = [['matrix', [_merged2[2]]]];
|
|
8717
9008
|
break;
|
|
8718
9009
|
}
|
|
8719
9010
|
|
|
@@ -8724,10 +9015,11 @@ function mergeTransforms(left, right, target) {
|
|
|
8724
9015
|
for (var j = 0; j < leftArgs.length; j++) {
|
|
8725
9016
|
var merge = leftArgs[j].unit === UnitType.kNumber ? mergeNumbers : mergeDimensions; // @ts-ignore
|
|
8726
9017
|
|
|
8727
|
-
var
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
9018
|
+
var _merged3 = merge(leftArgs[j], rightArgs[j], target, false, j);
|
|
9019
|
+
|
|
9020
|
+
leftArgsCopy[j] = _merged3[0];
|
|
9021
|
+
rightArgsCopy[j] = _merged3[1];
|
|
9022
|
+
stringConversions.push(_merged3[2]);
|
|
8731
9023
|
}
|
|
8732
9024
|
|
|
8733
9025
|
leftResult.push(leftArgsCopy);
|
|
@@ -8869,8 +9161,8 @@ var ElementEvent;
|
|
|
8869
9161
|
*/
|
|
8870
9162
|
|
|
8871
9163
|
ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
|
|
8872
|
-
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
|
|
8873
|
-
|
|
9164
|
+
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed"; // GEOMETRY_BOUNDS_CHANGED = 'geometry-bounds-changed',
|
|
9165
|
+
|
|
8874
9166
|
/**
|
|
8875
9167
|
* trigger when z-index changed
|
|
8876
9168
|
*/
|
|
@@ -9630,11 +9922,12 @@ var Transform = function Transform() {
|
|
|
9630
9922
|
this.localDirtyFlag = false;
|
|
9631
9923
|
this.frozen = false;
|
|
9632
9924
|
this.localPosition = vec3.fromValues(0, 0, 0);
|
|
9633
|
-
this.localRotation = quat.fromValues(0, 0, 0, 1);
|
|
9925
|
+
this.localRotation = quat$1.fromValues(0, 0, 0, 1);
|
|
9634
9926
|
this.localScale = vec3.fromValues(1, 1, 1);
|
|
9635
9927
|
this.localTransform = mat4.create();
|
|
9928
|
+
this.localSkew = vec2.fromValues(0, 0);
|
|
9636
9929
|
this.position = vec3.fromValues(0, 0, 0);
|
|
9637
|
-
this.rotation = quat.fromValues(0, 0, 0, 1);
|
|
9930
|
+
this.rotation = quat$1.fromValues(0, 0, 0, 1);
|
|
9638
9931
|
this.scaling = vec3.fromValues(1, 1, 1);
|
|
9639
9932
|
this.worldTransform = mat4.create();
|
|
9640
9933
|
this.origin = vec3.fromValues(0, 0, 0);
|
|
@@ -11085,7 +11378,8 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
11085
11378
|
fontVariant: '',
|
|
11086
11379
|
textAlign: '',
|
|
11087
11380
|
textBaseline: '',
|
|
11088
|
-
textTransform: ''
|
|
11381
|
+
textTransform: '',
|
|
11382
|
+
zIndex: ''
|
|
11089
11383
|
};
|
|
11090
11384
|
/**
|
|
11091
11385
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
@@ -11117,7 +11411,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11117
11411
|
* push to active animations after calling `animate()`
|
|
11118
11412
|
*/
|
|
11119
11413
|
function DisplayObject(config) {
|
|
11120
|
-
var _this$config$capture
|
|
11414
|
+
var _this$config$capture;
|
|
11121
11415
|
|
|
11122
11416
|
var _this;
|
|
11123
11417
|
|
|
@@ -11141,10 +11435,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11141
11435
|
|
|
11142
11436
|
_this.nodeName = _this.config.type || Shape.GROUP; // compatible with G 3.0
|
|
11143
11437
|
|
|
11144
|
-
_this.config.style = _extends({}, DEFAULT_STYLE_PROPS,
|
|
11145
|
-
zIndex: (_this$config$zIndex = _this.config.zIndex) !== null && _this$config$zIndex !== void 0 ? _this$config$zIndex : 0,
|
|
11146
|
-
interactive: (_this$config$interact = _this.config.interactive) !== null && _this$config$interact !== void 0 ? _this$config$interact : true
|
|
11147
|
-
}, _this.config.style, _this.config.attrs);
|
|
11438
|
+
_this.config.style = _extends({}, DEFAULT_STYLE_PROPS, _this.config.style, _this.config.attrs);
|
|
11148
11439
|
|
|
11149
11440
|
if (_this.config.visible != null) {
|
|
11150
11441
|
_this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
|
|
@@ -11275,8 +11566,8 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11275
11566
|
var oldParsedValue = this.parsedStyle[name];
|
|
11276
11567
|
this.styleValueRegistry.processProperties(this, (_this$styleValueRegis = {}, _this$styleValueRegis[name] = value, _this$styleValueRegis), parseOptions); // inform clip path targets
|
|
11277
11568
|
|
|
11278
|
-
if (this.
|
|
11279
|
-
this.
|
|
11569
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
11570
|
+
this.parsedStyle.clipPathTargets.forEach(function (target) {
|
|
11280
11571
|
dirtifyToRoot(target);
|
|
11281
11572
|
target.dispatchEvent(new MutationEvent(ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
|
|
11282
11573
|
|
|
@@ -11546,6 +11837,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11546
11837
|
return this;
|
|
11547
11838
|
};
|
|
11548
11839
|
|
|
11840
|
+
_proto.setLocalSkew = function setLocalSkew(skew, y) {
|
|
11841
|
+
this.sceneGraphService.setLocalSkew(this, skew, y);
|
|
11842
|
+
return this;
|
|
11843
|
+
};
|
|
11844
|
+
|
|
11549
11845
|
_proto.getRotation = function getRotation() {
|
|
11550
11846
|
return this.sceneGraphService.getRotation(this);
|
|
11551
11847
|
};
|
|
@@ -11554,6 +11850,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11554
11850
|
return this.sceneGraphService.getLocalRotation(this);
|
|
11555
11851
|
};
|
|
11556
11852
|
|
|
11853
|
+
_proto.getLocalSkew = function getLocalSkew() {
|
|
11854
|
+
return this.sceneGraphService.getLocalSkew(this);
|
|
11855
|
+
};
|
|
11856
|
+
|
|
11557
11857
|
_proto.getLocalTransform = function getLocalTransform() {
|
|
11558
11858
|
return this.sceneGraphService.getLocalTransform(this);
|
|
11559
11859
|
};
|
|
@@ -11592,10 +11892,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11592
11892
|
|
|
11593
11893
|
var timeline = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.timeline; // account for clip path, use target's timeline
|
|
11594
11894
|
|
|
11595
|
-
if (this.
|
|
11895
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
11596
11896
|
var _target$ownerDocument;
|
|
11597
11897
|
|
|
11598
|
-
var target = this.
|
|
11898
|
+
var target = this.parsedStyle.clipPathTargets[0];
|
|
11599
11899
|
timeline = (_target$ownerDocument = target.ownerDocument) === null || _target$ownerDocument === void 0 ? void 0 : _target$ownerDocument.timeline;
|
|
11600
11900
|
} // clear old parsed transform
|
|
11601
11901
|
|
|
@@ -11889,7 +12189,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11889
12189
|
sx = _mat4$getScaling[0],
|
|
11890
12190
|
sy = _mat4$getScaling[1];
|
|
11891
12191
|
|
|
11892
|
-
var rotation = mat4.getRotation(quat.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12192
|
+
var rotation = mat4.getRotation(quat$1.create(), transform); // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11893
12193
|
|
|
11894
12194
|
var _getEuler3 = getEuler(vec3.create(), rotation),
|
|
11895
12195
|
eux = _getEuler3[0],
|
|
@@ -12001,9 +12301,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12001
12301
|
style: _extends({
|
|
12002
12302
|
cx: '',
|
|
12003
12303
|
cy: '',
|
|
12004
|
-
r: ''
|
|
12005
|
-
anchor: '0.5 0.5',
|
|
12006
|
-
transformOrigin: 'center'
|
|
12304
|
+
r: ''
|
|
12007
12305
|
}, style)
|
|
12008
12306
|
}, rest)) || this;
|
|
12009
12307
|
}
|
|
@@ -12026,9 +12324,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
12026
12324
|
cx: '',
|
|
12027
12325
|
cy: '',
|
|
12028
12326
|
rx: '',
|
|
12029
|
-
ry: ''
|
|
12030
|
-
anchor: '0.5 0.5',
|
|
12031
|
-
transformOrigin: 'center'
|
|
12327
|
+
ry: ''
|
|
12032
12328
|
}, style)
|
|
12033
12329
|
}, rest)) || this;
|
|
12034
12330
|
}
|
|
@@ -14138,7 +14434,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14138
14434
|
this.sceneGraphSelectorFactory = void 0;
|
|
14139
14435
|
|
|
14140
14436
|
this.rotate = function () {
|
|
14141
|
-
var parentInvertRotation = quat.create();
|
|
14437
|
+
var parentInvertRotation = quat$1.create();
|
|
14142
14438
|
return function (element, degrees, y, z) {
|
|
14143
14439
|
if (y === void 0) {
|
|
14144
14440
|
y = 0;
|
|
@@ -14157,18 +14453,18 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14157
14453
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
14158
14454
|
_this.rotateLocal(element, degrees);
|
|
14159
14455
|
} else {
|
|
14160
|
-
var rotation = quat.create();
|
|
14161
|
-
quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
14456
|
+
var rotation = quat$1.create();
|
|
14457
|
+
quat$1.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
14162
14458
|
|
|
14163
14459
|
var rot = _this.getRotation(element);
|
|
14164
14460
|
|
|
14165
14461
|
var parentRot = _this.getRotation(element.parentNode);
|
|
14166
14462
|
|
|
14167
|
-
quat.copy(parentInvertRotation, parentRot);
|
|
14168
|
-
quat.invert(parentInvertRotation, parentInvertRotation);
|
|
14169
|
-
quat.multiply(rotation, parentInvertRotation, rotation);
|
|
14170
|
-
quat.multiply(transform.localRotation, rotation, rot);
|
|
14171
|
-
quat.normalize(transform.localRotation, transform.localRotation);
|
|
14463
|
+
quat$1.copy(parentInvertRotation, parentRot);
|
|
14464
|
+
quat$1.invert(parentInvertRotation, parentInvertRotation);
|
|
14465
|
+
quat$1.multiply(rotation, parentInvertRotation, rotation);
|
|
14466
|
+
quat$1.multiply(transform.localRotation, rotation, rot);
|
|
14467
|
+
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
14172
14468
|
|
|
14173
14469
|
_this.dirtifyLocal(element, transform);
|
|
14174
14470
|
}
|
|
@@ -14176,7 +14472,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14176
14472
|
}();
|
|
14177
14473
|
|
|
14178
14474
|
this.rotateLocal = function () {
|
|
14179
|
-
var rotation = quat.create();
|
|
14475
|
+
var rotation = quat$1.create();
|
|
14180
14476
|
return function (element, degrees, y, z) {
|
|
14181
14477
|
if (y === void 0) {
|
|
14182
14478
|
y = 0;
|
|
@@ -14191,15 +14487,15 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14191
14487
|
}
|
|
14192
14488
|
|
|
14193
14489
|
var transform = element.transformable;
|
|
14194
|
-
quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
14195
|
-
quat.mul(transform.localRotation, transform.localRotation, rotation);
|
|
14490
|
+
quat$1.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
14491
|
+
quat$1.mul(transform.localRotation, transform.localRotation, rotation);
|
|
14196
14492
|
|
|
14197
14493
|
_this.dirtifyLocal(element, transform);
|
|
14198
14494
|
};
|
|
14199
14495
|
}();
|
|
14200
14496
|
|
|
14201
14497
|
this.setEulerAngles = function () {
|
|
14202
|
-
var invParentRot = quat.create();
|
|
14498
|
+
var invParentRot = quat$1.create();
|
|
14203
14499
|
return function (element, degrees, y, z) {
|
|
14204
14500
|
if (y === void 0) {
|
|
14205
14501
|
y = 0;
|
|
@@ -14218,12 +14514,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14218
14514
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
14219
14515
|
_this.setLocalEulerAngles(element, degrees);
|
|
14220
14516
|
} else {
|
|
14221
|
-
quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14517
|
+
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14222
14518
|
|
|
14223
14519
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
14224
14520
|
|
|
14225
|
-
quat.copy(invParentRot, quat.invert(quat.create(), parentRotation));
|
|
14226
|
-
quat.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
14521
|
+
quat$1.copy(invParentRot, quat$1.invert(quat$1.create(), parentRotation));
|
|
14522
|
+
quat$1.mul(transform.localRotation, transform.localRotation, invParentRot);
|
|
14227
14523
|
|
|
14228
14524
|
_this.dirtifyLocal(element, transform);
|
|
14229
14525
|
}
|
|
@@ -14308,12 +14604,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14308
14604
|
}();
|
|
14309
14605
|
|
|
14310
14606
|
this.setRotation = function () {
|
|
14311
|
-
var parentInvertRotation = quat.create();
|
|
14607
|
+
var parentInvertRotation = quat$1.create();
|
|
14312
14608
|
return function (element, rotation, y, z, w) {
|
|
14313
14609
|
var transform = element.transformable;
|
|
14314
14610
|
|
|
14315
14611
|
if (typeof rotation === 'number') {
|
|
14316
|
-
rotation = quat.fromValues(rotation, y, z, w);
|
|
14612
|
+
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
14317
14613
|
}
|
|
14318
14614
|
|
|
14319
14615
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
@@ -14321,10 +14617,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14321
14617
|
} else {
|
|
14322
14618
|
var parentRot = _this.getRotation(element.parentNode);
|
|
14323
14619
|
|
|
14324
|
-
quat.copy(parentInvertRotation, parentRot);
|
|
14325
|
-
quat.invert(parentInvertRotation, parentInvertRotation);
|
|
14326
|
-
quat.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
14327
|
-
quat.normalize(transform.localRotation, transform.localRotation);
|
|
14620
|
+
quat$1.copy(parentInvertRotation, parentRot);
|
|
14621
|
+
quat$1.invert(parentInvertRotation, parentInvertRotation);
|
|
14622
|
+
quat$1.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
14623
|
+
quat$1.normalize(transform.localRotation, transform.localRotation);
|
|
14328
14624
|
|
|
14329
14625
|
_this.dirtifyLocal(element, transform);
|
|
14330
14626
|
}
|
|
@@ -14469,7 +14765,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14469
14765
|
}
|
|
14470
14766
|
|
|
14471
14767
|
var transform = element.transformable;
|
|
14472
|
-
quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14768
|
+
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14473
14769
|
this.dirtifyLocal(element, transform);
|
|
14474
14770
|
}
|
|
14475
14771
|
/**
|
|
@@ -14535,11 +14831,21 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14535
14831
|
|
|
14536
14832
|
_proto.setLocalRotation = function setLocalRotation(element, rotation, y, z, w) {
|
|
14537
14833
|
if (typeof rotation === 'number') {
|
|
14538
|
-
rotation = quat.fromValues(rotation, y, z, w);
|
|
14834
|
+
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
14835
|
+
}
|
|
14836
|
+
|
|
14837
|
+
var transform = element.transformable;
|
|
14838
|
+
quat$1.copy(transform.localRotation, rotation);
|
|
14839
|
+
this.dirtifyLocal(element, transform);
|
|
14840
|
+
};
|
|
14841
|
+
|
|
14842
|
+
_proto.setLocalSkew = function setLocalSkew(element, skew, y) {
|
|
14843
|
+
if (typeof skew === 'number') {
|
|
14844
|
+
skew = vec2.fromValues(skew, y);
|
|
14539
14845
|
}
|
|
14540
14846
|
|
|
14541
14847
|
var transform = element.transformable;
|
|
14542
|
-
|
|
14848
|
+
vec2.copy(transform.localSkew, skew);
|
|
14543
14849
|
this.dirtifyLocal(element, transform);
|
|
14544
14850
|
};
|
|
14545
14851
|
|
|
@@ -14606,11 +14912,37 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14606
14912
|
return element.transformable.localScale;
|
|
14607
14913
|
};
|
|
14608
14914
|
|
|
14915
|
+
_proto.getLocalSkew = function getLocalSkew(element) {
|
|
14916
|
+
return element.transformable.localSkew;
|
|
14917
|
+
};
|
|
14918
|
+
|
|
14919
|
+
_proto.calcLocalTransform = function calcLocalTransform(transform) {
|
|
14920
|
+
// @see https://github.com/mattdesl/css-mat4/blob/master/index.js
|
|
14921
|
+
// mat4.fromRotationTranslationScaleOrigin(
|
|
14922
|
+
// transform.localTransform,
|
|
14923
|
+
// transform.localRotation,
|
|
14924
|
+
// transform.localPosition,
|
|
14925
|
+
// transform.localScale,
|
|
14926
|
+
// transform.origin,
|
|
14927
|
+
// );
|
|
14928
|
+
mat4.fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, vec3.fromValues(1, 1, 1), transform.origin); // apply skew2D
|
|
14929
|
+
|
|
14930
|
+
if (transform.localSkew[0] !== 0 || transform.localSkew[1] !== 0) {
|
|
14931
|
+
var tmpMat4 = mat4.identity(mat4.create());
|
|
14932
|
+
tmpMat4[4] = Math.tan(transform.localSkew[0]);
|
|
14933
|
+
tmpMat4[1] = Math.tan(transform.localSkew[1]);
|
|
14934
|
+
mat4.multiply(transform.localTransform, transform.localTransform, tmpMat4);
|
|
14935
|
+
}
|
|
14936
|
+
|
|
14937
|
+
var scaling = mat4.fromRotationTranslationScaleOrigin(mat4.create(), quat$1.fromValues(0, 0, 0, 1), vec3.create(), transform.localScale, transform.origin);
|
|
14938
|
+
mat4.multiply(transform.localTransform, transform.localTransform, scaling);
|
|
14939
|
+
};
|
|
14940
|
+
|
|
14609
14941
|
_proto.getLocalTransform = function getLocalTransform(element) {
|
|
14610
14942
|
var transform = element.transformable;
|
|
14611
14943
|
|
|
14612
14944
|
if (transform.localDirtyFlag) {
|
|
14613
|
-
|
|
14945
|
+
this.calcLocalTransform(transform);
|
|
14614
14946
|
transform.localDirtyFlag = false;
|
|
14615
14947
|
}
|
|
14616
14948
|
|
|
@@ -14619,7 +14951,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14619
14951
|
|
|
14620
14952
|
_proto.setLocalTransform = function setLocalTransform(element, transform) {
|
|
14621
14953
|
var t = mat4.getTranslation(vec3.create(), transform);
|
|
14622
|
-
var r = mat4.getRotation(quat.create(), transform);
|
|
14954
|
+
var r = mat4.getRotation(quat$1.create(), transform);
|
|
14623
14955
|
var s = mat4.getScaling(vec3.create(), transform);
|
|
14624
14956
|
this.setLocalScale(element, s);
|
|
14625
14957
|
this.setLocalPosition(element, t);
|
|
@@ -14630,6 +14962,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14630
14962
|
this.setLocalScale(element, [1, 1, 1]);
|
|
14631
14963
|
this.setLocalPosition(element, [0, 0, 0]);
|
|
14632
14964
|
this.setLocalEulerAngles(element, [0, 0, 0]);
|
|
14965
|
+
this.setLocalSkew(element, [0, 0]);
|
|
14633
14966
|
};
|
|
14634
14967
|
|
|
14635
14968
|
_proto.getTransformedGeometryBounds = function getTransformedGeometryBounds(element, render) {
|
|
@@ -14658,8 +14991,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14658
14991
|
}
|
|
14659
14992
|
|
|
14660
14993
|
var geometry = element.geometry;
|
|
14661
|
-
var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
|
|
14662
|
-
|
|
14994
|
+
var bounds = render ? geometry.renderBounds : geometry.contentBounds || null; // return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
|
|
14995
|
+
|
|
14996
|
+
return bounds || new AABB();
|
|
14663
14997
|
}
|
|
14664
14998
|
/**
|
|
14665
14999
|
* account for children in world space
|
|
@@ -14837,7 +15171,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14837
15171
|
|
|
14838
15172
|
_proto.sync = function sync(element, transform) {
|
|
14839
15173
|
if (transform.localDirtyFlag) {
|
|
14840
|
-
|
|
15174
|
+
this.calcLocalTransform(transform);
|
|
14841
15175
|
transform.localDirtyFlag = false;
|
|
14842
15176
|
}
|
|
14843
15177
|
|
|
@@ -15641,11 +15975,11 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
15641
15975
|
this.roll += this.relRoll;
|
|
15642
15976
|
|
|
15643
15977
|
if (this.type === CameraType.EXPLORING) {
|
|
15644
|
-
var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld ? 1 : -1) * this.relElevation * DEG_2_RAD);
|
|
15645
|
-
var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.relAzimuth * DEG_2_RAD);
|
|
15646
|
-
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.relRoll * DEG_2_RAD);
|
|
15647
|
-
var rotQ = quat.multiply(quat.create(), rotY, rotX);
|
|
15648
|
-
rotQ = quat.multiply(quat.create(), rotQ, rotZ);
|
|
15978
|
+
var rotX = quat$1.setAxisAngle(quat$1.create(), [1, 0, 0], (this.rotateWorld ? 1 : -1) * this.relElevation * DEG_2_RAD);
|
|
15979
|
+
var rotY = quat$1.setAxisAngle(quat$1.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.relAzimuth * DEG_2_RAD);
|
|
15980
|
+
var rotZ = quat$1.setAxisAngle(quat$1.create(), [0, 0, 1], this.relRoll * DEG_2_RAD);
|
|
15981
|
+
var rotQ = quat$1.multiply(quat$1.create(), rotY, rotX);
|
|
15982
|
+
rotQ = quat$1.multiply(quat$1.create(), rotQ, rotZ);
|
|
15649
15983
|
var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
|
|
15650
15984
|
mat4.translate(this.matrix, this.matrix, [0, 0, -this.distance]);
|
|
15651
15985
|
mat4.multiply(this.matrix, this.matrix, rotMatrix);
|
|
@@ -15899,13 +16233,13 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
15899
16233
|
_proto.computeMatrix = function computeMatrix() {
|
|
15900
16234
|
// 使用四元数描述 3D 旋转
|
|
15901
16235
|
// @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
|
|
15902
|
-
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.roll * DEG_2_RAD);
|
|
16236
|
+
var rotZ = quat$1.setAxisAngle(quat$1.create(), [0, 0, 1], this.roll * DEG_2_RAD);
|
|
15903
16237
|
mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
|
|
15904
16238
|
|
|
15905
|
-
var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld && this.type !== CameraType.TRACKING || this.type === CameraType.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
15906
|
-
var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld && this.type !== CameraType.TRACKING || this.type === CameraType.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
|
|
15907
|
-
var rotQ = quat.multiply(quat.create(), rotY, rotX);
|
|
15908
|
-
rotQ = quat.multiply(quat.create(), rotQ, rotZ);
|
|
16239
|
+
var rotX = quat$1.setAxisAngle(quat$1.create(), [1, 0, 0], (this.rotateWorld && this.type !== CameraType.TRACKING || this.type === CameraType.TRACKING ? 1 : -1) * this.elevation * DEG_2_RAD);
|
|
16240
|
+
var rotY = quat$1.setAxisAngle(quat$1.create(), [0, 1, 0], (this.rotateWorld && this.type !== CameraType.TRACKING || this.type === CameraType.TRACKING ? 1 : -1) * this.azimuth * DEG_2_RAD);
|
|
16241
|
+
var rotQ = quat$1.multiply(quat$1.create(), rotY, rotX);
|
|
16242
|
+
rotQ = quat$1.multiply(quat$1.create(), rotQ, rotZ);
|
|
15909
16243
|
var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
|
|
15910
16244
|
|
|
15911
16245
|
if (this.type === CameraType.ORBITING || this.type === CameraType.EXPLORING) {
|
|
@@ -16014,7 +16348,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
16014
16348
|
}
|
|
16015
16349
|
|
|
16016
16350
|
var position = this.position;
|
|
16017
|
-
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], -this.roll * Math.PI / 180);
|
|
16351
|
+
var rotZ = quat$1.setAxisAngle(quat$1.create(), [0, 0, 1], -this.roll * Math.PI / 180);
|
|
16018
16352
|
mat4.fromRotationTranslationScaleOrigin(this.orthoMatrix, rotZ, vec3.fromValues((this.rright - this.left) / 2 - position[0], (this.top - this.bottom) / 2 - position[1], 0), vec3.fromValues(this.zoom, this.zoom, 1), position);
|
|
16019
16353
|
};
|
|
16020
16354
|
|
|
@@ -18277,17 +18611,17 @@ var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
|
18277
18611
|
} // clear ref to old clip path
|
|
18278
18612
|
|
|
18279
18613
|
|
|
18280
|
-
if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.
|
|
18281
|
-
var index = oldClipPath.
|
|
18282
|
-
oldClipPath.
|
|
18614
|
+
if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.parsedStyle.clipPathTargets) {
|
|
18615
|
+
var index = oldClipPath.parsedStyle.clipPathTargets.indexOf(object);
|
|
18616
|
+
oldClipPath.parsedStyle.clipPathTargets.splice(index, 1);
|
|
18283
18617
|
}
|
|
18284
18618
|
|
|
18285
18619
|
if (newClipPath) {
|
|
18286
|
-
if (!newClipPath.
|
|
18287
|
-
newClipPath.
|
|
18620
|
+
if (!newClipPath.parsedStyle.clipPathTargets) {
|
|
18621
|
+
newClipPath.parsedStyle.clipPathTargets = [];
|
|
18288
18622
|
}
|
|
18289
18623
|
|
|
18290
|
-
newClipPath.
|
|
18624
|
+
newClipPath.parsedStyle.clipPathTargets.push(object);
|
|
18291
18625
|
}
|
|
18292
18626
|
|
|
18293
18627
|
dirtifyToRoot(object);
|
|
@@ -18904,9 +19238,9 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
18904
19238
|
// reset transform
|
|
18905
19239
|
object.resetLocalTransform();
|
|
18906
19240
|
object.setLocalPosition(defX, defY);
|
|
18907
|
-
transform.forEach(function (
|
|
18908
|
-
var t =
|
|
18909
|
-
d =
|
|
19241
|
+
transform.forEach(function (parsed) {
|
|
19242
|
+
var t = parsed.t,
|
|
19243
|
+
d = parsed.d;
|
|
18910
19244
|
|
|
18911
19245
|
if (t === 'scale') {
|
|
18912
19246
|
// scale(1) scale(1, 1)
|
|
@@ -18972,7 +19306,24 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
18972
19306
|
var _newAngles3 = d || [Odeg];
|
|
18973
19307
|
|
|
18974
19308
|
object.rotateLocal(0, 0, _newAngles3[0].value);
|
|
18975
|
-
} else ;
|
|
19309
|
+
} else if (t === 'rotate3d') ; else if (t === 'skew') {
|
|
19310
|
+
var newSkew = d.map(function (s) {
|
|
19311
|
+
return s.value;
|
|
19312
|
+
}) || [0, 0];
|
|
19313
|
+
object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
|
|
19314
|
+
} else if (t === 'skewx') {
|
|
19315
|
+
var _newSkew = d.map(function (s) {
|
|
19316
|
+
return s.value;
|
|
19317
|
+
}) || [0];
|
|
19318
|
+
|
|
19319
|
+
object.setLocalSkew(deg2rad(_newSkew[0]), object.getLocalSkew()[1]);
|
|
19320
|
+
} else if (t === 'skewy') {
|
|
19321
|
+
var _newSkew2 = d.map(function (s) {
|
|
19322
|
+
return s.value;
|
|
19323
|
+
}) || [0];
|
|
19324
|
+
|
|
19325
|
+
object.setLocalSkew(object.getLocalSkew()[0], deg2rad(_newSkew2[0]));
|
|
19326
|
+
}
|
|
18976
19327
|
});
|
|
18977
19328
|
}
|
|
18978
19329
|
};
|
|
@@ -19227,13 +19578,25 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
19227
19578
|
name: 'transformOrigin',
|
|
19228
19579
|
parsePriority: 100,
|
|
19229
19580
|
// interpolable: true,
|
|
19230
|
-
defaultValue:
|
|
19581
|
+
defaultValue: function defaultValue(nodeName) {
|
|
19582
|
+
if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
19583
|
+
return 'center';
|
|
19584
|
+
}
|
|
19585
|
+
|
|
19586
|
+
return 'left top';
|
|
19587
|
+
},
|
|
19231
19588
|
layoutDependent: true,
|
|
19232
19589
|
syntax: PropertySyntax.TRANSFORM_ORIGIN
|
|
19233
19590
|
}, {
|
|
19234
19591
|
name: 'anchor',
|
|
19235
19592
|
parsePriority: 99,
|
|
19236
|
-
defaultValue:
|
|
19593
|
+
defaultValue: function defaultValue(nodeName) {
|
|
19594
|
+
if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
19595
|
+
return '0.5 0.5';
|
|
19596
|
+
}
|
|
19597
|
+
|
|
19598
|
+
return '0 0';
|
|
19599
|
+
},
|
|
19237
19600
|
layoutDependent: true,
|
|
19238
19601
|
syntax: PropertySyntax.LENGTH_PERCENTAGE_12
|
|
19239
19602
|
}, // <circle> & <ellipse>
|
|
@@ -19658,7 +20021,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
19658
20021
|
if (value === 'initial') {
|
|
19659
20022
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
|
|
19660
20023
|
if (!isNil(defaultValue)) {
|
|
19661
|
-
computed = this.parseProperty(name, defaultValue, object);
|
|
20024
|
+
computed = this.parseProperty(name, isFunction(defaultValue) ? defaultValue(object.nodeName) : defaultValue, object);
|
|
19662
20025
|
}
|
|
19663
20026
|
} else if (value === 'inherit') {
|
|
19664
20027
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
|
|
@@ -19898,8 +20261,8 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
19898
20261
|
var usedOriginYValue = (flipX ? -1 : 1) * convertPercentUnit(transformOrigin[1], 1, object);
|
|
19899
20262
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
19900
20263
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
19901
|
-
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
19902
|
-
|
|
20264
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue); // object.dispatchEvent(new CustomEvent(ElementEvent.GEOMETRY_BOUNDS_CHANGED));
|
|
20265
|
+
|
|
19903
20266
|
dirtifyToRoot(object);
|
|
19904
20267
|
}
|
|
19905
20268
|
};
|
|
@@ -20099,7 +20462,7 @@ var AbstractRenderer = /*#__PURE__*/function () {
|
|
|
20099
20462
|
* only dirty object will cause re-render
|
|
20100
20463
|
*/
|
|
20101
20464
|
enableDirtyCheck: true,
|
|
20102
|
-
enableCulling:
|
|
20465
|
+
enableCulling: false,
|
|
20103
20466
|
|
|
20104
20467
|
/**
|
|
20105
20468
|
* enable auto rendering by default
|
|
@@ -20171,26 +20534,29 @@ var CullingPlugin = CullingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
|
20171
20534
|
_proto.apply = function apply(renderingService) {
|
|
20172
20535
|
var _this = this;
|
|
20173
20536
|
|
|
20174
|
-
|
|
20537
|
+
var strategies = this.strategyProvider.getContributions();
|
|
20175
20538
|
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
20176
20539
|
if (object) {
|
|
20177
|
-
var cullable = object.cullable;
|
|
20178
|
-
|
|
20179
|
-
//
|
|
20180
|
-
//
|
|
20181
|
-
// // } else {
|
|
20182
|
-
// // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
|
|
20183
|
-
// // const [p0, p1, p2, p3] = camera.getFrustum().planes;
|
|
20184
|
-
// // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
|
|
20185
|
-
// // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
|
|
20186
|
-
// // }
|
|
20187
|
-
// if (strategies.length === 0) {
|
|
20188
|
-
// cullable.visible = this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
|
|
20540
|
+
var cullable = object.cullable; // cullable.visible = true;
|
|
20541
|
+
// const renderBounds = object.getRenderBounds();
|
|
20542
|
+
// if (AABB.isEmpty(renderBounds)) {
|
|
20543
|
+
// cullable.visible = false;
|
|
20189
20544
|
// } else {
|
|
20190
|
-
//
|
|
20191
|
-
//
|
|
20545
|
+
// const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
|
|
20546
|
+
// const [p0, p1, p2, p3] = camera.getFrustum().planes;
|
|
20547
|
+
// tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
|
|
20548
|
+
// cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
|
|
20192
20549
|
// }
|
|
20193
20550
|
|
|
20551
|
+
if (strategies.length === 0) {
|
|
20552
|
+
cullable.visible = _this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
|
|
20553
|
+
} else {
|
|
20554
|
+
// eg. implemented by g-webgl(frustum culling)
|
|
20555
|
+
cullable.visible = strategies.every(function (strategy) {
|
|
20556
|
+
return strategy.isVisible(object);
|
|
20557
|
+
});
|
|
20558
|
+
}
|
|
20559
|
+
|
|
20194
20560
|
if (!cullable.isCulled() && object.isVisible()) {
|
|
20195
20561
|
return object;
|
|
20196
20562
|
} else {
|
|
@@ -21530,4 +21896,4 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21530
21896
|
GlobalContainer.load(containerModule);
|
|
21531
21897
|
var layoutEngine = GlobalContainer.get(LayoutEngine);
|
|
21532
21898
|
|
|
21533
|
-
export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, dirtifyToRoot, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
|
|
21899
|
+
export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertItemToMatrix, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, dirtifyToRoot, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
|