@antv/g 5.3.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/color.d.ts +4 -1
- package/dist/css/parser/color.d.ts.map +1 -1
- package/dist/css/parser/gradient.d.ts +4 -3
- package/dist/css/parser/gradient.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/CSSPropertyColor.d.ts +4 -1
- package/dist/css/properties/CSSPropertyColor.d.ts.map +1 -1
- package/dist/css/properties/CSSPropertyPath.d.ts +2 -12
- package/dist/css/properties/CSSPropertyPath.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 +565 -170
- package/dist/index.js +530 -132
- package/dist/index.umd.js +1679 -1494
- 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/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/interpolation.d.ts.map +1 -1
- package/dist/utils/memoize.d.ts +11 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/string.d.ts +4 -1
- package/dist/utils/string.d.ts.map +1 -1
- package/package.json +6 -7
package/dist/index.esm.js
CHANGED
|
@@ -4,12 +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 {
|
|
11
|
-
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';
|
|
12
11
|
import { Polyline as Polyline$1, Line as Line$1 } from '@antv/g-math';
|
|
12
|
+
import decomposeMatrix from 'mat4-decompose';
|
|
13
13
|
import { requestAnimationFrame as requestAnimationFrame$1, cancelAnimationFrame as cancelAnimationFrame$1 } from 'request-animation-frame-polyfill';
|
|
14
14
|
|
|
15
15
|
function _regeneratorRuntime() {
|
|
@@ -1234,7 +1234,7 @@ var convertToDash = function convertToDash(str) {
|
|
|
1234
1234
|
return "-" + letter.toLowerCase();
|
|
1235
1235
|
}); // Remove first dash
|
|
1236
1236
|
|
|
1237
|
-
return str.charAt(0) === '-' ? str.
|
|
1237
|
+
return str.charAt(0) === '-' ? str.substring(1) : str;
|
|
1238
1238
|
};
|
|
1239
1239
|
/**
|
|
1240
1240
|
Easing Functions from anime.js, they are tried and true, so, its better to use them instead of other alternatives
|
|
@@ -2333,20 +2333,45 @@ function calculateIterationProgress(activeDuration, localTime, timing) {
|
|
|
2333
2333
|
return timing.easingFunction(directedProgress);
|
|
2334
2334
|
}
|
|
2335
2335
|
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
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');
|
|
2340
2342
|
}
|
|
2341
2343
|
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
}
|
|
2346
|
-
|
|
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
|
+
}
|
|
2348
|
+
|
|
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
|
+
}
|
|
2347
2355
|
|
|
2348
|
-
|
|
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;
|
|
2349
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
|
+
});
|
|
2350
2375
|
function isString(str) {
|
|
2351
2376
|
if (!isNil(str) && typeof str === 'string') {
|
|
2352
2377
|
return true;
|
|
@@ -2552,15 +2577,33 @@ var FORMAT_ATTR_MAP = {
|
|
|
2552
2577
|
alias: 'img'
|
|
2553
2578
|
}
|
|
2554
2579
|
};
|
|
2555
|
-
function
|
|
2556
|
-
var _map$values;
|
|
2557
|
-
|
|
2580
|
+
var formatAttributeName = memoize(function (name) {
|
|
2558
2581
|
var attributeName = camelCase(name);
|
|
2559
2582
|
var map = FORMAT_ATTR_MAP[attributeName];
|
|
2560
2583
|
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
2561
|
-
|
|
2584
|
+
return [attributeName, map];
|
|
2585
|
+
});
|
|
2586
|
+
function formatAttribute(name, value) {
|
|
2587
|
+
var _map$values;
|
|
2588
|
+
|
|
2589
|
+
var _formatAttributeName = formatAttributeName(name),
|
|
2590
|
+
attributeName = _formatAttributeName[0],
|
|
2591
|
+
map = _formatAttributeName[1];
|
|
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;
|
|
2562
2594
|
return [attributeName, attributeValue];
|
|
2563
|
-
}
|
|
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
|
+
// );
|
|
2564
2607
|
|
|
2565
2608
|
var Shape;
|
|
2566
2609
|
|
|
@@ -8157,7 +8200,7 @@ function mergeNumberLists(left, right) {
|
|
|
8157
8200
|
}];
|
|
8158
8201
|
}
|
|
8159
8202
|
|
|
8160
|
-
var
|
|
8203
|
+
var memoizedParsePath = memoize(function (path) {
|
|
8161
8204
|
var absolutePath;
|
|
8162
8205
|
|
|
8163
8206
|
try {
|
|
@@ -8189,11 +8232,6 @@ var parsePath = memoize(function (path, object) {
|
|
|
8189
8232
|
height = _getPathBBoxTotalLeng.height,
|
|
8190
8233
|
length = _getPathBBoxTotalLeng.length;
|
|
8191
8234
|
|
|
8192
|
-
if (object) {
|
|
8193
|
-
object.parsedStyle.defX = x;
|
|
8194
|
-
object.parsedStyle.defY = y;
|
|
8195
|
-
}
|
|
8196
|
-
|
|
8197
8235
|
return {
|
|
8198
8236
|
absolutePath: absolutePath,
|
|
8199
8237
|
hasArc: hasArc,
|
|
@@ -8205,7 +8243,19 @@ var parsePath = memoize(function (path, object) {
|
|
|
8205
8243
|
zCommandIndexes: zCommandIndexes,
|
|
8206
8244
|
rect: new Rectangle(x, y, width, height)
|
|
8207
8245
|
};
|
|
8246
|
+
}, function (path) {
|
|
8247
|
+
return isString(path) ? path : path2String(path);
|
|
8208
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;
|
|
8258
|
+
}
|
|
8209
8259
|
function mergePaths(left, right, object) {
|
|
8210
8260
|
var curve1 = left.curve;
|
|
8211
8261
|
var curve2 = right.curve;
|
|
@@ -8461,22 +8511,23 @@ function id$1(x) {
|
|
|
8461
8511
|
|
|
8462
8512
|
|
|
8463
8513
|
var transformFunctions = {
|
|
8464
|
-
//
|
|
8465
|
-
|
|
8514
|
+
// @ts-ignore
|
|
8515
|
+
matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id$1],
|
|
8516
|
+
matrix3d: ['NNNNNNNNNNNNNNNN', id$1],
|
|
8466
8517
|
rotate: ['A'],
|
|
8467
8518
|
rotatex: ['A'],
|
|
8468
8519
|
rotatey: ['A'],
|
|
8469
8520
|
rotatez: ['A'],
|
|
8470
8521
|
rotate3d: ['NNNA'],
|
|
8471
|
-
|
|
8522
|
+
perspective: ['L'],
|
|
8472
8523
|
scale: ['Nn', cast([_, _, CSS.number(1)]), id$1],
|
|
8473
8524
|
scalex: ['N', cast([_, CSS.number(1), CSS.number(1)]), cast([_, CSS.number(1)])],
|
|
8474
8525
|
scaley: ['N', cast([CSS.number(1), _, CSS.number(1)]), cast([CSS.number(1), _])],
|
|
8475
8526
|
scalez: ['N', cast([CSS.number(1), CSS.number(1), _])],
|
|
8476
8527
|
scale3d: ['NNN', id$1],
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8528
|
+
skew: ['Aa', null, id$1],
|
|
8529
|
+
skewx: ['A', null, cast([_, Odeg])],
|
|
8530
|
+
skewy: ['A', null, cast([Odeg, _])],
|
|
8480
8531
|
translate: ['Tt', cast([_, _, Opx]), id$1],
|
|
8481
8532
|
translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
|
|
8482
8533
|
translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
|
|
@@ -8569,33 +8620,289 @@ function parseTransform(string) {
|
|
|
8569
8620
|
}
|
|
8570
8621
|
|
|
8571
8622
|
return [];
|
|
8572
|
-
}
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
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
|
+
|
|
8599
8906
|
|
|
8600
8907
|
function typeTo2D(type) {
|
|
8601
8908
|
return type.replace(/[xy]/, '');
|
|
@@ -8625,7 +8932,7 @@ function mergeTransforms(left, right, target) {
|
|
|
8625
8932
|
type = _left$i.t,
|
|
8626
8933
|
args = _left$i.d; // none -> scale(1)/translateX(0)
|
|
8627
8934
|
|
|
8628
|
-
var defaultValue = type.
|
|
8935
|
+
var defaultValue = type.substring(0, 5) === 'scale' ? 1 : 0;
|
|
8629
8936
|
right.push({
|
|
8630
8937
|
t: type,
|
|
8631
8938
|
d: args.map(function (arg) {
|
|
@@ -8650,21 +8957,31 @@ function mergeTransforms(left, right, target) {
|
|
|
8650
8957
|
var rightResult = [];
|
|
8651
8958
|
var types = []; // merge matrix() with matrix3d()
|
|
8652
8959
|
|
|
8653
|
-
if (left.length !== right.length)
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
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;
|
|
8659
8973
|
var leftFunctionData = transformFunctions[leftType];
|
|
8660
8974
|
var rightFunctionData = transformFunctions[rightType];
|
|
8661
8975
|
var type = void 0;
|
|
8662
8976
|
|
|
8663
8977
|
if (isMatrixOrPerspective(leftType, rightType)) {
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
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]]]);
|
|
8668
8985
|
continue;
|
|
8669
8986
|
} else if (leftType === rightType) {
|
|
8670
8987
|
type = leftType;
|
|
@@ -8681,10 +8998,13 @@ function mergeTransforms(left, right, target) {
|
|
|
8681
8998
|
|
|
8682
8999
|
rightArgs = rightFunctionData[1](rightArgs);
|
|
8683
9000
|
} else {
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
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]]]];
|
|
8688
9008
|
break;
|
|
8689
9009
|
}
|
|
8690
9010
|
|
|
@@ -8695,10 +9015,11 @@ function mergeTransforms(left, right, target) {
|
|
|
8695
9015
|
for (var j = 0; j < leftArgs.length; j++) {
|
|
8696
9016
|
var merge = leftArgs[j].unit === UnitType.kNumber ? mergeNumbers : mergeDimensions; // @ts-ignore
|
|
8697
9017
|
|
|
8698
|
-
var
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
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]);
|
|
8702
9023
|
}
|
|
8703
9024
|
|
|
8704
9025
|
leftResult.push(leftArgsCopy);
|
|
@@ -8840,8 +9161,8 @@ var ElementEvent;
|
|
|
8840
9161
|
*/
|
|
8841
9162
|
|
|
8842
9163
|
ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
|
|
8843
|
-
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
|
|
8844
|
-
|
|
9164
|
+
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed"; // GEOMETRY_BOUNDS_CHANGED = 'geometry-bounds-changed',
|
|
9165
|
+
|
|
8845
9166
|
/**
|
|
8846
9167
|
* trigger when z-index changed
|
|
8847
9168
|
*/
|
|
@@ -9601,11 +9922,12 @@ var Transform = function Transform() {
|
|
|
9601
9922
|
this.localDirtyFlag = false;
|
|
9602
9923
|
this.frozen = false;
|
|
9603
9924
|
this.localPosition = vec3.fromValues(0, 0, 0);
|
|
9604
|
-
this.localRotation = quat.fromValues(0, 0, 0, 1);
|
|
9925
|
+
this.localRotation = quat$1.fromValues(0, 0, 0, 1);
|
|
9605
9926
|
this.localScale = vec3.fromValues(1, 1, 1);
|
|
9606
9927
|
this.localTransform = mat4.create();
|
|
9928
|
+
this.localSkew = vec2.fromValues(0, 0);
|
|
9607
9929
|
this.position = vec3.fromValues(0, 0, 0);
|
|
9608
|
-
this.rotation = quat.fromValues(0, 0, 0, 1);
|
|
9930
|
+
this.rotation = quat$1.fromValues(0, 0, 0, 1);
|
|
9609
9931
|
this.scaling = vec3.fromValues(1, 1, 1);
|
|
9610
9932
|
this.worldTransform = mat4.create();
|
|
9611
9933
|
this.origin = vec3.fromValues(0, 0, 0);
|
|
@@ -11056,7 +11378,8 @@ var DEFAULT_STYLE_PROPS = {
|
|
|
11056
11378
|
fontVariant: '',
|
|
11057
11379
|
textAlign: '',
|
|
11058
11380
|
textBaseline: '',
|
|
11059
|
-
textTransform: ''
|
|
11381
|
+
textTransform: '',
|
|
11382
|
+
zIndex: ''
|
|
11060
11383
|
};
|
|
11061
11384
|
/**
|
|
11062
11385
|
* prototype chains: DisplayObject -> Element -> Node -> EventTarget
|
|
@@ -11088,7 +11411,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11088
11411
|
* push to active animations after calling `animate()`
|
|
11089
11412
|
*/
|
|
11090
11413
|
function DisplayObject(config) {
|
|
11091
|
-
var _this$config$capture
|
|
11414
|
+
var _this$config$capture;
|
|
11092
11415
|
|
|
11093
11416
|
var _this;
|
|
11094
11417
|
|
|
@@ -11112,10 +11435,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11112
11435
|
|
|
11113
11436
|
_this.nodeName = _this.config.type || Shape.GROUP; // compatible with G 3.0
|
|
11114
11437
|
|
|
11115
|
-
_this.config.style = _extends({}, DEFAULT_STYLE_PROPS,
|
|
11116
|
-
zIndex: (_this$config$zIndex = _this.config.zIndex) !== null && _this$config$zIndex !== void 0 ? _this$config$zIndex : 0,
|
|
11117
|
-
interactive: (_this$config$interact = _this.config.interactive) !== null && _this$config$interact !== void 0 ? _this$config$interact : true
|
|
11118
|
-
}, _this.config.style, _this.config.attrs);
|
|
11438
|
+
_this.config.style = _extends({}, DEFAULT_STYLE_PROPS, _this.config.style, _this.config.attrs);
|
|
11119
11439
|
|
|
11120
11440
|
if (_this.config.visible != null) {
|
|
11121
11441
|
_this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
|
|
@@ -11246,8 +11566,8 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11246
11566
|
var oldParsedValue = this.parsedStyle[name];
|
|
11247
11567
|
this.styleValueRegistry.processProperties(this, (_this$styleValueRegis = {}, _this$styleValueRegis[name] = value, _this$styleValueRegis), parseOptions); // inform clip path targets
|
|
11248
11568
|
|
|
11249
|
-
if (this.
|
|
11250
|
-
this.
|
|
11569
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
11570
|
+
this.parsedStyle.clipPathTargets.forEach(function (target) {
|
|
11251
11571
|
dirtifyToRoot(target);
|
|
11252
11572
|
target.dispatchEvent(new MutationEvent(ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
|
|
11253
11573
|
|
|
@@ -11517,6 +11837,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11517
11837
|
return this;
|
|
11518
11838
|
};
|
|
11519
11839
|
|
|
11840
|
+
_proto.setLocalSkew = function setLocalSkew(skew, y) {
|
|
11841
|
+
this.sceneGraphService.setLocalSkew(this, skew, y);
|
|
11842
|
+
return this;
|
|
11843
|
+
};
|
|
11844
|
+
|
|
11520
11845
|
_proto.getRotation = function getRotation() {
|
|
11521
11846
|
return this.sceneGraphService.getRotation(this);
|
|
11522
11847
|
};
|
|
@@ -11525,6 +11850,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11525
11850
|
return this.sceneGraphService.getLocalRotation(this);
|
|
11526
11851
|
};
|
|
11527
11852
|
|
|
11853
|
+
_proto.getLocalSkew = function getLocalSkew() {
|
|
11854
|
+
return this.sceneGraphService.getLocalSkew(this);
|
|
11855
|
+
};
|
|
11856
|
+
|
|
11528
11857
|
_proto.getLocalTransform = function getLocalTransform() {
|
|
11529
11858
|
return this.sceneGraphService.getLocalTransform(this);
|
|
11530
11859
|
};
|
|
@@ -11563,10 +11892,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11563
11892
|
|
|
11564
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
|
|
11565
11894
|
|
|
11566
|
-
if (this.
|
|
11895
|
+
if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
|
|
11567
11896
|
var _target$ownerDocument;
|
|
11568
11897
|
|
|
11569
|
-
var target = this.
|
|
11898
|
+
var target = this.parsedStyle.clipPathTargets[0];
|
|
11570
11899
|
timeline = (_target$ownerDocument = target.ownerDocument) === null || _target$ownerDocument === void 0 ? void 0 : _target$ownerDocument.timeline;
|
|
11571
11900
|
} // clear old parsed transform
|
|
11572
11901
|
|
|
@@ -11860,7 +12189,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
11860
12189
|
sx = _mat4$getScaling[0],
|
|
11861
12190
|
sy = _mat4$getScaling[1];
|
|
11862
12191
|
|
|
11863
|
-
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
|
|
11864
12193
|
|
|
11865
12194
|
var _getEuler3 = getEuler(vec3.create(), rotation),
|
|
11866
12195
|
eux = _getEuler3[0],
|
|
@@ -11972,9 +12301,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
11972
12301
|
style: _extends({
|
|
11973
12302
|
cx: '',
|
|
11974
12303
|
cy: '',
|
|
11975
|
-
r: ''
|
|
11976
|
-
anchor: '0.5 0.5',
|
|
11977
|
-
transformOrigin: 'center'
|
|
12304
|
+
r: ''
|
|
11978
12305
|
}, style)
|
|
11979
12306
|
}, rest)) || this;
|
|
11980
12307
|
}
|
|
@@ -11997,9 +12324,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
11997
12324
|
cx: '',
|
|
11998
12325
|
cy: '',
|
|
11999
12326
|
rx: '',
|
|
12000
|
-
ry: ''
|
|
12001
|
-
anchor: '0.5 0.5',
|
|
12002
|
-
transformOrigin: 'center'
|
|
12327
|
+
ry: ''
|
|
12003
12328
|
}, style)
|
|
12004
12329
|
}, rest)) || this;
|
|
12005
12330
|
}
|
|
@@ -14109,7 +14434,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14109
14434
|
this.sceneGraphSelectorFactory = void 0;
|
|
14110
14435
|
|
|
14111
14436
|
this.rotate = function () {
|
|
14112
|
-
var parentInvertRotation = quat.create();
|
|
14437
|
+
var parentInvertRotation = quat$1.create();
|
|
14113
14438
|
return function (element, degrees, y, z) {
|
|
14114
14439
|
if (y === void 0) {
|
|
14115
14440
|
y = 0;
|
|
@@ -14128,18 +14453,18 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14128
14453
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
14129
14454
|
_this.rotateLocal(element, degrees);
|
|
14130
14455
|
} else {
|
|
14131
|
-
var rotation = quat.create();
|
|
14132
|
-
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]);
|
|
14133
14458
|
|
|
14134
14459
|
var rot = _this.getRotation(element);
|
|
14135
14460
|
|
|
14136
14461
|
var parentRot = _this.getRotation(element.parentNode);
|
|
14137
14462
|
|
|
14138
|
-
quat.copy(parentInvertRotation, parentRot);
|
|
14139
|
-
quat.invert(parentInvertRotation, parentInvertRotation);
|
|
14140
|
-
quat.multiply(rotation, parentInvertRotation, rotation);
|
|
14141
|
-
quat.multiply(transform.localRotation, rotation, rot);
|
|
14142
|
-
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);
|
|
14143
14468
|
|
|
14144
14469
|
_this.dirtifyLocal(element, transform);
|
|
14145
14470
|
}
|
|
@@ -14147,7 +14472,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14147
14472
|
}();
|
|
14148
14473
|
|
|
14149
14474
|
this.rotateLocal = function () {
|
|
14150
|
-
var rotation = quat.create();
|
|
14475
|
+
var rotation = quat$1.create();
|
|
14151
14476
|
return function (element, degrees, y, z) {
|
|
14152
14477
|
if (y === void 0) {
|
|
14153
14478
|
y = 0;
|
|
@@ -14162,15 +14487,15 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14162
14487
|
}
|
|
14163
14488
|
|
|
14164
14489
|
var transform = element.transformable;
|
|
14165
|
-
quat.fromEuler(rotation, degrees[0], degrees[1], degrees[2]);
|
|
14166
|
-
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);
|
|
14167
14492
|
|
|
14168
14493
|
_this.dirtifyLocal(element, transform);
|
|
14169
14494
|
};
|
|
14170
14495
|
}();
|
|
14171
14496
|
|
|
14172
14497
|
this.setEulerAngles = function () {
|
|
14173
|
-
var invParentRot = quat.create();
|
|
14498
|
+
var invParentRot = quat$1.create();
|
|
14174
14499
|
return function (element, degrees, y, z) {
|
|
14175
14500
|
if (y === void 0) {
|
|
14176
14501
|
y = 0;
|
|
@@ -14189,12 +14514,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14189
14514
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
14190
14515
|
_this.setLocalEulerAngles(element, degrees);
|
|
14191
14516
|
} else {
|
|
14192
|
-
quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14517
|
+
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14193
14518
|
|
|
14194
14519
|
var parentRotation = _this.getRotation(element.parentNode);
|
|
14195
14520
|
|
|
14196
|
-
quat.copy(invParentRot, quat.invert(quat.create(), parentRotation));
|
|
14197
|
-
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);
|
|
14198
14523
|
|
|
14199
14524
|
_this.dirtifyLocal(element, transform);
|
|
14200
14525
|
}
|
|
@@ -14279,12 +14604,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14279
14604
|
}();
|
|
14280
14605
|
|
|
14281
14606
|
this.setRotation = function () {
|
|
14282
|
-
var parentInvertRotation = quat.create();
|
|
14607
|
+
var parentInvertRotation = quat$1.create();
|
|
14283
14608
|
return function (element, rotation, y, z, w) {
|
|
14284
14609
|
var transform = element.transformable;
|
|
14285
14610
|
|
|
14286
14611
|
if (typeof rotation === 'number') {
|
|
14287
|
-
rotation = quat.fromValues(rotation, y, z, w);
|
|
14612
|
+
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
14288
14613
|
}
|
|
14289
14614
|
|
|
14290
14615
|
if (element.parentNode === null || !element.parentNode.transformable) {
|
|
@@ -14292,10 +14617,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14292
14617
|
} else {
|
|
14293
14618
|
var parentRot = _this.getRotation(element.parentNode);
|
|
14294
14619
|
|
|
14295
|
-
quat.copy(parentInvertRotation, parentRot);
|
|
14296
|
-
quat.invert(parentInvertRotation, parentInvertRotation);
|
|
14297
|
-
quat.multiply(transform.localRotation, parentInvertRotation, rotation);
|
|
14298
|
-
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);
|
|
14299
14624
|
|
|
14300
14625
|
_this.dirtifyLocal(element, transform);
|
|
14301
14626
|
}
|
|
@@ -14440,7 +14765,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14440
14765
|
}
|
|
14441
14766
|
|
|
14442
14767
|
var transform = element.transformable;
|
|
14443
|
-
quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14768
|
+
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
14444
14769
|
this.dirtifyLocal(element, transform);
|
|
14445
14770
|
}
|
|
14446
14771
|
/**
|
|
@@ -14506,11 +14831,21 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14506
14831
|
|
|
14507
14832
|
_proto.setLocalRotation = function setLocalRotation(element, rotation, y, z, w) {
|
|
14508
14833
|
if (typeof rotation === 'number') {
|
|
14509
|
-
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);
|
|
14510
14845
|
}
|
|
14511
14846
|
|
|
14512
14847
|
var transform = element.transformable;
|
|
14513
|
-
|
|
14848
|
+
vec2.copy(transform.localSkew, skew);
|
|
14514
14849
|
this.dirtifyLocal(element, transform);
|
|
14515
14850
|
};
|
|
14516
14851
|
|
|
@@ -14577,11 +14912,37 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14577
14912
|
return element.transformable.localScale;
|
|
14578
14913
|
};
|
|
14579
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
|
+
|
|
14580
14941
|
_proto.getLocalTransform = function getLocalTransform(element) {
|
|
14581
14942
|
var transform = element.transformable;
|
|
14582
14943
|
|
|
14583
14944
|
if (transform.localDirtyFlag) {
|
|
14584
|
-
|
|
14945
|
+
this.calcLocalTransform(transform);
|
|
14585
14946
|
transform.localDirtyFlag = false;
|
|
14586
14947
|
}
|
|
14587
14948
|
|
|
@@ -14590,7 +14951,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14590
14951
|
|
|
14591
14952
|
_proto.setLocalTransform = function setLocalTransform(element, transform) {
|
|
14592
14953
|
var t = mat4.getTranslation(vec3.create(), transform);
|
|
14593
|
-
var r = mat4.getRotation(quat.create(), transform);
|
|
14954
|
+
var r = mat4.getRotation(quat$1.create(), transform);
|
|
14594
14955
|
var s = mat4.getScaling(vec3.create(), transform);
|
|
14595
14956
|
this.setLocalScale(element, s);
|
|
14596
14957
|
this.setLocalPosition(element, t);
|
|
@@ -14601,6 +14962,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14601
14962
|
this.setLocalScale(element, [1, 1, 1]);
|
|
14602
14963
|
this.setLocalPosition(element, [0, 0, 0]);
|
|
14603
14964
|
this.setLocalEulerAngles(element, [0, 0, 0]);
|
|
14965
|
+
this.setLocalSkew(element, [0, 0]);
|
|
14604
14966
|
};
|
|
14605
14967
|
|
|
14606
14968
|
_proto.getTransformedGeometryBounds = function getTransformedGeometryBounds(element, render) {
|
|
@@ -14629,8 +14991,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14629
14991
|
}
|
|
14630
14992
|
|
|
14631
14993
|
var geometry = element.geometry;
|
|
14632
|
-
var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
|
|
14633
|
-
|
|
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();
|
|
14634
14997
|
}
|
|
14635
14998
|
/**
|
|
14636
14999
|
* account for children in world space
|
|
@@ -14808,7 +15171,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14808
15171
|
|
|
14809
15172
|
_proto.sync = function sync(element, transform) {
|
|
14810
15173
|
if (transform.localDirtyFlag) {
|
|
14811
|
-
|
|
15174
|
+
this.calcLocalTransform(transform);
|
|
14812
15175
|
transform.localDirtyFlag = false;
|
|
14813
15176
|
}
|
|
14814
15177
|
|
|
@@ -15612,11 +15975,11 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
15612
15975
|
this.roll += this.relRoll;
|
|
15613
15976
|
|
|
15614
15977
|
if (this.type === CameraType.EXPLORING) {
|
|
15615
|
-
var rotX = quat.setAxisAngle(quat.create(), [1, 0, 0], (this.rotateWorld ? 1 : -1) * this.relElevation * DEG_2_RAD);
|
|
15616
|
-
var rotY = quat.setAxisAngle(quat.create(), [0, 1, 0], (this.rotateWorld ? 1 : -1) * this.relAzimuth * DEG_2_RAD);
|
|
15617
|
-
var rotZ = quat.setAxisAngle(quat.create(), [0, 0, 1], this.relRoll * DEG_2_RAD);
|
|
15618
|
-
var rotQ = quat.multiply(quat.create(), rotY, rotX);
|
|
15619
|
-
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);
|
|
15620
15983
|
var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
|
|
15621
15984
|
mat4.translate(this.matrix, this.matrix, [0, 0, -this.distance]);
|
|
15622
15985
|
mat4.multiply(this.matrix, this.matrix, rotMatrix);
|
|
@@ -15870,13 +16233,13 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
15870
16233
|
_proto.computeMatrix = function computeMatrix() {
|
|
15871
16234
|
// 使用四元数描述 3D 旋转
|
|
15872
16235
|
// @see https://xiaoiver.github.io/coding/2018/12/28/Camera-%E8%AE%BE%E8%AE%A1-%E4%B8%80.html
|
|
15873
|
-
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);
|
|
15874
16237
|
mat4.identity(this.matrix); // only consider HCS for EXPLORING and ORBITING cameras
|
|
15875
16238
|
|
|
15876
|
-
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);
|
|
15877
|
-
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);
|
|
15878
|
-
var rotQ = quat.multiply(quat.create(), rotY, rotX);
|
|
15879
|
-
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);
|
|
15880
16243
|
var rotMatrix = mat4.fromQuat(mat4.create(), rotQ);
|
|
15881
16244
|
|
|
15882
16245
|
if (this.type === CameraType.ORBITING || this.type === CameraType.EXPLORING) {
|
|
@@ -15985,7 +16348,7 @@ var Camera = /*#__PURE__*/function (_EventEmitter) {
|
|
|
15985
16348
|
}
|
|
15986
16349
|
|
|
15987
16350
|
var position = this.position;
|
|
15988
|
-
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);
|
|
15989
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);
|
|
15990
16353
|
};
|
|
15991
16354
|
|
|
@@ -18248,17 +18611,17 @@ var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
|
18248
18611
|
} // clear ref to old clip path
|
|
18249
18612
|
|
|
18250
18613
|
|
|
18251
|
-
if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.
|
|
18252
|
-
var index = oldClipPath.
|
|
18253
|
-
oldClipPath.
|
|
18614
|
+
if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.parsedStyle.clipPathTargets) {
|
|
18615
|
+
var index = oldClipPath.parsedStyle.clipPathTargets.indexOf(object);
|
|
18616
|
+
oldClipPath.parsedStyle.clipPathTargets.splice(index, 1);
|
|
18254
18617
|
}
|
|
18255
18618
|
|
|
18256
18619
|
if (newClipPath) {
|
|
18257
|
-
if (!newClipPath.
|
|
18258
|
-
newClipPath.
|
|
18620
|
+
if (!newClipPath.parsedStyle.clipPathTargets) {
|
|
18621
|
+
newClipPath.parsedStyle.clipPathTargets = [];
|
|
18259
18622
|
}
|
|
18260
18623
|
|
|
18261
|
-
newClipPath.
|
|
18624
|
+
newClipPath.parsedStyle.clipPathTargets.push(object);
|
|
18262
18625
|
}
|
|
18263
18626
|
|
|
18264
18627
|
dirtifyToRoot(object);
|
|
@@ -18875,9 +19238,9 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
18875
19238
|
// reset transform
|
|
18876
19239
|
object.resetLocalTransform();
|
|
18877
19240
|
object.setLocalPosition(defX, defY);
|
|
18878
|
-
transform.forEach(function (
|
|
18879
|
-
var t =
|
|
18880
|
-
d =
|
|
19241
|
+
transform.forEach(function (parsed) {
|
|
19242
|
+
var t = parsed.t,
|
|
19243
|
+
d = parsed.d;
|
|
18881
19244
|
|
|
18882
19245
|
if (t === 'scale') {
|
|
18883
19246
|
// scale(1) scale(1, 1)
|
|
@@ -18943,7 +19306,24 @@ var CSSPropertyTransform = /*#__PURE__*/function () {
|
|
|
18943
19306
|
var _newAngles3 = d || [Odeg];
|
|
18944
19307
|
|
|
18945
19308
|
object.rotateLocal(0, 0, _newAngles3[0].value);
|
|
18946
|
-
} 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
|
+
}
|
|
18947
19327
|
});
|
|
18948
19328
|
}
|
|
18949
19329
|
};
|
|
@@ -19198,13 +19578,25 @@ var BUILT_IN_PROPERTIES = [{
|
|
|
19198
19578
|
name: 'transformOrigin',
|
|
19199
19579
|
parsePriority: 100,
|
|
19200
19580
|
// interpolable: true,
|
|
19201
|
-
defaultValue:
|
|
19581
|
+
defaultValue: function defaultValue(nodeName) {
|
|
19582
|
+
if (nodeName === Shape.CIRCLE || nodeName === Shape.ELLIPSE) {
|
|
19583
|
+
return 'center';
|
|
19584
|
+
}
|
|
19585
|
+
|
|
19586
|
+
return 'left top';
|
|
19587
|
+
},
|
|
19202
19588
|
layoutDependent: true,
|
|
19203
19589
|
syntax: PropertySyntax.TRANSFORM_ORIGIN
|
|
19204
19590
|
}, {
|
|
19205
19591
|
name: 'anchor',
|
|
19206
19592
|
parsePriority: 99,
|
|
19207
|
-
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
|
+
},
|
|
19208
19600
|
layoutDependent: true,
|
|
19209
19601
|
syntax: PropertySyntax.LENGTH_PERCENTAGE_12
|
|
19210
19602
|
}, // <circle> & <ellipse>
|
|
@@ -19629,7 +20021,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
19629
20021
|
if (value === 'initial') {
|
|
19630
20022
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
|
|
19631
20023
|
if (!isNil(defaultValue)) {
|
|
19632
|
-
computed = this.parseProperty(name, defaultValue, object);
|
|
20024
|
+
computed = this.parseProperty(name, isFunction(defaultValue) ? defaultValue(object.nodeName) : defaultValue, object);
|
|
19633
20025
|
}
|
|
19634
20026
|
} else if (value === 'inherit') {
|
|
19635
20027
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
|
|
@@ -19869,8 +20261,8 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
19869
20261
|
var usedOriginYValue = (flipX ? -1 : 1) * convertPercentUnit(transformOrigin[1], 1, object);
|
|
19870
20262
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
19871
20263
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
19872
|
-
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
19873
|
-
|
|
20264
|
+
object.setOrigin(usedOriginXValue, usedOriginYValue); // object.dispatchEvent(new CustomEvent(ElementEvent.GEOMETRY_BOUNDS_CHANGED));
|
|
20265
|
+
|
|
19874
20266
|
dirtifyToRoot(object);
|
|
19875
20267
|
}
|
|
19876
20268
|
};
|
|
@@ -20070,7 +20462,7 @@ var AbstractRenderer = /*#__PURE__*/function () {
|
|
|
20070
20462
|
* only dirty object will cause re-render
|
|
20071
20463
|
*/
|
|
20072
20464
|
enableDirtyCheck: true,
|
|
20073
|
-
enableCulling:
|
|
20465
|
+
enableCulling: false,
|
|
20074
20466
|
|
|
20075
20467
|
/**
|
|
20076
20468
|
* enable auto rendering by default
|
|
@@ -20142,26 +20534,29 @@ var CullingPlugin = CullingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
|
|
|
20142
20534
|
_proto.apply = function apply(renderingService) {
|
|
20143
20535
|
var _this = this;
|
|
20144
20536
|
|
|
20145
|
-
|
|
20537
|
+
var strategies = this.strategyProvider.getContributions();
|
|
20146
20538
|
renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
|
|
20147
20539
|
if (object) {
|
|
20148
|
-
var cullable = object.cullable;
|
|
20149
|
-
|
|
20150
|
-
//
|
|
20151
|
-
//
|
|
20152
|
-
// // } else {
|
|
20153
|
-
// // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
|
|
20154
|
-
// // const [p0, p1, p2, p3] = camera.getFrustum().planes;
|
|
20155
|
-
// // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
|
|
20156
|
-
// // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
|
|
20157
|
-
// // }
|
|
20158
|
-
// if (strategies.length === 0) {
|
|
20159
|
-
// 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;
|
|
20160
20544
|
// } else {
|
|
20161
|
-
//
|
|
20162
|
-
//
|
|
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;
|
|
20163
20549
|
// }
|
|
20164
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
|
+
|
|
20165
20560
|
if (!cullable.isCulled() && object.isVisible()) {
|
|
20166
20561
|
return object;
|
|
20167
20562
|
} else {
|
|
@@ -21501,4 +21896,4 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
21501
21896
|
GlobalContainer.load(containerModule);
|
|
21502
21897
|
var layoutEngine = GlobalContainer.get(LayoutEngine);
|
|
21503
21898
|
|
|
21504
|
-
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, 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 };
|