@antv/g 5.4.0 → 5.5.2

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.
Files changed (55) hide show
  1. package/dist/components/Transform.d.ts +5 -1
  2. package/dist/components/Transform.d.ts.map +1 -1
  3. package/dist/css/StyleValueRegistry.d.ts +1 -0
  4. package/dist/css/StyleValueRegistry.d.ts.map +1 -1
  5. package/dist/css/cssom/CSSNumericValue.d.ts +1 -1
  6. package/dist/css/cssom/CSSStyleValue.d.ts +2 -2
  7. package/dist/css/cssom/CSSStyleValue.d.ts.map +1 -1
  8. package/dist/css/interfaces.d.ts +1 -1
  9. package/dist/css/interfaces.d.ts.map +1 -1
  10. package/dist/css/layout/LayoutObject.d.ts +2 -2
  11. package/dist/css/layout/LayoutObject.d.ts.map +1 -1
  12. package/dist/css/parser/dimension.d.ts +1 -0
  13. package/dist/css/parser/dimension.d.ts.map +1 -1
  14. package/dist/css/parser/path.d.ts +2 -2
  15. package/dist/css/parser/path.d.ts.map +1 -1
  16. package/dist/css/parser/transform.d.ts +1 -0
  17. package/dist/css/parser/transform.d.ts.map +1 -1
  18. package/dist/css/properties/CSSPropertyClipPath.d.ts +1 -0
  19. package/dist/css/properties/CSSPropertyClipPath.d.ts.map +1 -1
  20. package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +1 -1
  21. package/dist/css/properties/CSSPropertyNumber.d.ts +8 -0
  22. package/dist/css/properties/CSSPropertyNumber.d.ts.map +1 -0
  23. package/dist/css/properties/CSSPropertyTransform.d.ts.map +1 -1
  24. package/dist/css/properties/index.d.ts +1 -0
  25. package/dist/css/properties/index.d.ts.map +1 -1
  26. package/dist/display-objects/Circle.d.ts.map +1 -1
  27. package/dist/display-objects/DisplayObject.d.ts +3 -0
  28. package/dist/display-objects/DisplayObject.d.ts.map +1 -1
  29. package/dist/display-objects/Ellipse.d.ts.map +1 -1
  30. package/dist/display-objects/Line.d.ts.map +1 -1
  31. package/dist/display-objects/Path.d.ts +1 -1
  32. package/dist/display-objects/Path.d.ts.map +1 -1
  33. package/dist/display-objects/Polyline.d.ts.map +1 -1
  34. package/dist/dom/interfaces.d.ts +1 -1
  35. package/dist/dom/interfaces.d.ts.map +1 -1
  36. package/dist/global-module.d.ts.map +1 -1
  37. package/dist/index.esm.js +747 -292
  38. package/dist/index.js +707 -251
  39. package/dist/index.umd.js +1696 -680
  40. package/dist/index.umd.min.js +2 -2
  41. package/dist/plugins/DirtyCheckPlugin.d.ts +0 -1
  42. package/dist/plugins/DirtyCheckPlugin.d.ts.map +1 -1
  43. package/dist/plugins/PrepareRendererPlugin.d.ts +1 -0
  44. package/dist/plugins/PrepareRendererPlugin.d.ts.map +1 -1
  45. package/dist/services/RenderingService.d.ts +9 -1
  46. package/dist/services/RenderingService.d.ts.map +1 -1
  47. package/dist/services/SceneGraphSelector.d.ts.map +1 -1
  48. package/dist/services/SceneGraphService.d.ts +12 -3
  49. package/dist/services/SceneGraphService.d.ts.map +1 -1
  50. package/dist/types.d.ts +0 -5
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/utils/interpolation.d.ts.map +1 -1
  53. package/dist/utils/string.d.ts +4 -1
  54. package/dist/utils/string.d.ts.map +1 -1
  55. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -11,11 +11,13 @@ var eventemitter3 = require('eventemitter3');
11
11
  var d3 = require('d3-color');
12
12
  var util = require('@antv/util');
13
13
  var gMath = require('@antv/g-math');
14
+ var decomposeMatrix = require('mat4-decompose');
14
15
  var requestAnimationFramePolyfill = require('request-animation-frame-polyfill');
15
16
 
16
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
18
 
18
19
  var RBush__default = /*#__PURE__*/_interopDefaultLegacy(RBush);
20
+ var decomposeMatrix__default = /*#__PURE__*/_interopDefaultLegacy(decomposeMatrix);
19
21
 
20
22
  function _regeneratorRuntime() {
21
23
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -1235,7 +1237,7 @@ var convertToDash = function convertToDash(str) {
1235
1237
  return "-" + letter.toLowerCase();
1236
1238
  }); // Remove first dash
1237
1239
 
1238
- return str.charAt(0) === '-' ? str.substr(1) : str;
1240
+ return str.charAt(0) === '-' ? str.substring(1) : str;
1239
1241
  };
1240
1242
  /**
1241
1243
  Easing Functions from anime.js, they are tried and true, so, its better to use them instead of other alternatives
@@ -2328,20 +2330,45 @@ function calculateIterationProgress(activeDuration, localTime, timing) {
2328
2330
  return timing.easingFunction(directedProgress);
2329
2331
  }
2330
2332
 
2331
- var cache = {};
2332
- function camelCase(str) {
2333
- if (str === void 0) {
2334
- str = '';
2333
+ /**
2334
+ * @see https://github.com/lodash/lodash/blob/master/memoize.js
2335
+ */
2336
+ function memoize(func, resolver) {
2337
+ if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
2338
+ throw new TypeError('Expected a function');
2335
2339
  }
2336
2340
 
2337
- if (!cache[str]) {
2338
- cache[str] = str.replace(/-([a-z])/g, function (g) {
2339
- return g[1].toUpperCase();
2340
- });
2341
- }
2341
+ var memoized = function memoized() {
2342
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2343
+ args[_key] = arguments[_key];
2344
+ }
2345
+
2346
+ var key = resolver ? resolver.apply(this, args) : args[0];
2347
+ var cache = memoized.cache;
2348
+
2349
+ if (cache.has(key)) {
2350
+ return cache.get(key);
2351
+ }
2342
2352
 
2343
- return cache[str];
2353
+ var result = func.apply(this, args);
2354
+ memoized.cache = cache.set(key, result) || cache;
2355
+ return result;
2356
+ };
2357
+
2358
+ memoized.cache = new (memoize.Cache || Map)();
2359
+ return memoized;
2344
2360
  }
2361
+ memoize.Cache = Map;
2362
+
2363
+ var camelCase = memoize(function (str) {
2364
+ if (str === void 0) {
2365
+ str = '';
2366
+ }
2367
+
2368
+ return str.replace(/-([a-z])/g, function (g) {
2369
+ return g[1].toUpperCase();
2370
+ });
2371
+ });
2345
2372
  function isString(str) {
2346
2373
  if (!isNil(str) && typeof str === 'string') {
2347
2374
  return true;
@@ -2547,45 +2574,33 @@ var FORMAT_ATTR_MAP = {
2547
2574
  alias: 'img'
2548
2575
  }
2549
2576
  };
2550
- function formatAttribute(name, value) {
2551
- var _map$values;
2552
-
2577
+ var formatAttributeName = memoize(function (name) {
2553
2578
  var attributeName = camelCase(name);
2554
2579
  var map = FORMAT_ATTR_MAP[attributeName];
2555
2580
  attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
2556
- var attributeValue = (map === null || map === void 0 ? void 0 : (_map$values = map.values) === null || _map$values === void 0 ? void 0 : _map$values[value]) || value;
2557
- return [attributeName, attributeValue];
2558
- }
2559
-
2560
- /**
2561
- * @see https://github.com/lodash/lodash/blob/master/memoize.js
2562
- */
2563
- function memoize(func, resolver) {
2564
- if (typeof func !== 'function' || resolver != null && typeof resolver !== 'function') {
2565
- throw new TypeError('Expected a function');
2566
- }
2567
-
2568
- var memoized = function memoized() {
2569
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2570
- args[_key] = arguments[_key];
2571
- }
2572
-
2573
- var key = resolver ? resolver.apply(this, args) : args[0];
2574
- var cache = memoized.cache;
2575
-
2576
- if (cache.has(key)) {
2577
- return cache.get(key);
2578
- }
2581
+ return [attributeName, map];
2582
+ });
2583
+ function formatAttribute(name, value) {
2584
+ var _map$values;
2579
2585
 
2580
- var result = func.apply(this, args);
2581
- memoized.cache = cache.set(key, result) || cache;
2582
- return result;
2583
- };
2586
+ var _formatAttributeName = formatAttributeName(name),
2587
+ attributeName = _formatAttributeName[0],
2588
+ map = _formatAttributeName[1];
2584
2589
 
2585
- memoized.cache = new (memoize.Cache || Map)();
2586
- return memoized;
2587
- }
2588
- memoize.Cache = Map;
2590
+ 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;
2591
+ return [attributeName, attributeValue];
2592
+ } // export const formatAttribute = memoize(
2593
+ // (name: string, value: any): [string, any] => {
2594
+ // let attributeName = camelCase(name);
2595
+ // const map = FORMAT_ATTR_MAP[attributeName];
2596
+ // attributeName = map?.alias || attributeName;
2597
+ // const attributeValue = map?.values?.[value] || value;
2598
+ // return [attributeName, attributeValue];
2599
+ // },
2600
+ // (name: string, value: any) => {
2601
+ // return `${name}${value}`;
2602
+ // },
2603
+ // );
2589
2604
 
2590
2605
  (function (Shape) {
2591
2606
  Shape["GROUP"] = "g";
@@ -5154,8 +5169,8 @@ var CSSStyleValue = /*#__PURE__*/function () {
5154
5169
  return exports.UnitType.kPixels;
5155
5170
 
5156
5171
  case exports.UnitCategory.kUPercent:
5157
- return exports.UnitType.kUnknown;
5158
- // Cannot convert between numbers and percent.
5172
+ return exports.UnitType.kPercentage;
5173
+ // return UnitType.kUnknown; // Cannot convert between numbers and percent.
5159
5174
 
5160
5175
  case exports.UnitCategory.kUTime:
5161
5176
  return exports.UnitType.kSeconds;
@@ -7995,6 +8010,10 @@ function parserPercentage(css) {
7995
8010
  */
7996
8011
 
7997
8012
  function parseLengthOrPercentage(css) {
8013
+ if (isNumber(css)) {
8014
+ return new CSSUnitValue(css, 'px');
8015
+ }
8016
+
7998
8017
  return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
7999
8018
  }
8000
8019
  function parseAngle(css) {
@@ -8006,6 +8025,7 @@ function parseAngle(css) {
8006
8025
  * @example
8007
8026
  * 10px + 20px = 30px
8008
8027
  * 10deg + 10rad
8028
+ * 10% + 20% = 30%
8009
8029
  */
8010
8030
 
8011
8031
  function mergeDimensions(left, right, target, nonNegative, index) {
@@ -8015,23 +8035,29 @@ function mergeDimensions(left, right, target, nonNegative, index) {
8015
8035
 
8016
8036
  var unit = '';
8017
8037
  var leftValue = left.value || 0;
8018
- var rightValue = right.value || 0; // const canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
8019
- // const leftCanonicalUnitValue = left.convertTo(canonicalUnit);
8020
- // const rightCanonicalUnitValue = right.convertTo(canonicalUnit);
8021
- // format '%' to 'px'
8022
-
8023
- if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
8024
- leftValue = convertPercentUnit(left, index, target);
8025
- rightValue = convertPercentUnit(right, index, target);
8026
- unit = 'px';
8027
- } // format 'rad' 'turn' to 'deg'
8028
-
8038
+ var rightValue = right.value || 0;
8039
+ var canonicalUnit = CSSUnitValue.toCanonicalUnit(left.unit);
8040
+ var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
8041
+ var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
8042
+
8043
+ if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
8044
+ leftValue = leftCanonicalUnitValue.value;
8045
+ rightValue = rightCanonicalUnitValue.value;
8046
+ unit = CSSUnitValue.unitTypeToString(left.unit);
8047
+ } else {
8048
+ // format '%' to 'px'
8049
+ if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
8050
+ leftValue = convertPercentUnit(left, index, target);
8051
+ rightValue = convertPercentUnit(right, index, target);
8052
+ unit = 'px';
8053
+ }
8054
+ } // // format 'rad' 'turn' to 'deg'
8055
+ // if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
8056
+ // leftValue = convertAngleUnit(left);
8057
+ // rightValue = convertAngleUnit(right);
8058
+ // unit = 'deg';
8059
+ // }
8029
8060
 
8030
- if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
8031
- leftValue = convertAngleUnit(left);
8032
- rightValue = convertAngleUnit(right);
8033
- unit = 'deg';
8034
- }
8035
8061
 
8036
8062
  return [leftValue, rightValue, function (value) {
8037
8063
  if (nonNegative) {
@@ -8161,7 +8187,7 @@ function mergeNumberLists(left, right) {
8161
8187
  }];
8162
8188
  }
8163
8189
 
8164
- function parsePath(path, object) {
8190
+ var memoizedParsePath = memoize(function (path) {
8165
8191
  var absolutePath;
8166
8192
 
8167
8193
  try {
@@ -8193,11 +8219,6 @@ function parsePath(path, object) {
8193
8219
  height = _getPathBBoxTotalLeng.height,
8194
8220
  length = _getPathBBoxTotalLeng.length;
8195
8221
 
8196
- if (object) {
8197
- object.parsedStyle.defX = x;
8198
- object.parsedStyle.defY = y;
8199
- }
8200
-
8201
8222
  return {
8202
8223
  absolutePath: absolutePath,
8203
8224
  hasArc: hasArc,
@@ -8209,6 +8230,18 @@ function parsePath(path, object) {
8209
8230
  zCommandIndexes: zCommandIndexes,
8210
8231
  rect: new Rectangle(x, y, width, height)
8211
8232
  };
8233
+ }, function (path) {
8234
+ return isString(path) ? path : util.path2String(path);
8235
+ });
8236
+ function parsePath(path, object) {
8237
+ var result = memoizedParsePath(path);
8238
+
8239
+ if (object) {
8240
+ object.parsedStyle.defX = result.rect.x;
8241
+ object.parsedStyle.defY = result.rect.y;
8242
+ }
8243
+
8244
+ return result;
8212
8245
  }
8213
8246
  function mergePaths(left, right, object) {
8214
8247
  var curve1 = left.curve;
@@ -8465,22 +8498,23 @@ function id$1(x) {
8465
8498
 
8466
8499
 
8467
8500
  var transformFunctions = {
8468
- // matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id],
8469
- // matrix3d: ['NNNNNNNNNNNNNNNN', id],
8501
+ // @ts-ignore
8502
+ matrix: ['NNNNNN', [_, _, 0, 0, _, _, 0, 0, 0, 0, 1, 0, _, _, 0, 1], id$1],
8503
+ matrix3d: ['NNNNNNNNNNNNNNNN', id$1],
8470
8504
  rotate: ['A'],
8471
8505
  rotatex: ['A'],
8472
8506
  rotatey: ['A'],
8473
8507
  rotatez: ['A'],
8474
8508
  rotate3d: ['NNNA'],
8475
- // perspective: ['L'],
8509
+ perspective: ['L'],
8476
8510
  scale: ['Nn', cast([_, _, CSS.number(1)]), id$1],
8477
8511
  scalex: ['N', cast([_, CSS.number(1), CSS.number(1)]), cast([_, CSS.number(1)])],
8478
8512
  scaley: ['N', cast([CSS.number(1), _, CSS.number(1)]), cast([CSS.number(1), _])],
8479
8513
  scalez: ['N', cast([CSS.number(1), CSS.number(1), _])],
8480
8514
  scale3d: ['NNN', id$1],
8481
- // skew: ['Aa', null, id],
8482
- // skewx: ['A', null, cast([_, Odeg])],
8483
- // skewy: ['A', null, cast([Odeg, _])],
8515
+ skew: ['Aa', null, id$1],
8516
+ skewx: ['A', null, cast([_, Odeg])],
8517
+ skewy: ['A', null, cast([Odeg, _])],
8484
8518
  translate: ['Tt', cast([_, _, Opx]), id$1],
8485
8519
  translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
8486
8520
  translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
@@ -8573,33 +8607,289 @@ function parseTransform(string) {
8573
8607
  }
8574
8608
 
8575
8609
  return [];
8576
- } // function mergeMatrices(left: number[][], right: number[][]): [
8577
- // number[][], number[][], () => string,
8578
- // ] {
8579
- // if (left.decompositionPair !== right) {
8580
- // left.decompositionPair = right;
8581
- // var leftArgs = makeMatrixDecomposition(left);
8582
- // }
8583
- // if (right.decompositionPair !== left) {
8584
- // right.decompositionPair = left;
8585
- // var rightArgs = makeMatrixDecomposition(right);
8586
- // }
8587
- // if (leftArgs[0] === null || rightArgs[0] === null)
8588
- // return [[false], [true], (x) => { return x ? right[0].d : left[0].d; }];
8589
- // leftArgs[0].push(0);
8590
- // rightArgs[0].push(1);
8591
- // return [
8592
- // leftArgs,
8593
- // rightArgs,
8594
- // (list) => {
8595
- // const q = quat(leftArgs[0][3], rightArgs[0][3], list[5]);
8596
- // const mat = composeMatrix(list[0], list[1], list[2], q, list[4]);
8597
- // const stringifiedArgs = mat.map(numberToLongString).join(',');
8598
- // return stringifiedArgs;
8599
- // }
8600
- // ];
8601
- // }
8602
- // scalex/y/z -> scale
8610
+ }
8611
+ function convertItemToMatrix(item) {
8612
+ var x;
8613
+ var y;
8614
+ var z;
8615
+ var angle;
8616
+
8617
+ switch (item.t) {
8618
+ case 'rotatex':
8619
+ angle = deg2rad(convertAngleUnit(item.d[0]));
8620
+ 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];
8621
+
8622
+ case 'rotatey':
8623
+ angle = deg2rad(convertAngleUnit(item.d[0]));
8624
+ 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];
8625
+
8626
+ case 'rotate':
8627
+ case 'rotatez':
8628
+ angle = deg2rad(convertAngleUnit(item.d[0]));
8629
+ 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];
8630
+
8631
+ case 'rotate3d':
8632
+ x = item.d[0].value;
8633
+ y = item.d[1].value;
8634
+ z = item.d[2].value;
8635
+ angle = deg2rad(convertAngleUnit(item.d[3]));
8636
+ var sqrLength = x * x + y * y + z * z;
8637
+
8638
+ if (sqrLength === 0) {
8639
+ x = 1;
8640
+ y = 0;
8641
+ z = 0;
8642
+ } else if (sqrLength !== 1) {
8643
+ var length = Math.sqrt(sqrLength);
8644
+ x /= length;
8645
+ y /= length;
8646
+ z /= length;
8647
+ }
8648
+
8649
+ var s = Math.sin(angle / 2);
8650
+ var sc = s * Math.cos(angle / 2);
8651
+ var sq = s * s;
8652
+ 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];
8653
+
8654
+ case 'scale':
8655
+ return [item.d[0].value, 0, 0, 0, 0, item.d[1].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8656
+
8657
+ case 'scalex':
8658
+ return [item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8659
+
8660
+ case 'scaley':
8661
+ return [1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8662
+
8663
+ case 'scalez':
8664
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, item.d[0].value, 0, 0, 0, 0, 1];
8665
+
8666
+ case 'scale3d':
8667
+ 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];
8668
+
8669
+ case 'skew':
8670
+ var xAngle = deg2rad(convertAngleUnit(item.d[0]));
8671
+ var yAngle = deg2rad(convertAngleUnit(item.d[1]));
8672
+ return [1, Math.tan(yAngle), 0, 0, Math.tan(xAngle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8673
+
8674
+ case 'skewx':
8675
+ angle = deg2rad(convertAngleUnit(item.d[0]));
8676
+ return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8677
+
8678
+ case 'skewy':
8679
+ angle = deg2rad(convertAngleUnit(item.d[0]));
8680
+ return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8681
+
8682
+ case 'translate':
8683
+ // TODO: pass target
8684
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
8685
+ y = convertPercentUnit(item.d[1], 0, null) || 0;
8686
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, 0, 1];
8687
+
8688
+ case 'translatex':
8689
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
8690
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, 0, 0, 1];
8691
+
8692
+ case 'translatey':
8693
+ y = convertPercentUnit(item.d[0], 0, null) || 0;
8694
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, y, 0, 1];
8695
+
8696
+ case 'translatez':
8697
+ z = convertPercentUnit(item.d[0], 0, null) || 0;
8698
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, z, 1];
8699
+
8700
+ case 'translate3d':
8701
+ x = convertPercentUnit(item.d[0], 0, null) || 0;
8702
+ y = convertPercentUnit(item.d[1], 0, null) || 0;
8703
+ z = convertPercentUnit(item.d[2], 0, null) || 0;
8704
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1];
8705
+
8706
+ case 'perspective':
8707
+ var t = convertPercentUnit(item.d[0], 0, null) || 0;
8708
+ var p = t ? -1 / t : 0;
8709
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, p, 0, 0, 0, 1];
8710
+
8711
+ case 'matrix':
8712
+ 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];
8713
+
8714
+ case 'matrix3d':
8715
+ return item.d.map(function (d) {
8716
+ return d.value;
8717
+ });
8718
+ }
8719
+ }
8720
+
8721
+ function multiplyMatrices(a, b) {
8722
+ 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]];
8723
+ }
8724
+
8725
+ function convertToMatrix(transformList) {
8726
+ if (transformList.length === 0) {
8727
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8728
+ }
8729
+
8730
+ return transformList.map(convertItemToMatrix).reduce(multiplyMatrices);
8731
+ }
8732
+
8733
+ function makeMatrixDecomposition(transformList) {
8734
+ var translate = [0, 0, 0];
8735
+ var scale = [0, 0, 0];
8736
+ var skew = [0, 0, 0];
8737
+ var perspective = [0, 0, 0, 1];
8738
+ var quaternion = [0, 0, 0, 1];
8739
+ decomposeMatrix__default['default'](convertToMatrix(transformList), translate, scale, skew, perspective, quaternion);
8740
+ return [translate, scale, skew, quaternion, perspective];
8741
+ }
8742
+
8743
+ var composeMatrix = function () {
8744
+ function multiply(a, b) {
8745
+ var result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
8746
+
8747
+ for (var i = 0; i < 4; i++) {
8748
+ for (var j = 0; j < 4; j++) {
8749
+ for (var k = 0; k < 4; k++) {
8750
+ result[i][j] += b[i][k] * a[k][j];
8751
+ }
8752
+ }
8753
+ }
8754
+
8755
+ return result;
8756
+ }
8757
+
8758
+ function is2D(m) {
8759
+ 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;
8760
+ }
8761
+
8762
+ function composeMatrix(translate, scale, skew, quat, perspective) {
8763
+ var matrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
8764
+
8765
+ for (var i = 0; i < 4; i++) {
8766
+ matrix[i][3] = perspective[i];
8767
+ }
8768
+
8769
+ for (var _i = 0; _i < 3; _i++) {
8770
+ for (var j = 0; j < 3; j++) {
8771
+ matrix[3][_i] += translate[j] * matrix[j][_i];
8772
+ }
8773
+ }
8774
+
8775
+ var x = quat[0],
8776
+ y = quat[1],
8777
+ z = quat[2],
8778
+ w = quat[3];
8779
+ var rotMatrix = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
8780
+ rotMatrix[0][0] = 1 - 2 * (y * y + z * z);
8781
+ rotMatrix[0][1] = 2 * (x * y - z * w);
8782
+ rotMatrix[0][2] = 2 * (x * z + y * w);
8783
+ rotMatrix[1][0] = 2 * (x * y + z * w);
8784
+ rotMatrix[1][1] = 1 - 2 * (x * x + z * z);
8785
+ rotMatrix[1][2] = 2 * (y * z - x * w);
8786
+ rotMatrix[2][0] = 2 * (x * z - y * w);
8787
+ rotMatrix[2][1] = 2 * (y * z + x * w);
8788
+ rotMatrix[2][2] = 1 - 2 * (x * x + y * y);
8789
+ matrix = multiply(matrix, rotMatrix);
8790
+ var temp = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]];
8791
+
8792
+ if (skew[2]) {
8793
+ temp[2][1] = skew[2];
8794
+ matrix = multiply(matrix, temp);
8795
+ }
8796
+
8797
+ if (skew[1]) {
8798
+ temp[2][1] = 0;
8799
+ temp[2][0] = skew[0];
8800
+ matrix = multiply(matrix, temp);
8801
+ }
8802
+
8803
+ if (skew[0]) {
8804
+ temp[2][0] = 0;
8805
+ temp[1][0] = skew[0];
8806
+ matrix = multiply(matrix, temp);
8807
+ }
8808
+
8809
+ for (var _i2 = 0; _i2 < 3; _i2++) {
8810
+ for (var _j = 0; _j < 3; _j++) {
8811
+ matrix[_i2][_j] *= scale[_i2];
8812
+ }
8813
+ }
8814
+
8815
+ if (is2D(matrix)) {
8816
+ return [matrix[0][0], matrix[0][1], matrix[1][0], matrix[1][1], matrix[3][0], matrix[3][1]];
8817
+ }
8818
+
8819
+ return matrix[0].concat(matrix[1], matrix[2], matrix[3]);
8820
+ }
8821
+
8822
+ return composeMatrix;
8823
+ }();
8824
+
8825
+ function numberToLongString(x) {
8826
+ return x.toFixed(6).replace('.000000', '');
8827
+ }
8828
+
8829
+ function mergeMatrices(left, right) {
8830
+ var leftArgs;
8831
+ var rightArgs; // @ts-ignore
8832
+
8833
+ if (left.decompositionPair !== right) {
8834
+ // @ts-ignore
8835
+ left.decompositionPair = right;
8836
+ leftArgs = makeMatrixDecomposition(left);
8837
+ } // @ts-ignore
8838
+
8839
+
8840
+ if (right.decompositionPair !== left) {
8841
+ // @ts-ignore
8842
+ right.decompositionPair = left;
8843
+ rightArgs = makeMatrixDecomposition(right);
8844
+ }
8845
+
8846
+ if (leftArgs[0] === null || rightArgs[0] === null) return [// @ts-ignore
8847
+ [false], // @ts-ignore
8848
+ [true], // @ts-ignore
8849
+ function (x) {
8850
+ return x ? right[0].d : left[0].d;
8851
+ }];
8852
+ leftArgs[0].push(0);
8853
+ rightArgs[0].push(1);
8854
+ return [leftArgs, rightArgs, // @ts-ignore
8855
+ function (list) {
8856
+ // @ts-ignore
8857
+ var q = quat(leftArgs[0][3], rightArgs[0][3], list[5]);
8858
+ var mat = composeMatrix(list[0], list[1], list[2], q, list[4]);
8859
+ var stringifiedArgs = mat.map(numberToLongString).join(',');
8860
+ return stringifiedArgs;
8861
+ }];
8862
+ }
8863
+
8864
+ function dot(v1, v2) {
8865
+ var result = 0;
8866
+
8867
+ for (var i = 0; i < v1.length; i++) {
8868
+ result += v1[i] * v2[i];
8869
+ }
8870
+
8871
+ return result;
8872
+ }
8873
+
8874
+ function quat(fromQ, toQ, f) {
8875
+ var product = dot(fromQ, toQ);
8876
+ product = clamp(product, -1.0, 1.0);
8877
+ var quat = [];
8878
+
8879
+ if (product === 1.0) {
8880
+ quat = fromQ;
8881
+ } else {
8882
+ var theta = Math.acos(product);
8883
+ var w = Math.sin(f * theta) * 1 / Math.sqrt(1 - product * product);
8884
+
8885
+ for (var i = 0; i < 4; i++) {
8886
+ quat.push(fromQ[i] * (Math.cos(f * theta) - product * w) + toQ[i] * w);
8887
+ }
8888
+ }
8889
+
8890
+ return quat;
8891
+ } // scalex/y/z -> scale
8892
+
8603
8893
 
8604
8894
  function typeTo2D(type) {
8605
8895
  return type.replace(/[xy]/, '');
@@ -8629,7 +8919,7 @@ function mergeTransforms(left, right, target) {
8629
8919
  type = _left$i.t,
8630
8920
  args = _left$i.d; // none -> scale(1)/translateX(0)
8631
8921
 
8632
- var defaultValue = type.substr(0, 5) === 'scale' ? 1 : 0;
8922
+ var defaultValue = type.substring(0, 5) === 'scale' ? 1 : 0;
8633
8923
  right.push({
8634
8924
  t: type,
8635
8925
  d: args.map(function (arg) {
@@ -8654,21 +8944,31 @@ function mergeTransforms(left, right, target) {
8654
8944
  var rightResult = [];
8655
8945
  var types = []; // merge matrix() with matrix3d()
8656
8946
 
8657
- if (left.length !== right.length) ; else {
8658
- for (var _i = 0; _i < left.length; _i++) {
8659
- var leftType = left[_i].t;
8660
- var rightType = right[_i].t;
8661
- var leftArgs = left[_i].d;
8662
- var rightArgs = right[_i].d;
8947
+ if (left.length !== right.length) {
8948
+ var merged = mergeMatrices(left, right); // @ts-ignore
8949
+
8950
+ leftResult = [merged[0]]; // @ts-ignore
8951
+
8952
+ rightResult = [merged[1]];
8953
+ types = [['matrix', [merged[2]]]];
8954
+ } else {
8955
+ for (var _i3 = 0; _i3 < left.length; _i3++) {
8956
+ var leftType = left[_i3].t;
8957
+ var rightType = right[_i3].t;
8958
+ var leftArgs = left[_i3].d;
8959
+ var rightArgs = right[_i3].d;
8663
8960
  var leftFunctionData = transformFunctions[leftType];
8664
8961
  var rightFunctionData = transformFunctions[rightType];
8665
8962
  var type = void 0;
8666
8963
 
8667
8964
  if (isMatrixOrPerspective(leftType, rightType)) {
8668
- // const merged = mergeMatrices([left[i]], [right[i]]);
8669
- // leftResult.push(merged[0]);
8670
- // rightResult.push(merged[1]);
8671
- // types.push(['matrix', [merged[2]]]);
8965
+ var _merged = mergeMatrices([left[_i3]], [right[_i3]]); // @ts-ignore
8966
+
8967
+
8968
+ leftResult.push(_merged[0]); // @ts-ignore
8969
+
8970
+ rightResult.push(_merged[1]);
8971
+ types.push(['matrix', [_merged[2]]]);
8672
8972
  continue;
8673
8973
  } else if (leftType === rightType) {
8674
8974
  type = leftType;
@@ -8685,10 +8985,13 @@ function mergeTransforms(left, right, target) {
8685
8985
 
8686
8986
  rightArgs = rightFunctionData[1](rightArgs);
8687
8987
  } else {
8688
- // const merged = mergeMatrices(left, right);
8689
- // leftResult = [merged[0]];
8690
- // rightResult = [merged[1]];
8691
- // types = [['matrix', [merged[2]]]];
8988
+ var _merged2 = mergeMatrices(left, right); // @ts-ignore
8989
+
8990
+
8991
+ leftResult = [_merged2[0]]; // @ts-ignore
8992
+
8993
+ rightResult = [_merged2[1]];
8994
+ types = [['matrix', [_merged2[2]]]];
8692
8995
  break;
8693
8996
  }
8694
8997
 
@@ -8699,10 +9002,11 @@ function mergeTransforms(left, right, target) {
8699
9002
  for (var j = 0; j < leftArgs.length; j++) {
8700
9003
  var merge = leftArgs[j].unit === exports.UnitType.kNumber ? mergeNumbers : mergeDimensions; // @ts-ignore
8701
9004
 
8702
- var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
8703
- leftArgsCopy[j] = merged[0];
8704
- rightArgsCopy[j] = merged[1];
8705
- stringConversions.push(merged[2]);
9005
+ var _merged3 = merge(leftArgs[j], rightArgs[j], target, false, j);
9006
+
9007
+ leftArgsCopy[j] = _merged3[0];
9008
+ rightArgsCopy[j] = _merged3[1];
9009
+ stringConversions.push(_merged3[2]);
8706
9010
  }
8707
9011
 
8708
9012
  leftResult.push(leftArgsCopy);
@@ -8843,8 +9147,8 @@ exports.CSSPropertyAngle = tslib.__decorate([manaSyringe.singleton({
8843
9147
  */
8844
9148
 
8845
9149
  ElementEvent["UNMOUNTED"] = "DOMNodeRemovedFromDocument";
8846
- ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
8847
- ElementEvent["GEOMETRY_BOUNDS_CHANGED"] = "geometry-bounds-changed";
9150
+ ElementEvent["BOUNDS_CHANGED"] = "bounds-changed"; // GEOMETRY_BOUNDS_CHANGED = 'geometry-bounds-changed',
9151
+
8848
9152
  /**
8849
9153
  * trigger when z-index changed
8850
9154
  */
@@ -9606,6 +9910,7 @@ var Transform = function Transform() {
9606
9910
  this.localRotation = glMatrix.quat.fromValues(0, 0, 0, 1);
9607
9911
  this.localScale = glMatrix.vec3.fromValues(1, 1, 1);
9608
9912
  this.localTransform = glMatrix.mat4.create();
9913
+ this.localSkew = glMatrix.vec2.fromValues(0, 0);
9609
9914
  this.position = glMatrix.vec3.fromValues(0, 0, 0);
9610
9915
  this.rotation = glMatrix.quat.fromValues(0, 0, 0, 1);
9611
9916
  this.scaling = glMatrix.vec3.fromValues(1, 1, 1);
@@ -11058,7 +11363,8 @@ var DEFAULT_STYLE_PROPS = {
11058
11363
  fontVariant: '',
11059
11364
  textAlign: '',
11060
11365
  textBaseline: '',
11061
- textTransform: ''
11366
+ textTransform: '',
11367
+ zIndex: ''
11062
11368
  };
11063
11369
  /**
11064
11370
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
@@ -11090,7 +11396,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11090
11396
  * push to active animations after calling `animate()`
11091
11397
  */
11092
11398
  function DisplayObject(config) {
11093
- var _this$config$capture, _this$config$zIndex, _this$config$interact;
11399
+ var _this$config$capture;
11094
11400
 
11095
11401
  var _this;
11096
11402
 
@@ -11101,6 +11407,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11101
11407
  _this.styleValueRegistry = manaSyringe.GlobalContainer.get(StyleValueRegistry);
11102
11408
  _this.isCustomElement = false;
11103
11409
  _this.activeAnimations = [];
11410
+ _this.mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, _assertThisInitialized(_this), null, null, null, MutationEvent.MODIFICATION, null, null);
11104
11411
  _this.config = config; // compatible with G 3.0
11105
11412
 
11106
11413
  _this.config.interactive = (_this$config$capture = _this.config.capture) !== null && _this$config$capture !== void 0 ? _this$config$capture : _this.config.interactive; // init scene graph node
@@ -11114,10 +11421,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11114
11421
 
11115
11422
  _this.nodeName = _this.config.type || exports.Shape.GROUP; // compatible with G 3.0
11116
11423
 
11117
- _this.config.style = _extends({}, DEFAULT_STYLE_PROPS, {
11118
- zIndex: (_this$config$zIndex = _this.config.zIndex) !== null && _this$config$zIndex !== void 0 ? _this$config$zIndex : 0,
11119
- interactive: (_this$config$interact = _this.config.interactive) !== null && _this$config$interact !== void 0 ? _this$config$interact : true
11120
- }, _this.config.style, _this.config.attrs);
11424
+ _this.config.style = _extends({}, DEFAULT_STYLE_PROPS, _this.config.style, _this.config.attrs);
11121
11425
 
11122
11426
  if (_this.config.visible != null) {
11123
11427
  _this.config.style.visibility = _this.config.visible === false ? 'hidden' : 'visible';
@@ -11248,9 +11552,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11248
11552
  var oldParsedValue = this.parsedStyle[name];
11249
11553
  this.styleValueRegistry.processProperties(this, (_this$styleValueRegis = {}, _this$styleValueRegis[name] = value, _this$styleValueRegis), parseOptions); // inform clip path targets
11250
11554
 
11251
- if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
11252
- this.attributes.clipPathTargets.forEach(function (target) {
11253
- dirtifyToRoot(target);
11555
+ if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
11556
+ this.parsedStyle.clipPathTargets.forEach(function (target) {
11557
+ _this2.sceneGraphService.dirtifyToRoot(target);
11558
+
11254
11559
  target.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, target, _this2, _this2, 'clipPath', MutationEvent.MODIFICATION, _this2, _this2));
11255
11560
 
11256
11561
  if (target.isCustomElement && target.isConnected) {
@@ -11262,8 +11567,15 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11262
11567
  } // redraw at next frame
11263
11568
 
11264
11569
 
11265
- renderable.dirty = true;
11266
- this.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, this, oldValue, value, name, MutationEvent.MODIFICATION, oldParsedValue, this.parsedStyle[name]));
11570
+ renderable.dirty = true; // trigger later
11571
+ // this.sceneGraphService.pendingEvents.push([ElementEvent.ATTR_MODIFIED, { affectChildren }]);
11572
+
11573
+ this.mutationEvent.prevValue = oldValue;
11574
+ this.mutationEvent.newValue = value;
11575
+ this.mutationEvent.attrName = name;
11576
+ this.mutationEvent.prevParsedValue = oldParsedValue;
11577
+ this.mutationEvent.newParsedValue = this.parsedStyle[name];
11578
+ this.dispatchEvent(this.mutationEvent);
11267
11579
 
11268
11580
  if (this.isCustomElement && this.isConnected) {
11269
11581
  if (this.attributeChangedCallback) {
@@ -11519,6 +11831,11 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11519
11831
  return this;
11520
11832
  };
11521
11833
 
11834
+ _proto.setLocalSkew = function setLocalSkew(skew, y) {
11835
+ this.sceneGraphService.setLocalSkew(this, skew, y);
11836
+ return this;
11837
+ };
11838
+
11522
11839
  _proto.getRotation = function getRotation() {
11523
11840
  return this.sceneGraphService.getRotation(this);
11524
11841
  };
@@ -11527,6 +11844,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11527
11844
  return this.sceneGraphService.getLocalRotation(this);
11528
11845
  };
11529
11846
 
11847
+ _proto.getLocalSkew = function getLocalSkew() {
11848
+ return this.sceneGraphService.getLocalSkew(this);
11849
+ };
11850
+
11530
11851
  _proto.getLocalTransform = function getLocalTransform() {
11531
11852
  return this.sceneGraphService.getLocalTransform(this);
11532
11853
  };
@@ -11565,10 +11886,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
11565
11886
 
11566
11887
  var timeline = (_this$ownerDocument = this.ownerDocument) === null || _this$ownerDocument === void 0 ? void 0 : _this$ownerDocument.timeline; // account for clip path, use target's timeline
11567
11888
 
11568
- if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
11889
+ if (this.parsedStyle.clipPathTargets && this.parsedStyle.clipPathTargets.length) {
11569
11890
  var _target$ownerDocument;
11570
11891
 
11571
- var target = this.attributes.clipPathTargets[0];
11892
+ var target = this.parsedStyle.clipPathTargets[0];
11572
11893
  timeline = (_target$ownerDocument = target.ownerDocument) === null || _target$ownerDocument === void 0 ? void 0 : _target$ownerDocument.timeline;
11573
11894
  } // clear old parsed transform
11574
11895
 
@@ -11974,9 +12295,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
11974
12295
  style: _extends({
11975
12296
  cx: '',
11976
12297
  cy: '',
11977
- r: '',
11978
- anchor: '0.5 0.5',
11979
- transformOrigin: 'center'
12298
+ r: ''
11980
12299
  }, style)
11981
12300
  }, rest)) || this;
11982
12301
  }
@@ -11999,9 +12318,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
11999
12318
  cx: '',
12000
12319
  cy: '',
12001
12320
  rx: '',
12002
- ry: '',
12003
- anchor: '0.5 0.5',
12004
- transformOrigin: 'center'
12321
+ ry: ''
12005
12322
  }, style)
12006
12323
  }, rest)) || this;
12007
12324
  }
@@ -12098,9 +12415,17 @@ var Line = /*#__PURE__*/function (_DisplayObject) {
12098
12415
  x1 = _this$parsedStyle.x1,
12099
12416
  y1 = _this$parsedStyle.y1,
12100
12417
  x2 = _this$parsedStyle.x2,
12101
- y2 = _this$parsedStyle.y2;
12102
- var point = gMath.Line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio);
12103
- return new Point(point.x, point.y);
12418
+ y2 = _this$parsedStyle.y2,
12419
+ defX = _this$parsedStyle.defX,
12420
+ defY = _this$parsedStyle.defY;
12421
+
12422
+ var _LineUtil$pointAt = gMath.Line.pointAt(x1.value, y1.value, x2.value, y2.value, ratio),
12423
+ x = _LineUtil$pointAt.x,
12424
+ y = _LineUtil$pointAt.y;
12425
+
12426
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12427
+
12428
+ return new Point(transformed[0], transformed[1]);
12104
12429
  };
12105
12430
 
12106
12431
  _proto.getTotalLength = function getTotalLength() {
@@ -12145,7 +12470,10 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
12145
12470
  ;
12146
12471
 
12147
12472
  _proto.getPoint = function getPoint(ratio) {
12148
- var _this$parsedStyle$pat = this.parsedStyle.path,
12473
+ var _this$parsedStyle = this.parsedStyle,
12474
+ defX = _this$parsedStyle.defX,
12475
+ defY = _this$parsedStyle.defY,
12476
+ _this$parsedStyle$pat = _this$parsedStyle.path,
12149
12477
  totalLength = _this$parsedStyle$pat.totalLength,
12150
12478
  absolutePath = _this$parsedStyle$pat.absolutePath;
12151
12479
 
@@ -12153,7 +12481,9 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
12153
12481
  x = _getPointAtLength.x,
12154
12482
  y = _getPointAtLength.y;
12155
12483
 
12156
- return new Point(x, y);
12484
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12485
+
12486
+ return new Point(transformed[0], transformed[1]);
12157
12487
  }
12158
12488
  /**
12159
12489
  * Get start tangent vector
@@ -12258,7 +12588,10 @@ var Polyline = /*#__PURE__*/function (_DisplayObject) {
12258
12588
  };
12259
12589
 
12260
12590
  _proto.getPoint = function getPoint(ratio) {
12261
- var _this$parsedStyle$poi = this.parsedStyle.points,
12591
+ var _this$parsedStyle = this.parsedStyle,
12592
+ defX = _this$parsedStyle.defX,
12593
+ defY = _this$parsedStyle.defY,
12594
+ _this$parsedStyle$poi = _this$parsedStyle.points,
12262
12595
  points = _this$parsedStyle$poi.points,
12263
12596
  segments = _this$parsedStyle$poi.segments;
12264
12597
  var subt = 0;
@@ -12274,7 +12607,9 @@ var Polyline = /*#__PURE__*/function (_DisplayObject) {
12274
12607
  x = _LineUtil$pointAt.x,
12275
12608
  y = _LineUtil$pointAt.y;
12276
12609
 
12277
- return new Point(x, y);
12610
+ var transformed = glMatrix.vec3.transformMat4(glMatrix.vec3.create(), glMatrix.vec3.fromValues(x - defX, y - defY, 0), this.getLocalTransform()); // apply local transformation
12611
+
12612
+ return new Point(transformed[0], transformed[1]);
12278
12613
  };
12279
12614
 
12280
12615
  _proto.getStartTangent = function getStartTangent() {
@@ -13931,7 +14266,7 @@ exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
13931
14266
  if (query.startsWith('.')) {
13932
14267
  return root.find(function (node) {
13933
14268
  // return !node.shadow && node.id === query.substring(1);
13934
- return node.className === _this.getIdOrClassname(query);
14269
+ return ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this.getIdOrClassname(query)) > -1;
13935
14270
  });
13936
14271
  } else if (query.startsWith('#')) {
13937
14272
  // getElementById('id')
@@ -13968,7 +14303,7 @@ exports.DefaultSceneGraphSelector = /*#__PURE__*/function () {
13968
14303
  // getElementsByClassName('className');
13969
14304
  // should not include itself
13970
14305
  return root.findAll(function (node) {
13971
- return root !== node && node.className === _this2.getIdOrClassname(query);
14306
+ return root !== node && ((node === null || node === void 0 ? void 0 : node.classList) || []).indexOf(_this2.getIdOrClassname(query)) > -1;
13972
14307
  });
13973
14308
  } else if (query.startsWith('#')) {
13974
14309
  return root.findAll(function (node) {
@@ -14074,29 +14409,6 @@ function sortByZIndex(o1, o2) {
14074
14409
 
14075
14410
  return zIndex1 - zIndex2;
14076
14411
  }
14077
- function dirtifyToRoot(element, affectChildren) {
14078
- if (affectChildren === void 0) {
14079
- affectChildren = false;
14080
- }
14081
-
14082
- var p = element;
14083
-
14084
- while (p) {
14085
- var renderable = p.renderable;
14086
-
14087
- if (renderable) {
14088
- renderable.renderBoundsDirty = true;
14089
- renderable.boundsDirty = true;
14090
- renderable.dirty = true;
14091
- }
14092
-
14093
- p = p.parentNode;
14094
- }
14095
-
14096
- element.dispatchEvent(new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED, {
14097
- affectChildren: affectChildren
14098
- }));
14099
- }
14100
14412
  var SceneGraphService = manaSyringe.Syringe.defineToken('SceneGraphService');
14101
14413
  /**
14102
14414
  * update transform in scene graph
@@ -14109,6 +14421,8 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14109
14421
  var _this = this;
14110
14422
 
14111
14423
  this.sceneGraphSelectorFactory = void 0;
14424
+ this.pendingEvents = [];
14425
+ this.boundsChangedEvent = new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);
14112
14426
 
14113
14427
  this.rotate = function () {
14114
14428
  var parentInvertRotation = glMatrix.quat.create();
@@ -14516,6 +14830,16 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14516
14830
  this.dirtifyLocal(element, transform);
14517
14831
  };
14518
14832
 
14833
+ _proto.setLocalSkew = function setLocalSkew(element, skew, y) {
14834
+ if (typeof skew === 'number') {
14835
+ skew = glMatrix.vec2.fromValues(skew, y);
14836
+ }
14837
+
14838
+ var transform = element.transformable;
14839
+ glMatrix.vec2.copy(transform.localSkew, skew);
14840
+ this.dirtifyLocal(element, transform);
14841
+ };
14842
+
14519
14843
  _proto.dirtifyLocal = function dirtifyLocal(element, transform) {
14520
14844
  if (!transform.localDirtyFlag) {
14521
14845
  transform.localDirtyFlag = true;
@@ -14532,7 +14856,60 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14532
14856
  }
14533
14857
 
14534
14858
  this.dirtifyWorldInternal(element, transform);
14535
- dirtifyToRoot(element, true);
14859
+ this.dirtifyToRoot(element, true);
14860
+ };
14861
+
14862
+ _proto.triggerPendingEvents = function triggerPendingEvents() {
14863
+ var _this2 = this;
14864
+
14865
+ var set = new Set();
14866
+
14867
+ var trigger = function trigger(element, detail) {
14868
+ if (!set.has(element.entity)) {
14869
+ _this2.boundsChangedEvent.detail = detail;
14870
+ element.dispatchEvent(_this2.boundsChangedEvent);
14871
+ set.add(element.entity);
14872
+ }
14873
+ };
14874
+
14875
+ this.pendingEvents.forEach(function (_ref) {
14876
+ var element = _ref[0],
14877
+ detail = _ref[1];
14878
+
14879
+ if (detail.affectChildren) {
14880
+ element.forEach(function (e) {
14881
+ trigger(e, detail);
14882
+ });
14883
+ } else {
14884
+ trigger(element, detail);
14885
+ }
14886
+ });
14887
+ this.pendingEvents = [];
14888
+ };
14889
+
14890
+ _proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
14891
+ if (affectChildren === void 0) {
14892
+ affectChildren = false;
14893
+ }
14894
+
14895
+ var p = element;
14896
+
14897
+ while (p) {
14898
+ var renderable = p.renderable;
14899
+
14900
+ if (renderable) {
14901
+ renderable.renderBoundsDirty = true;
14902
+ renderable.boundsDirty = true;
14903
+ renderable.dirty = true;
14904
+ }
14905
+
14906
+ p = p.parentNode;
14907
+ } // reuse the same custom event
14908
+
14909
+
14910
+ this.pendingEvents.push([element, {
14911
+ affectChildren: affectChildren
14912
+ }]);
14536
14913
  };
14537
14914
 
14538
14915
  _proto.getPosition = function getPosition(element) {
@@ -14579,11 +14956,37 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14579
14956
  return element.transformable.localScale;
14580
14957
  };
14581
14958
 
14959
+ _proto.getLocalSkew = function getLocalSkew(element) {
14960
+ return element.transformable.localSkew;
14961
+ };
14962
+
14963
+ _proto.calcLocalTransform = function calcLocalTransform(transform) {
14964
+ // @see https://github.com/mattdesl/css-mat4/blob/master/index.js
14965
+ // mat4.fromRotationTranslationScaleOrigin(
14966
+ // transform.localTransform,
14967
+ // transform.localRotation,
14968
+ // transform.localPosition,
14969
+ // transform.localScale,
14970
+ // transform.origin,
14971
+ // );
14972
+ glMatrix.mat4.fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, glMatrix.vec3.fromValues(1, 1, 1), transform.origin); // apply skew2D
14973
+
14974
+ if (transform.localSkew[0] !== 0 || transform.localSkew[1] !== 0) {
14975
+ var tmpMat4 = glMatrix.mat4.identity(glMatrix.mat4.create());
14976
+ tmpMat4[4] = Math.tan(transform.localSkew[0]);
14977
+ tmpMat4[1] = Math.tan(transform.localSkew[1]);
14978
+ glMatrix.mat4.multiply(transform.localTransform, transform.localTransform, tmpMat4);
14979
+ }
14980
+
14981
+ var scaling = glMatrix.mat4.fromRotationTranslationScaleOrigin(glMatrix.mat4.create(), glMatrix.quat.fromValues(0, 0, 0, 1), glMatrix.vec3.create(), transform.localScale, transform.origin);
14982
+ glMatrix.mat4.multiply(transform.localTransform, transform.localTransform, scaling);
14983
+ };
14984
+
14582
14985
  _proto.getLocalTransform = function getLocalTransform(element) {
14583
14986
  var transform = element.transformable;
14584
14987
 
14585
14988
  if (transform.localDirtyFlag) {
14586
- glMatrix.mat4.fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, transform.localScale, transform.origin);
14989
+ this.calcLocalTransform(transform);
14587
14990
  transform.localDirtyFlag = false;
14588
14991
  }
14589
14992
 
@@ -14603,6 +15006,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14603
15006
  this.setLocalScale(element, [1, 1, 1]);
14604
15007
  this.setLocalPosition(element, [0, 0, 0]);
14605
15008
  this.setLocalEulerAngles(element, [0, 0, 0]);
15009
+ this.setLocalSkew(element, [0, 0]);
14606
15010
  };
14607
15011
 
14608
15012
  _proto.getTransformedGeometryBounds = function getTransformedGeometryBounds(element, render) {
@@ -14631,8 +15035,9 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14631
15035
  }
14632
15036
 
14633
15037
  var geometry = element.geometry;
14634
- var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
14635
- return bounds && new AABB(bounds.center, bounds.halfExtents) || new AABB();
15038
+ var bounds = render ? geometry.renderBounds : geometry.contentBounds || null; // return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
15039
+
15040
+ return bounds || new AABB();
14636
15041
  }
14637
15042
  /**
14638
15043
  * account for children in world space
@@ -14640,7 +15045,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14640
15045
  ;
14641
15046
 
14642
15047
  _proto.getBounds = function getBounds(element, render) {
14643
- var _this2 = this;
15048
+ var _this3 = this;
14644
15049
 
14645
15050
  if (render === void 0) {
14646
15051
  render = false;
@@ -14661,7 +15066,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14661
15066
 
14662
15067
  var children = element.childNodes;
14663
15068
  children.forEach(function (child) {
14664
- var childBounds = _this2.getBounds(child, render);
15069
+ var childBounds = _this3.getBounds(child, render);
14665
15070
 
14666
15071
  if (childBounds) {
14667
15072
  if (!aabb) {
@@ -14673,7 +15078,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14673
15078
  }
14674
15079
  }); // account for clip path
14675
15080
 
14676
- var clipPath = element.style.clipPath;
15081
+ var clipPath = element.parsedStyle.clipPath;
14677
15082
 
14678
15083
  if (clipPath) {
14679
15084
  var clipPathBounds = this.getTransformedGeometryBounds(clipPath, true);
@@ -14764,7 +15169,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14764
15169
  };
14765
15170
 
14766
15171
  _proto.dirtifyWorldInternal = function dirtifyWorldInternal(element, transform) {
14767
- var _this3 = this;
15172
+ var _this4 = this;
14768
15173
 
14769
15174
  if (!transform.dirtyFlag) {
14770
15175
  transform.dirtyFlag = true;
@@ -14773,7 +15178,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14773
15178
  var childTransform = child.transformable;
14774
15179
 
14775
15180
  if (!childTransform.dirtyFlag) {
14776
- _this3.dirtifyWorldInternal(child, childTransform);
15181
+ _this4.dirtifyWorldInternal(child, childTransform);
14777
15182
  }
14778
15183
  });
14779
15184
  var renderable = element.renderable;
@@ -14783,8 +15188,6 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14783
15188
  renderable.boundsDirty = true;
14784
15189
  renderable.dirty = true;
14785
15190
  }
14786
-
14787
- element.dispatchEvent(new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, element, null, null, 'modelMatrix', MutationEvent.MODIFICATION, null, null));
14788
15191
  }
14789
15192
  };
14790
15193
 
@@ -14810,7 +15213,7 @@ exports.DefaultSceneGraphService = /*#__PURE__*/function () {
14810
15213
 
14811
15214
  _proto.sync = function sync(element, transform) {
14812
15215
  if (transform.localDirtyFlag) {
14813
- glMatrix.mat4.fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, transform.localScale, transform.origin);
15216
+ this.calcLocalTransform(transform);
14814
15217
  transform.localDirtyFlag = false;
14815
15218
  }
14816
15219
 
@@ -16022,6 +16425,7 @@ var RenderingPluginContribution = manaSyringe.Syringe.defineToken('RenderingPlug
16022
16425
  exports.RenderingService = /*#__PURE__*/function () {
16023
16426
  function RenderingService() {
16024
16427
  this.renderingPluginProvider = void 0;
16428
+ this.canvasConfig = void 0;
16025
16429
  this.renderingContext = void 0;
16026
16430
  this.sceneGraphService = void 0;
16027
16431
  this.styleValueRegistry = void 0;
@@ -16135,6 +16539,21 @@ exports.RenderingService = /*#__PURE__*/function () {
16135
16539
 
16136
16540
  _proto.getStats = function getStats() {
16137
16541
  return this.stats;
16542
+ }
16543
+ /**
16544
+ * Meet the following conditions:
16545
+ * * disable DirtyRectangleRendering
16546
+ * * camera changed
16547
+ */
16548
+ ;
16549
+
16550
+ _proto.disableDirtyRectangleRendering = function disableDirtyRectangleRendering() {
16551
+ var renderer = this.canvasConfig.renderer;
16552
+
16553
+ var _renderer$getConfig = renderer.getConfig(),
16554
+ enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
16555
+
16556
+ return !enableDirtyRectangleRendering || this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
16138
16557
  };
16139
16558
 
16140
16559
  _proto.render = function render(canvasConfig) {
@@ -16144,6 +16563,7 @@ exports.RenderingService = /*#__PURE__*/function () {
16144
16563
  this.stats.rendered = 0;
16145
16564
  this.zIndexCounter = 0;
16146
16565
  this.sceneGraphService.syncHierarchy(this.renderingContext.root);
16566
+ this.sceneGraphService.triggerPendingEvents();
16147
16567
 
16148
16568
  if (this.renderingContext.renderReasons.size && this.inited) {
16149
16569
  this.renderDisplayObject(this.renderingContext.root, canvasConfig);
@@ -16231,6 +16651,8 @@ exports.RenderingService = /*#__PURE__*/function () {
16231
16651
 
16232
16652
  tslib.__decorate([manaSyringe.contrib(RenderingPluginContribution), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "renderingPluginProvider", void 0);
16233
16653
 
16654
+ tslib.__decorate([manaSyringe.inject(CanvasConfig), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "canvasConfig", void 0);
16655
+
16234
16656
  tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "renderingContext", void 0);
16235
16657
 
16236
16658
  tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.RenderingService.prototype, "sceneGraphService", void 0);
@@ -18224,7 +18646,9 @@ exports.PathUpdater = tslib.__decorate([manaSyringe.singleton({
18224
18646
  */
18225
18647
 
18226
18648
  exports.CSSPropertyClipPath = /*#__PURE__*/function () {
18227
- function CSSPropertyClipPath() {}
18649
+ function CSSPropertyClipPath() {
18650
+ this.sceneGraphService = void 0;
18651
+ }
18228
18652
 
18229
18653
  var _proto = CSSPropertyClipPath.prototype;
18230
18654
 
@@ -18235,26 +18659,28 @@ exports.CSSPropertyClipPath = /*#__PURE__*/function () {
18235
18659
  } // clear ref to old clip path
18236
18660
 
18237
18661
 
18238
- if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.style.clipPathTargets) {
18239
- var index = oldClipPath.style.clipPathTargets.indexOf(object);
18240
- oldClipPath.style.clipPathTargets.splice(index, 1);
18662
+ if (oldClipPath && oldClipPath !== newClipPath && oldClipPath.parsedStyle.clipPathTargets) {
18663
+ var index = oldClipPath.parsedStyle.clipPathTargets.indexOf(object);
18664
+ oldClipPath.parsedStyle.clipPathTargets.splice(index, 1);
18241
18665
  }
18242
18666
 
18243
18667
  if (newClipPath) {
18244
- if (!newClipPath.style.clipPathTargets) {
18245
- newClipPath.style.clipPathTargets = [];
18668
+ if (!newClipPath.parsedStyle.clipPathTargets) {
18669
+ newClipPath.parsedStyle.clipPathTargets = [];
18246
18670
  }
18247
18671
 
18248
- newClipPath.style.clipPathTargets.push(object);
18672
+ newClipPath.parsedStyle.clipPathTargets.push(object);
18249
18673
  }
18250
18674
 
18251
- dirtifyToRoot(object);
18675
+ this.sceneGraphService.dirtifyToRoot(object);
18252
18676
  return newClipPath;
18253
18677
  };
18254
18678
 
18255
18679
  return CSSPropertyClipPath;
18256
18680
  }();
18257
18681
 
18682
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.CSSPropertyClipPath.prototype, "sceneGraphService", void 0);
18683
+
18258
18684
  exports.CSSPropertyClipPath = tslib.__decorate([manaSyringe.singleton({
18259
18685
  token: {
18260
18686
  token: CSSProperty,
@@ -18334,21 +18760,6 @@ exports.CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18334
18760
  _proto.calculator = function calculator(name, oldParsed, computed, object, registry) {
18335
18761
  if (CSSUnitValue.isRelativeUnit(computed.unit)) {
18336
18762
  if (computed.unit === exports.UnitType.kPercentage) {
18337
- // try to resolve according to parent's geometry bounds
18338
- // if (object.parentElement) {
18339
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
18340
- // return this.calculateUsedValueWithParentBounds(object, name);
18341
- // } else {
18342
- // registry.addUnresolveProperty(object, name);
18343
- // // defer calculation after mounted
18344
- // // object.addEventListener(
18345
- // // ElementEvent.MOUNTED,
18346
- // // () => {
18347
- // // registry.registerParentGeometryBoundsChangedHandler(object, name);
18348
- // // },
18349
- // // { once: true },
18350
- // // );
18351
- // }
18352
18763
  return new CSSUnitValue(0, 'px');
18353
18764
  } else if (computed.unit === exports.UnitType.kEms) {
18354
18765
  if (object.parentNode) {
@@ -18382,10 +18793,13 @@ exports.CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18382
18793
  }();
18383
18794
 
18384
18795
  exports.CSSPropertyLengthOrPercentage = tslib.__decorate([manaSyringe.singleton({
18385
- token: {
18796
+ token: [{
18386
18797
  token: CSSProperty,
18387
18798
  named: exports.PropertySyntax.LENGTH_PERCENTAGE
18388
- }
18799
+ }, {
18800
+ token: CSSProperty,
18801
+ named: exports.PropertySyntax.LENGTH
18802
+ }]
18389
18803
  })], exports.CSSPropertyLengthOrPercentage);
18390
18804
 
18391
18805
  /**
@@ -18554,6 +18968,18 @@ exports.CSSPropertyLocalPosition = tslib.__decorate([manaSyringe.singleton({
18554
18968
  }
18555
18969
  })], exports.CSSPropertyLocalPosition);
18556
18970
 
18971
+ exports.CSSPropertyNumber = function CSSPropertyNumber() {
18972
+ this.mixer = mergeNumbers;
18973
+ this.parser = parseNumber;
18974
+ };
18975
+
18976
+ exports.CSSPropertyNumber = tslib.__decorate([manaSyringe.singleton({
18977
+ token: {
18978
+ token: CSSProperty,
18979
+ named: exports.PropertySyntax.NUMBER
18980
+ }
18981
+ })], exports.CSSPropertyNumber);
18982
+
18557
18983
  exports.CSSPropertyOffsetDistance = /*#__PURE__*/function () {
18558
18984
  function CSSPropertyOffsetDistance() {
18559
18985
  this.parser = parseNumber;
@@ -18862,9 +19288,9 @@ exports.CSSPropertyTransform = /*#__PURE__*/function () {
18862
19288
  // reset transform
18863
19289
  object.resetLocalTransform();
18864
19290
  object.setLocalPosition(defX, defY);
18865
- transform.forEach(function (_ref) {
18866
- var t = _ref.t,
18867
- d = _ref.d;
19291
+ transform.forEach(function (parsed) {
19292
+ var t = parsed.t,
19293
+ d = parsed.d;
18868
19294
 
18869
19295
  if (t === 'scale') {
18870
19296
  // scale(1) scale(1, 1)
@@ -18930,7 +19356,24 @@ exports.CSSPropertyTransform = /*#__PURE__*/function () {
18930
19356
  var _newAngles3 = d || [Odeg];
18931
19357
 
18932
19358
  object.rotateLocal(0, 0, _newAngles3[0].value);
18933
- } else ;
19359
+ } else if (t === 'rotate3d') ; else if (t === 'skew') {
19360
+ var newSkew = d.map(function (s) {
19361
+ return s.value;
19362
+ }) || [0, 0];
19363
+ object.setLocalSkew(deg2rad(newSkew[0]), deg2rad(newSkew[1]));
19364
+ } else if (t === 'skewx') {
19365
+ var _newSkew = d.map(function (s) {
19366
+ return s.value;
19367
+ }) || [0];
19368
+
19369
+ object.setLocalSkew(deg2rad(_newSkew[0]), object.getLocalSkew()[1]);
19370
+ } else if (t === 'skewy') {
19371
+ var _newSkew2 = d.map(function (s) {
19372
+ return s.value;
19373
+ }) || [0];
19374
+
19375
+ object.setLocalSkew(object.getLocalSkew()[0], deg2rad(_newSkew2[0]));
19376
+ }
18934
19377
  });
18935
19378
  }
18936
19379
  };
@@ -19185,13 +19628,25 @@ var BUILT_IN_PROPERTIES = [{
19185
19628
  name: 'transformOrigin',
19186
19629
  parsePriority: 100,
19187
19630
  // interpolable: true,
19188
- defaultValue: 'left top',
19631
+ defaultValue: function defaultValue(nodeName) {
19632
+ if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
19633
+ return 'center';
19634
+ }
19635
+
19636
+ return 'left top';
19637
+ },
19189
19638
  layoutDependent: true,
19190
19639
  syntax: exports.PropertySyntax.TRANSFORM_ORIGIN
19191
19640
  }, {
19192
19641
  name: 'anchor',
19193
19642
  parsePriority: 99,
19194
- defaultValue: '0 0',
19643
+ defaultValue: function defaultValue(nodeName) {
19644
+ if (nodeName === exports.Shape.CIRCLE || nodeName === exports.Shape.ELLIPSE) {
19645
+ return '0.5 0.5';
19646
+ }
19647
+
19648
+ return '0 0';
19649
+ },
19195
19650
  layoutDependent: true,
19196
19651
  syntax: exports.PropertySyntax.LENGTH_PERCENTAGE_12
19197
19652
  }, // <circle> & <ellipse>
@@ -19411,6 +19866,7 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19411
19866
  this.cache = {};
19412
19867
  this.unresolvedProperties = {};
19413
19868
  this.propertySyntaxFactory = void 0;
19869
+ this.sceneGraphService = void 0;
19414
19870
  this.cascadeProperties = {};
19415
19871
  }
19416
19872
 
@@ -19616,7 +20072,7 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19616
20072
  if (value === 'initial') {
19617
20073
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
19618
20074
  if (!isNil(defaultValue)) {
19619
- computed = this.parseProperty(name, defaultValue, object);
20075
+ computed = this.parseProperty(name, isFunction(defaultValue) ? defaultValue(object.nodeName) : defaultValue, object);
19620
20076
  }
19621
20077
  } else if (value === 'inherit') {
19622
20078
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
@@ -19857,8 +20313,7 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19857
20313
  usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0].value || 0) * geometry.contentBounds.halfExtents[0] * 2;
19858
20314
  usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1].value || 0) * geometry.contentBounds.halfExtents[1] * 2;
19859
20315
  object.setOrigin(usedOriginXValue, usedOriginYValue);
19860
- object.dispatchEvent(new CustomEvent(exports.ElementEvent.GEOMETRY_BOUNDS_CHANGED));
19861
- dirtifyToRoot(object);
20316
+ this.sceneGraphService.dirtifyToRoot(object);
19862
20317
  }
19863
20318
  };
19864
20319
 
@@ -19877,6 +20332,8 @@ exports.DefaultStyleValueRegistry = /*#__PURE__*/function () {
19877
20332
 
19878
20333
  tslib.__decorate([manaSyringe.inject(CSSPropertySyntaxFactory), tslib.__metadata("design:type", Function)], exports.DefaultStyleValueRegistry.prototype, "propertySyntaxFactory", void 0);
19879
20334
 
20335
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], exports.DefaultStyleValueRegistry.prototype, "sceneGraphService", void 0);
20336
+
19880
20337
  tslib.__decorate([manaSyringe.postConstruct(), tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", []), tslib.__metadata("design:returntype", void 0)], exports.DefaultStyleValueRegistry.prototype, "init", null);
19881
20338
 
19882
20339
  exports.DefaultStyleValueRegistry = tslib.__decorate([manaSyringe.singleton({
@@ -19926,6 +20383,7 @@ var containerModule = manaSyringe.Module(function (register) {
19926
20383
  }
19927
20384
  }); // bind CSS property handlers
19928
20385
 
20386
+ register(exports.CSSPropertyNumber);
19929
20387
  register(exports.CSSPropertyAngle);
19930
20388
  register(exports.CSSPropertyClipPath);
19931
20389
  register(exports.CSSPropertyColor);
@@ -20057,7 +20515,7 @@ var AbstractRenderer = /*#__PURE__*/function () {
20057
20515
  * only dirty object will cause re-render
20058
20516
  */
20059
20517
  enableDirtyCheck: true,
20060
- enableCulling: true,
20518
+ enableCulling: false,
20061
20519
 
20062
20520
  /**
20063
20521
  * enable auto rendering by default
@@ -20129,26 +20587,29 @@ var CullingPlugin = CullingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
20129
20587
  _proto.apply = function apply(renderingService) {
20130
20588
  var _this = this;
20131
20589
 
20132
- // const strategies = this.strategyProvider.getContributions();
20590
+ var strategies = this.strategyProvider.getContributions();
20133
20591
  renderingService.hooks.cull.tap(CullingPlugin_1.tag, function (object) {
20134
20592
  if (object) {
20135
- var cullable = object.cullable;
20136
- cullable.visible = true; // // const renderBounds = object.getRenderBounds();
20137
- // // if (AABB.isEmpty(renderBounds)) {
20138
- // // cullable.visible = false;
20139
- // // } else {
20140
- // // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
20141
- // // const [p0, p1, p2, p3] = camera.getFrustum().planes;
20142
- // // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
20143
- // // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
20144
- // // }
20145
- // if (strategies.length === 0) {
20146
- // cullable.visible = this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
20593
+ var cullable = object.cullable; // cullable.visible = true;
20594
+ // const renderBounds = object.getRenderBounds();
20595
+ // if (AABB.isEmpty(renderBounds)) {
20596
+ // cullable.visible = false;
20147
20597
  // } else {
20148
- // // eg. implemented by g-webgl(frustum culling)
20149
- // cullable.visible = strategies.every((strategy) => strategy.isVisible(object));
20598
+ // const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
20599
+ // const [p0, p1, p2, p3] = camera.getFrustum().planes;
20600
+ // tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
20601
+ // cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
20150
20602
  // }
20151
20603
 
20604
+ if (strategies.length === 0) {
20605
+ cullable.visible = _this.renderingContext.unculledEntities.indexOf(object.entity) > -1;
20606
+ } else {
20607
+ // eg. implemented by g-webgl(frustum culling)
20608
+ cullable.visible = strategies.every(function (strategy) {
20609
+ return strategy.isVisible(object);
20610
+ });
20611
+ }
20612
+
20152
20613
  if (!cullable.isCulled() && object.isVisible()) {
20153
20614
  return object;
20154
20615
  } else {
@@ -20186,22 +20647,15 @@ var DirtyCheckPlugin_1;
20186
20647
  */
20187
20648
 
20188
20649
  var DirtyCheckPlugin = DirtyCheckPlugin_1 = (_class$2 = /*#__PURE__*/function () {
20189
- function DirtyCheckPlugin() {
20190
- this.renderingContext = void 0;
20191
- }
20650
+ function DirtyCheckPlugin() {}
20192
20651
 
20193
20652
  var _proto = DirtyCheckPlugin.prototype;
20194
20653
 
20195
20654
  _proto.apply = function apply(renderingService) {
20196
- var _this = this;
20197
-
20198
20655
  renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin_1.tag, function (object) {
20199
20656
  if (object) {
20200
20657
  var renderable = object.renderable;
20201
-
20202
- var isCameraDirty = _this.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
20203
-
20204
- var isDirty = renderable.dirty || isCameraDirty;
20658
+ var isDirty = renderable.dirty || renderingService.disableDirtyRectangleRendering();
20205
20659
 
20206
20660
  if (isDirty) {
20207
20661
  return object;
@@ -20216,9 +20670,6 @@ var DirtyCheckPlugin = DirtyCheckPlugin_1 = (_class$2 = /*#__PURE__*/function ()
20216
20670
 
20217
20671
  return DirtyCheckPlugin;
20218
20672
  }(), _class$2.tag = 'DirtyCheck', _class$2);
20219
-
20220
- tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design:type", Object)], DirtyCheckPlugin.prototype, "renderingContext", void 0);
20221
-
20222
20673
  DirtyCheckPlugin = DirtyCheckPlugin_1 = tslib.__decorate([manaSyringe.singleton({
20223
20674
  contrib: RenderingPluginContribution
20224
20675
  })], DirtyCheckPlugin);
@@ -20643,6 +21094,7 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
20643
21094
  function PrepareRendererPlugin() {
20644
21095
  this.renderingContext = void 0;
20645
21096
  this.styleValueRegistry = void 0;
21097
+ this.sceneGraphService = void 0;
20646
21098
  this.rBush = void 0;
20647
21099
  this.toSync = new Set();
20648
21100
  }
@@ -20689,7 +21141,8 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
20689
21141
 
20690
21142
  _this2.styleValueRegistry.recalc(object);
20691
21143
 
20692
- dirtifyToRoot(object);
21144
+ _this2.sceneGraphService.dirtifyToRoot(object);
21145
+
20693
21146
  renderingService.dirtify();
20694
21147
  };
20695
21148
 
@@ -20703,7 +21156,8 @@ var PrepareRendererPlugin = PrepareRendererPlugin_1 = (_class$4 = /*#__PURE__*/f
20703
21156
  _this2.toSync.delete(object);
20704
21157
  }
20705
21158
 
20706
- dirtifyToRoot(e.target);
21159
+ _this2.sceneGraphService.dirtifyToRoot(e.target);
21160
+
20707
21161
  renderingService.dirtify();
20708
21162
  };
20709
21163
 
@@ -20793,6 +21247,8 @@ tslib.__decorate([manaSyringe.inject(RenderingContext), tslib.__metadata("design
20793
21247
 
20794
21248
  tslib.__decorate([manaSyringe.inject(StyleValueRegistry), tslib.__metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
20795
21249
 
21250
+ tslib.__decorate([manaSyringe.inject(SceneGraphService), tslib.__metadata("design:type", Object)], PrepareRendererPlugin.prototype, "sceneGraphService", void 0);
21251
+
20796
21252
  tslib.__decorate([manaSyringe.inject(RBushRoot), tslib.__metadata("design:type", RBush__default['default'])], PrepareRendererPlugin.prototype, "rBush", void 0);
20797
21253
 
20798
21254
  PrepareRendererPlugin = PrepareRendererPlugin_1 = tslib.__decorate([manaSyringe.singleton({
@@ -21620,6 +22076,7 @@ exports.computeLinearGradient = computeLinearGradient;
21620
22076
  exports.computeRadialGradient = computeRadialGradient;
21621
22077
  exports.convertAngleUnit = convertAngleUnit;
21622
22078
  exports.convertEffectInput = convertEffectInput;
22079
+ exports.convertItemToMatrix = convertItemToMatrix;
21623
22080
  exports.convertPercentUnit = convertPercentUnit;
21624
22081
  exports.convertToDash = convertToDash;
21625
22082
  exports.convertToPath = convertToPath;
@@ -21627,7 +22084,6 @@ exports.createVec3 = createVec3;
21627
22084
  exports.decompose = decompose;
21628
22085
  exports.deg2rad = deg2rad;
21629
22086
  exports.deg2turn = deg2turn;
21630
- exports.dirtifyToRoot = dirtifyToRoot;
21631
22087
  exports.equalSet = equalSet;
21632
22088
  exports.extractPolygons = extractPolygons;
21633
22089
  exports.formatAttribute = formatAttribute;