@antv/g-lite 2.0.11-alpha.7 → 2.0.12-alpha.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/AbstractRenderer.d.ts +0 -1
- package/dist/Canvas.d.ts +2 -2
- package/dist/camera/Camera.d.ts +0 -1
- package/dist/camera/Landmark.d.ts +0 -1
- package/dist/camera/index.d.ts +0 -1
- package/dist/camera/interfaces.d.ts +0 -1
- package/dist/components/Cullable.d.ts +0 -1
- package/dist/components/Geometry.d.ts +0 -1
- package/dist/components/RBushNode.d.ts +0 -1
- package/dist/components/Renderable.d.ts +0 -5
- package/dist/components/Sortable.d.ts +0 -1
- package/dist/components/Transform.d.ts +0 -5
- package/dist/components/index.d.ts +0 -1
- package/dist/css/CSS.d.ts +0 -1
- package/dist/css/CSSProperty.d.ts +1 -10
- package/dist/css/CSSStyleValuePool.d.ts +0 -1
- package/dist/css/StyleValueRegistry.d.ts +2 -26
- package/dist/css/cssom/CSSColorValue.d.ts +1 -1
- package/dist/css/cssom/CSSGradientValue.d.ts +0 -1
- package/dist/css/cssom/CSSKeywordValue.d.ts +0 -1
- package/dist/css/cssom/CSSNumericValue.d.ts +1 -1
- package/dist/css/cssom/CSSRGB.d.ts +0 -1
- package/dist/css/cssom/CSSStyleValue.d.ts +1 -2
- package/dist/css/cssom/index.d.ts +0 -2
- package/dist/css/cssom/types.d.ts +0 -8
- package/dist/css/index.d.ts +0 -1
- package/dist/css/interfaces.d.ts +8 -8
- package/dist/css/parser/color.d.ts +0 -1
- package/dist/css/parser/dimension.d.ts +0 -1
- package/dist/css/parser/filter.d.ts +0 -1
- package/dist/css/parser/gradient.d.ts +0 -1
- package/dist/css/parser/index.d.ts +0 -1
- package/dist/css/parser/numeric.d.ts +0 -1
- package/dist/css/parser/path.d.ts +0 -1
- package/dist/css/parser/points.d.ts +0 -1
- package/dist/css/parser/transform-origin.d.ts +0 -3
- package/dist/css/parser/transform.d.ts +0 -1
- package/dist/css/parser/types.d.ts +0 -1
- package/dist/css/properties/CSSPropertyAngle.d.ts +0 -7
- package/dist/css/properties/CSSPropertyClipPath.d.ts +0 -1
- package/dist/css/properties/CSSPropertyColor.d.ts +0 -5
- package/dist/css/properties/CSSPropertyFilter.d.ts +0 -3
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts +0 -7
- package/dist/css/properties/CSSPropertyLengthOrPercentage12.d.ts +0 -2
- package/dist/css/properties/CSSPropertyLengthOrPercentage14.d.ts +0 -2
- package/dist/css/properties/CSSPropertyMarker.d.ts +0 -1
- package/dist/css/properties/CSSPropertyNumber.d.ts +0 -7
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts +0 -7
- package/dist/css/properties/CSSPropertyOpacity.d.ts +0 -7
- package/dist/css/properties/CSSPropertyPath.d.ts +0 -2
- package/dist/css/properties/CSSPropertyPoints.d.ts +1 -3
- package/dist/css/properties/CSSPropertyShadowBlur.d.ts +0 -1
- package/dist/css/properties/CSSPropertyText.d.ts +0 -1
- package/dist/css/properties/CSSPropertyTextTransform.d.ts +0 -1
- package/dist/css/properties/CSSPropertyTransform.d.ts +2 -5
- package/dist/css/properties/CSSPropertyTransformOrigin.d.ts +0 -6
- package/dist/css/properties/CSSPropertyZIndex.d.ts +0 -6
- package/dist/css/properties/index.d.ts +0 -1
- package/dist/display-objects/Circle.d.ts +0 -1
- package/dist/display-objects/CustomElement.d.ts +0 -1
- package/dist/display-objects/DisplayObject.d.ts +2 -10
- package/dist/display-objects/Ellipse.d.ts +0 -1
- package/dist/display-objects/Fragment.d.ts +13 -0
- package/dist/display-objects/Group.d.ts +0 -1
- package/dist/display-objects/HTML.d.ts +0 -1
- package/dist/display-objects/Image.d.ts +0 -1
- package/dist/display-objects/Line.d.ts +0 -1
- package/dist/display-objects/Path.d.ts +0 -1
- package/dist/display-objects/Polygon.d.ts +0 -1
- package/dist/display-objects/Polyline.d.ts +0 -1
- package/dist/display-objects/Rect.d.ts +0 -1
- package/dist/display-objects/Text.d.ts +0 -1
- package/dist/display-objects/constants.d.ts +0 -1
- package/dist/display-objects/index.d.ts +1 -1
- package/dist/dom/CustomElementRegistry.d.ts +0 -1
- package/dist/dom/CustomEvent.d.ts +0 -1
- package/dist/dom/Document.d.ts +1 -2
- package/dist/dom/Element.d.ts +3 -3
- package/dist/dom/EventTarget.d.ts +1 -2
- package/dist/dom/FederatedEvent.d.ts +1 -1
- package/dist/dom/FederatedMouseEvent.d.ts +0 -1
- package/dist/dom/FederatedPointerEvent.d.ts +0 -1
- package/dist/dom/FederatedWheelEvent.d.ts +0 -1
- package/dist/dom/MutationEvent.d.ts +0 -1
- package/dist/dom/Node.d.ts +7 -2
- package/dist/dom/index.d.ts +0 -1
- package/dist/dom/interfaces.d.ts +4 -8
- package/dist/global-runtime.d.ts +0 -13
- package/dist/index.d.ts +0 -2
- package/dist/index.esm.js +611 -1204
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +610 -1201
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/plugins/CullingPlugin.d.ts +0 -1
- package/dist/plugins/DirtyCheckPlugin.d.ts +0 -1
- package/dist/plugins/EventPlugin.d.ts +0 -1
- package/dist/plugins/FrustumCullingStrategy.d.ts +0 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts +3 -5
- package/dist/services/ContextService.d.ts +0 -1
- package/dist/services/EventService.d.ts +0 -1
- package/dist/services/OffscreenCanvasCreator.d.ts +0 -1
- package/dist/services/RenderingContext.d.ts +0 -1
- package/dist/services/RenderingService.d.ts +3 -10
- package/dist/services/SceneGraphSelector.d.ts +0 -1
- package/dist/services/SceneGraphService.d.ts +3 -12
- package/dist/services/TextService.d.ts +0 -1
- package/dist/services/aabb/CircleUpdater.d.ts +0 -1
- package/dist/services/aabb/EllipseUpdater.d.ts +0 -1
- package/dist/services/aabb/GroupUpdater.d.ts +0 -1
- package/dist/services/aabb/HTMLUpdater.d.ts +0 -1
- package/dist/services/aabb/LineUpdater.d.ts +0 -1
- package/dist/services/aabb/PathUpdater.d.ts +0 -1
- package/dist/services/aabb/PolylineUpdater.d.ts +0 -1
- package/dist/services/aabb/RectUpdater.d.ts +0 -1
- package/dist/services/aabb/TextUpdater.d.ts +0 -1
- package/dist/services/aabb/index.d.ts +0 -1
- package/dist/services/aabb/interfaces.d.ts +0 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/interfaces.d.ts +1 -2
- package/dist/shapes/AABB.d.ts +0 -1
- package/dist/shapes/Frustum.d.ts +0 -1
- package/dist/shapes/Plane.d.ts +0 -1
- package/dist/shapes/Point.d.ts +0 -1
- package/dist/shapes/Rectangle.d.ts +0 -1
- package/dist/shapes/index.d.ts +0 -1
- package/dist/types.d.ts +7 -17
- package/dist/utils/assert.d.ts +0 -8
- package/dist/utils/canvas.d.ts +1 -2
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/error.d.ts +0 -1
- package/dist/utils/event.d.ts +0 -1
- package/dist/utils/fragment.d.ts +2 -0
- package/dist/utils/gradient.d.ts +0 -1
- package/dist/utils/index.d.ts +1 -2
- package/dist/utils/math.d.ts +0 -1
- package/dist/utils/memoize.d.ts +0 -1
- package/dist/utils/path.d.ts +0 -1
- package/dist/utils/pointer-events.d.ts +0 -1
- package/dist/utils/raf.d.ts +0 -1
- package/dist/utils/tapable/AsyncParallelHook.d.ts +0 -1
- package/dist/utils/tapable/AsyncSeriesWaterfallHook.d.ts +0 -1
- package/dist/utils/tapable/Hook.d.ts +0 -1
- package/dist/utils/tapable/SyncHook.d.ts +0 -1
- package/dist/utils/tapable/SyncWaterfallHook.d.ts +0 -1
- package/dist/utils/tapable/index.d.ts +0 -1
- package/dist/utils/text.d.ts +0 -1
- package/dist/utils/transform-mat4.d.ts +0 -1
- package/package.json +2 -2
- package/dist/AbstractRenderer.d.ts.map +0 -1
- package/dist/Canvas.d.ts.map +0 -1
- package/dist/camera/Camera.d.ts.map +0 -1
- package/dist/camera/Landmark.d.ts.map +0 -1
- package/dist/camera/index.d.ts.map +0 -1
- package/dist/camera/interfaces.d.ts.map +0 -1
- package/dist/components/Cullable.d.ts.map +0 -1
- package/dist/components/Geometry.d.ts.map +0 -1
- package/dist/components/RBushNode.d.ts.map +0 -1
- package/dist/components/Renderable.d.ts.map +0 -1
- package/dist/components/Sortable.d.ts.map +0 -1
- package/dist/components/Transform.d.ts.map +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/css/CSS.d.ts.map +0 -1
- package/dist/css/CSSProperty.d.ts.map +0 -1
- package/dist/css/CSSStyleValuePool.d.ts.map +0 -1
- package/dist/css/StyleValueRegistry.d.ts.map +0 -1
- package/dist/css/cssom/CSSColorValue.d.ts.map +0 -1
- package/dist/css/cssom/CSSGradientValue.d.ts.map +0 -1
- package/dist/css/cssom/CSSKeywordValue.d.ts.map +0 -1
- package/dist/css/cssom/CSSMathOperator.d.ts +0 -12
- package/dist/css/cssom/CSSMathOperator.d.ts.map +0 -1
- package/dist/css/cssom/CSSNumericSumValue.d.ts +0 -8
- package/dist/css/cssom/CSSNumericSumValue.d.ts.map +0 -1
- package/dist/css/cssom/CSSNumericValue.d.ts.map +0 -1
- package/dist/css/cssom/CSSRGB.d.ts.map +0 -1
- package/dist/css/cssom/CSSStyleValue.d.ts.map +0 -1
- package/dist/css/cssom/index.d.ts.map +0 -1
- package/dist/css/cssom/types.d.ts.map +0 -1
- package/dist/css/index.d.ts.map +0 -1
- package/dist/css/interfaces.d.ts.map +0 -1
- package/dist/css/parser/color.d.ts.map +0 -1
- package/dist/css/parser/dimension.d.ts.map +0 -1
- package/dist/css/parser/filter.d.ts.map +0 -1
- package/dist/css/parser/gradient.d.ts.map +0 -1
- package/dist/css/parser/index.d.ts.map +0 -1
- package/dist/css/parser/numeric.d.ts.map +0 -1
- package/dist/css/parser/path.d.ts.map +0 -1
- package/dist/css/parser/points.d.ts.map +0 -1
- package/dist/css/parser/transform-origin.d.ts.map +0 -1
- package/dist/css/parser/transform.d.ts.map +0 -1
- package/dist/css/parser/types.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyAngle.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyClipPath.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyColor.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyFilter.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyLengthOrPercentage.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyLengthOrPercentage12.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyLengthOrPercentage14.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyMarker.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyNumber.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyOffsetDistance.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyOpacity.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyPath.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyPoints.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyShadowBlur.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyText.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyTextTransform.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyTransform.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyTransformOrigin.d.ts.map +0 -1
- package/dist/css/properties/CSSPropertyZIndex.d.ts.map +0 -1
- package/dist/css/properties/index.d.ts.map +0 -1
- package/dist/display-objects/Circle.d.ts.map +0 -1
- package/dist/display-objects/CustomElement.d.ts.map +0 -1
- package/dist/display-objects/DisplayObject.d.ts.map +0 -1
- package/dist/display-objects/Ellipse.d.ts.map +0 -1
- package/dist/display-objects/Group.d.ts.map +0 -1
- package/dist/display-objects/HTML.d.ts.map +0 -1
- package/dist/display-objects/Image.d.ts.map +0 -1
- package/dist/display-objects/Line.d.ts.map +0 -1
- package/dist/display-objects/Path.d.ts.map +0 -1
- package/dist/display-objects/Polygon.d.ts.map +0 -1
- package/dist/display-objects/Polyline.d.ts.map +0 -1
- package/dist/display-objects/Rect.d.ts.map +0 -1
- package/dist/display-objects/Text.d.ts.map +0 -1
- package/dist/display-objects/constants.d.ts.map +0 -1
- package/dist/display-objects/index.d.ts.map +0 -1
- package/dist/dom/CustomElementRegistry.d.ts.map +0 -1
- package/dist/dom/CustomEvent.d.ts.map +0 -1
- package/dist/dom/Document.d.ts.map +0 -1
- package/dist/dom/Element.d.ts.map +0 -1
- package/dist/dom/EventTarget.d.ts.map +0 -1
- package/dist/dom/FederatedEvent.d.ts.map +0 -1
- package/dist/dom/FederatedMouseEvent.d.ts.map +0 -1
- package/dist/dom/FederatedPointerEvent.d.ts.map +0 -1
- package/dist/dom/FederatedWheelEvent.d.ts.map +0 -1
- package/dist/dom/MutationEvent.d.ts.map +0 -1
- package/dist/dom/Node.d.ts.map +0 -1
- package/dist/dom/index.d.ts.map +0 -1
- package/dist/dom/interfaces.d.ts.map +0 -1
- package/dist/global-runtime.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/plugins/CullingPlugin.d.ts.map +0 -1
- package/dist/plugins/DirtyCheckPlugin.d.ts.map +0 -1
- package/dist/plugins/EventPlugin.d.ts.map +0 -1
- package/dist/plugins/FrustumCullingStrategy.d.ts.map +0 -1
- package/dist/plugins/PrepareRendererPlugin.d.ts.map +0 -1
- package/dist/preset.d.ts +0 -2
- package/dist/preset.d.ts.map +0 -1
- package/dist/services/ContextService.d.ts.map +0 -1
- package/dist/services/EventService.d.ts.map +0 -1
- package/dist/services/OffscreenCanvasCreator.d.ts.map +0 -1
- package/dist/services/RenderingContext.d.ts.map +0 -1
- package/dist/services/RenderingService.d.ts.map +0 -1
- package/dist/services/SceneGraphSelector.d.ts.map +0 -1
- package/dist/services/SceneGraphService.d.ts.map +0 -1
- package/dist/services/TextService.d.ts.map +0 -1
- package/dist/services/aabb/CircleUpdater.d.ts.map +0 -1
- package/dist/services/aabb/EllipseUpdater.d.ts.map +0 -1
- package/dist/services/aabb/GroupUpdater.d.ts.map +0 -1
- package/dist/services/aabb/HTMLUpdater.d.ts.map +0 -1
- package/dist/services/aabb/LineUpdater.d.ts.map +0 -1
- package/dist/services/aabb/PathUpdater.d.ts.map +0 -1
- package/dist/services/aabb/PolylineUpdater.d.ts.map +0 -1
- package/dist/services/aabb/RectUpdater.d.ts.map +0 -1
- package/dist/services/aabb/TextUpdater.d.ts.map +0 -1
- package/dist/services/aabb/index.d.ts.map +0 -1
- package/dist/services/aabb/interfaces.d.ts.map +0 -1
- package/dist/services/index.d.ts.map +0 -1
- package/dist/services/interfaces.d.ts.map +0 -1
- package/dist/shapes/AABB.d.ts.map +0 -1
- package/dist/shapes/Frustum.d.ts.map +0 -1
- package/dist/shapes/Plane.d.ts.map +0 -1
- package/dist/shapes/Point.d.ts.map +0 -1
- package/dist/shapes/Rectangle.d.ts.map +0 -1
- package/dist/shapes/index.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/assert.d.ts.map +0 -1
- package/dist/utils/canvas.d.ts.map +0 -1
- package/dist/utils/dom.d.ts.map +0 -1
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/event.d.ts.map +0 -1
- package/dist/utils/gradient.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/math.d.ts.map +0 -1
- package/dist/utils/memoize.d.ts.map +0 -1
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/pointer-events.d.ts.map +0 -1
- package/dist/utils/raf.d.ts.map +0 -1
- package/dist/utils/string.d.ts +0 -6
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/tapable/AsyncParallelHook.d.ts.map +0 -1
- package/dist/utils/tapable/AsyncSeriesWaterfallHook.d.ts.map +0 -1
- package/dist/utils/tapable/Hook.d.ts.map +0 -1
- package/dist/utils/tapable/SyncHook.d.ts.map +0 -1
- package/dist/utils/tapable/SyncWaterfallHook.d.ts.map +0 -1
- package/dist/utils/tapable/index.d.ts.map +0 -1
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/transform-mat4.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var glMatrix = require('gl-matrix');
|
|
4
3
|
var tslib = require('tslib');
|
|
5
4
|
var EventEmitter = require('eventemitter3');
|
|
5
|
+
var glMatrix = require('gl-matrix');
|
|
6
6
|
var util = require('@antv/util');
|
|
7
7
|
var d3 = require('d3-color');
|
|
8
8
|
var gMath = require('@antv/g-math');
|
|
@@ -26,8 +26,6 @@ function _interopNamespaceDefault(e) {
|
|
|
26
26
|
|
|
27
27
|
var d3__namespace = /*#__PURE__*/_interopNamespaceDefault(d3);
|
|
28
28
|
|
|
29
|
-
glMatrix.glMatrix.setMatrixArrayType(Array);
|
|
30
|
-
|
|
31
29
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
32
30
|
|
|
33
31
|
var rbush = {exports: {}};
|
|
@@ -611,6 +609,7 @@ var RBush = rbush.exports;
|
|
|
611
609
|
exports.Shape = void 0;
|
|
612
610
|
(function (Shape) {
|
|
613
611
|
Shape["GROUP"] = "g";
|
|
612
|
+
Shape["FRAGMENT"] = "fragment";
|
|
614
613
|
Shape["CIRCLE"] = "circle";
|
|
615
614
|
Shape["ELLIPSE"] = "ellipse";
|
|
616
615
|
Shape["IMAGE"] = "image";
|
|
@@ -664,7 +663,7 @@ var AbstractRenderer = /** @class */ (function () {
|
|
|
664
663
|
/**
|
|
665
664
|
* enable dirty rectangle rendering by default
|
|
666
665
|
*/
|
|
667
|
-
enableDirtyRectangleRendering: true,
|
|
666
|
+
enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
|
|
668
667
|
}
|
|
669
668
|
AbstractRenderer.prototype.registerPlugin = function (plugin) {
|
|
670
669
|
var index = this.plugins.findIndex(function (p) { return p === plugin; });
|
|
@@ -701,10 +700,10 @@ var addVec3 = glMatrix.vec3.add, copyVec3 = glMatrix.vec3.copy, maxVec3 = glMatr
|
|
|
701
700
|
*/
|
|
702
701
|
var AABB = /** @class */ (function () {
|
|
703
702
|
function AABB() {
|
|
704
|
-
this.center =
|
|
705
|
-
this.halfExtents =
|
|
706
|
-
this.min =
|
|
707
|
-
this.max =
|
|
703
|
+
this.center = [0, 0, 0];
|
|
704
|
+
this.halfExtents = [0, 0, 0];
|
|
705
|
+
this.min = [0, 0, 0];
|
|
706
|
+
this.max = [0, 0, 0];
|
|
708
707
|
}
|
|
709
708
|
AABB.isEmpty = function (aabb) {
|
|
710
709
|
return (!aabb ||
|
|
@@ -2189,6 +2188,99 @@ var Camera = /** @class */ (function () {
|
|
|
2189
2188
|
return Camera;
|
|
2190
2189
|
}());
|
|
2191
2190
|
|
|
2191
|
+
/**
|
|
2192
|
+
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
2193
|
+
*/
|
|
2194
|
+
exports.Strategy = void 0;
|
|
2195
|
+
(function (Strategy) {
|
|
2196
|
+
Strategy[Strategy["Standard"] = 0] = "Standard";
|
|
2197
|
+
})(exports.Strategy || (exports.Strategy = {}));
|
|
2198
|
+
|
|
2199
|
+
exports.SortReason = void 0;
|
|
2200
|
+
(function (SortReason) {
|
|
2201
|
+
SortReason[SortReason["ADDED"] = 0] = "ADDED";
|
|
2202
|
+
SortReason[SortReason["REMOVED"] = 1] = "REMOVED";
|
|
2203
|
+
SortReason[SortReason["Z_INDEX_CHANGED"] = 2] = "Z_INDEX_CHANGED";
|
|
2204
|
+
})(exports.SortReason || (exports.SortReason = {}));
|
|
2205
|
+
|
|
2206
|
+
var EMPTY_PARSED_PATH = {
|
|
2207
|
+
absolutePath: [],
|
|
2208
|
+
hasArc: false,
|
|
2209
|
+
segments: [],
|
|
2210
|
+
polygons: [],
|
|
2211
|
+
polylines: [],
|
|
2212
|
+
curve: null,
|
|
2213
|
+
totalLength: 0,
|
|
2214
|
+
rect: new Rectangle(0, 0, 0, 0),
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type
|
|
2219
|
+
*/
|
|
2220
|
+
exports.PropertySyntax = void 0;
|
|
2221
|
+
(function (PropertySyntax) {
|
|
2222
|
+
/**
|
|
2223
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#coordinate
|
|
2224
|
+
*/
|
|
2225
|
+
PropertySyntax["COORDINATE"] = "<coordinate>";
|
|
2226
|
+
/**
|
|
2227
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#color
|
|
2228
|
+
*/
|
|
2229
|
+
PropertySyntax["COLOR"] = "<color>";
|
|
2230
|
+
/**
|
|
2231
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#paint
|
|
2232
|
+
*/
|
|
2233
|
+
PropertySyntax["PAINT"] = "<paint>";
|
|
2234
|
+
/**
|
|
2235
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#number
|
|
2236
|
+
*/
|
|
2237
|
+
PropertySyntax["NUMBER"] = "<number>";
|
|
2238
|
+
/**
|
|
2239
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/angle
|
|
2240
|
+
*/
|
|
2241
|
+
PropertySyntax["ANGLE"] = "<angle>";
|
|
2242
|
+
/**
|
|
2243
|
+
* <number> with range 0..1
|
|
2244
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#opacity_value
|
|
2245
|
+
*/
|
|
2246
|
+
PropertySyntax["OPACITY_VALUE"] = "<opacity-value>";
|
|
2247
|
+
/**
|
|
2248
|
+
* <number> with range 0..Infinity
|
|
2249
|
+
*/
|
|
2250
|
+
PropertySyntax["SHADOW_BLUR"] = "<shadow-blur>";
|
|
2251
|
+
/**
|
|
2252
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#length
|
|
2253
|
+
*/
|
|
2254
|
+
PropertySyntax["LENGTH"] = "<length>";
|
|
2255
|
+
/**
|
|
2256
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage
|
|
2257
|
+
*/
|
|
2258
|
+
PropertySyntax["PERCENTAGE"] = "<percentage>";
|
|
2259
|
+
PropertySyntax["LENGTH_PERCENTAGE"] = "<length> | <percentage>";
|
|
2260
|
+
PropertySyntax["LENGTH_PERCENTAGE_12"] = "[<length> | <percentage>]{1,2}";
|
|
2261
|
+
/**
|
|
2262
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#formal_syntax
|
|
2263
|
+
*/
|
|
2264
|
+
PropertySyntax["LENGTH_PERCENTAGE_14"] = "[<length> | <percentage>]{1,4}";
|
|
2265
|
+
/**
|
|
2266
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
|
|
2267
|
+
*/
|
|
2268
|
+
PropertySyntax["LIST_OF_POINTS"] = "<list-of-points>";
|
|
2269
|
+
PropertySyntax["PATH"] = "<path>";
|
|
2270
|
+
/**
|
|
2271
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
|
|
2272
|
+
*/
|
|
2273
|
+
PropertySyntax["FILTER"] = "<filter>";
|
|
2274
|
+
PropertySyntax["Z_INDEX"] = "<z-index>";
|
|
2275
|
+
PropertySyntax["OFFSET_DISTANCE"] = "<offset-distance>";
|
|
2276
|
+
PropertySyntax["DEFINED_PATH"] = "<defined-path>";
|
|
2277
|
+
PropertySyntax["MARKER"] = "<marker>";
|
|
2278
|
+
PropertySyntax["TRANSFORM"] = "<transform>";
|
|
2279
|
+
PropertySyntax["TRANSFORM_ORIGIN"] = "<transform-origin>";
|
|
2280
|
+
PropertySyntax["TEXT"] = "<text>";
|
|
2281
|
+
PropertySyntax["TEXT_TRANSFORM"] = "<text-transform>";
|
|
2282
|
+
})(exports.PropertySyntax || (exports.PropertySyntax = {}));
|
|
2283
|
+
|
|
2192
2284
|
function memoize(func, resolver) {
|
|
2193
2285
|
if (typeof func !== 'function' ||
|
|
2194
2286
|
(resolver != null && typeof resolver !== 'function')) {
|
|
@@ -2305,14 +2397,6 @@ var UnitCategory;
|
|
|
2305
2397
|
// kUResolution,
|
|
2306
2398
|
UnitCategory[UnitCategory["kUOther"] = 5] = "kUOther";
|
|
2307
2399
|
})(UnitCategory || (UnitCategory = {}));
|
|
2308
|
-
var ValueRange;
|
|
2309
|
-
(function (ValueRange) {
|
|
2310
|
-
ValueRange[ValueRange["kAll"] = 0] = "kAll";
|
|
2311
|
-
ValueRange[ValueRange["kNonNegative"] = 1] = "kNonNegative";
|
|
2312
|
-
ValueRange[ValueRange["kInteger"] = 2] = "kInteger";
|
|
2313
|
-
ValueRange[ValueRange["kNonNegativeInteger"] = 3] = "kNonNegativeInteger";
|
|
2314
|
-
ValueRange[ValueRange["kPositiveInteger"] = 4] = "kPositiveInteger";
|
|
2315
|
-
})(ValueRange || (ValueRange = {}));
|
|
2316
2400
|
var Nested;
|
|
2317
2401
|
(function (Nested) {
|
|
2318
2402
|
Nested[Nested["kYes"] = 0] = "kYes";
|
|
@@ -2831,13 +2915,6 @@ var CSSColorValue = /** @class */ (function (_super) {
|
|
|
2831
2915
|
CSSColorValue.prototype.getType = function () {
|
|
2832
2916
|
return CSSStyleValueType.kColorType;
|
|
2833
2917
|
};
|
|
2834
|
-
// buildCSSText(n: Nested, p: ParenLess, result: string): string {
|
|
2835
|
-
// let text = '';
|
|
2836
|
-
// if (this.colorSpace === 'rgb') {
|
|
2837
|
-
// text = `rgba(${this.channels.join(',')},${this.alpha})`;
|
|
2838
|
-
// }
|
|
2839
|
-
// return (result += text);
|
|
2840
|
-
// }
|
|
2841
2918
|
/**
|
|
2842
2919
|
* @see https://drafts.css-houdini.org/css-typed-om-1/#dom-csscolorvalue-to
|
|
2843
2920
|
*/
|
|
@@ -2898,99 +2975,6 @@ var CSSKeywordValue = /** @class */ (function (_super) {
|
|
|
2898
2975
|
return CSSKeywordValue;
|
|
2899
2976
|
}(CSSStyleValue));
|
|
2900
2977
|
|
|
2901
|
-
var regexp = /-([a-z])/g;
|
|
2902
|
-
var camelCase = memoize(function (str) {
|
|
2903
|
-
if (str === void 0) { str = ''; }
|
|
2904
|
-
return str.replace(regexp, function (g) { return g[1].toUpperCase(); });
|
|
2905
|
-
});
|
|
2906
|
-
var kebabize = function (str) {
|
|
2907
|
-
return str
|
|
2908
|
-
.split('')
|
|
2909
|
-
.map(function (letter, idx) {
|
|
2910
|
-
return letter.toUpperCase() === letter
|
|
2911
|
-
? "".concat(idx !== 0 ? '-' : '').concat(letter.toLowerCase())
|
|
2912
|
-
: letter;
|
|
2913
|
-
})
|
|
2914
|
-
.join('');
|
|
2915
|
-
};
|
|
2916
|
-
|
|
2917
|
-
function DCHECK(bool) {
|
|
2918
|
-
if (!bool) {
|
|
2919
|
-
throw new Error();
|
|
2920
|
-
}
|
|
2921
|
-
}
|
|
2922
|
-
function isSymbol(value) {
|
|
2923
|
-
// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
2924
|
-
return typeof value === 'symbol';
|
|
2925
|
-
}
|
|
2926
|
-
var definedProps = function (obj) {
|
|
2927
|
-
return Object.fromEntries(Object.entries(obj).filter(function (_a) {
|
|
2928
|
-
var _b = tslib.__read(_a, 2), v = _b[1];
|
|
2929
|
-
return v !== undefined;
|
|
2930
|
-
}));
|
|
2931
|
-
};
|
|
2932
|
-
var FORMAT_ATTR_MAP = {
|
|
2933
|
-
d: {
|
|
2934
|
-
alias: 'path',
|
|
2935
|
-
},
|
|
2936
|
-
strokeDasharray: {
|
|
2937
|
-
alias: 'lineDash',
|
|
2938
|
-
},
|
|
2939
|
-
strokeWidth: {
|
|
2940
|
-
alias: 'lineWidth',
|
|
2941
|
-
},
|
|
2942
|
-
textAnchor: {
|
|
2943
|
-
alias: 'textAlign',
|
|
2944
|
-
},
|
|
2945
|
-
src: {
|
|
2946
|
-
alias: 'img',
|
|
2947
|
-
},
|
|
2948
|
-
};
|
|
2949
|
-
var formatAttributeName = memoize(function (name) {
|
|
2950
|
-
var attributeName = camelCase(name);
|
|
2951
|
-
var map = FORMAT_ATTR_MAP[attributeName];
|
|
2952
|
-
attributeName = (map === null || map === void 0 ? void 0 : map.alias) || attributeName;
|
|
2953
|
-
return attributeName;
|
|
2954
|
-
});
|
|
2955
|
-
function formatAttributes(attributes) {
|
|
2956
|
-
var e_1, _a;
|
|
2957
|
-
var formattedAttributes = {};
|
|
2958
|
-
try {
|
|
2959
|
-
for (var _b = tslib.__values(Object.entries(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2960
|
-
var _d = tslib.__read(_c.value, 2), key = _d[0], value = _d[1];
|
|
2961
|
-
var formattedKey = formatAttributeName(key);
|
|
2962
|
-
formattedAttributes[formattedKey] = value;
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2966
|
-
finally {
|
|
2967
|
-
try {
|
|
2968
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2969
|
-
}
|
|
2970
|
-
finally { if (e_1) throw e_1.error; }
|
|
2971
|
-
}
|
|
2972
|
-
return formattedAttributes;
|
|
2973
|
-
}
|
|
2974
|
-
|
|
2975
|
-
// type CSSNumericBaseType =
|
|
2976
|
-
// | 'length'
|
|
2977
|
-
// | 'angle'
|
|
2978
|
-
// | 'time'
|
|
2979
|
-
// | 'frequency'
|
|
2980
|
-
// | 'resolution'
|
|
2981
|
-
// | 'flex'
|
|
2982
|
-
// | 'percent';
|
|
2983
|
-
// https://drafts.css-houdini.org/css-typed-om/#dictdef-cssnumerictype
|
|
2984
|
-
// interface CSSNumericType {
|
|
2985
|
-
// length: number;
|
|
2986
|
-
// angle: number;
|
|
2987
|
-
// time: number;
|
|
2988
|
-
// frequency: number;
|
|
2989
|
-
// resolution: number;
|
|
2990
|
-
// flex: number;
|
|
2991
|
-
// percent: number;
|
|
2992
|
-
// percentHint: CSSNumericBaseType;
|
|
2993
|
-
// }
|
|
2994
2978
|
var formatInfinityOrNaN = function (number, suffix) {
|
|
2995
2979
|
if (suffix === void 0) { suffix = ''; }
|
|
2996
2980
|
var result = '';
|
|
@@ -3001,7 +2985,6 @@ var formatInfinityOrNaN = function (number, suffix) {
|
|
|
3001
2985
|
result = '-infinity';
|
|
3002
2986
|
}
|
|
3003
2987
|
else {
|
|
3004
|
-
DCHECK(Number.isNaN(number));
|
|
3005
2988
|
result = 'NaN';
|
|
3006
2989
|
}
|
|
3007
2990
|
return (result += suffix);
|
|
@@ -3097,8 +3080,8 @@ var CSSUnitValue = /** @class */ (function (_super) {
|
|
|
3097
3080
|
case exports.UnitType.kSeconds:
|
|
3098
3081
|
// case UnitType.kHertz:
|
|
3099
3082
|
// case UnitType.kKilohertz:
|
|
3100
|
-
// case UnitType.kContainerMax: { // case UnitType.kContainerMin: // case UnitType.kContainerBlockSize: // case UnitType.kContainerInlineSize: // case UnitType.kContainerHeight: // case UnitType.kContainerWidth: // case UnitType.kDynamicViewportMax: // case UnitType.kDynamicViewportMin: // case UnitType.kDynamicViewportBlockSize: // case UnitType.kDynamicViewportInlineSize: // case UnitType.kDynamicViewportHeight: // case UnitType.kDynamicViewportWidth: // case UnitType.kLargeViewportMax: // case UnitType.kLargeViewportMin: // case UnitType.kLargeViewportBlockSize: // case UnitType.kLargeViewportInlineSize: // case UnitType.kLargeViewportHeight: // case UnitType.kLargeViewportWidth: // case UnitType.kSmallViewportMax: // case UnitType.kSmallViewportMin: // case UnitType.kSmallViewportBlockSize: // case UnitType.kSmallViewportInlineSize: // case UnitType.kSmallViewportHeight: // case UnitType.kSmallViewportWidth: // case UnitType.kViewportMax: // case UnitType.kViewportMin: // case UnitType.kViewportBlockSize: // case UnitType.kViewportInlineSize: // case UnitType.kViewportHeight: // case UnitType.kViewportWidth: // case UnitType.kFraction:
|
|
3101
3083
|
case exports.UnitType.kTurns: {
|
|
3084
|
+
// case UnitType.kContainerMax: { // case UnitType.kContainerMin: // case UnitType.kContainerBlockSize: // case UnitType.kContainerInlineSize: // case UnitType.kContainerHeight: // case UnitType.kContainerWidth: // case UnitType.kDynamicViewportMax: // case UnitType.kDynamicViewportMin: // case UnitType.kDynamicViewportBlockSize: // case UnitType.kDynamicViewportInlineSize: // case UnitType.kDynamicViewportHeight: // case UnitType.kDynamicViewportWidth: // case UnitType.kLargeViewportMax: // case UnitType.kLargeViewportMin: // case UnitType.kLargeViewportBlockSize: // case UnitType.kLargeViewportInlineSize: // case UnitType.kLargeViewportHeight: // case UnitType.kLargeViewportWidth: // case UnitType.kSmallViewportMax: // case UnitType.kSmallViewportMin: // case UnitType.kSmallViewportBlockSize: // case UnitType.kSmallViewportInlineSize: // case UnitType.kSmallViewportHeight: // case UnitType.kSmallViewportWidth: // case UnitType.kViewportMax: // case UnitType.kViewportMin: // case UnitType.kViewportBlockSize: // case UnitType.kViewportInlineSize: // case UnitType.kViewportHeight: // case UnitType.kViewportWidth: // case UnitType.kFraction:
|
|
3102
3085
|
var kMinInteger = -999999;
|
|
3103
3086
|
var kMaxInteger = 999999;
|
|
3104
3087
|
var value = this.value;
|
|
@@ -3123,6 +3106,7 @@ var CSSUnitValue = /** @class */ (function (_super) {
|
|
|
3123
3106
|
return CSSUnitValue;
|
|
3124
3107
|
}(CSSStyleValue));
|
|
3125
3108
|
var Opx = new CSSUnitValue(0, 'px');
|
|
3109
|
+
new CSSUnitValue(1, 'px');
|
|
3126
3110
|
var Odeg = new CSSUnitValue(0, 'deg');
|
|
3127
3111
|
|
|
3128
3112
|
/**
|
|
@@ -3198,99 +3182,6 @@ var getOrCreateUnitValue = function (value, unitOrName) {
|
|
|
3198
3182
|
};
|
|
3199
3183
|
new CSSUnitValue(50, '%');
|
|
3200
3184
|
|
|
3201
|
-
/**
|
|
3202
|
-
* @see https://doc.babylonjs.com/how_to/optimizing_your_scene#changing-mesh-culling-strategy
|
|
3203
|
-
*/
|
|
3204
|
-
exports.Strategy = void 0;
|
|
3205
|
-
(function (Strategy) {
|
|
3206
|
-
Strategy[Strategy["Standard"] = 0] = "Standard";
|
|
3207
|
-
})(exports.Strategy || (exports.Strategy = {}));
|
|
3208
|
-
|
|
3209
|
-
exports.SortReason = void 0;
|
|
3210
|
-
(function (SortReason) {
|
|
3211
|
-
SortReason[SortReason["ADDED"] = 0] = "ADDED";
|
|
3212
|
-
SortReason[SortReason["REMOVED"] = 1] = "REMOVED";
|
|
3213
|
-
SortReason[SortReason["Z_INDEX_CHANGED"] = 2] = "Z_INDEX_CHANGED";
|
|
3214
|
-
})(exports.SortReason || (exports.SortReason = {}));
|
|
3215
|
-
|
|
3216
|
-
var EMPTY_PARSED_PATH = {
|
|
3217
|
-
absolutePath: [],
|
|
3218
|
-
hasArc: false,
|
|
3219
|
-
segments: [],
|
|
3220
|
-
polygons: [],
|
|
3221
|
-
polylines: [],
|
|
3222
|
-
curve: null,
|
|
3223
|
-
totalLength: 0,
|
|
3224
|
-
rect: new Rectangle(0, 0, 0, 0),
|
|
3225
|
-
};
|
|
3226
|
-
|
|
3227
|
-
/**
|
|
3228
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type
|
|
3229
|
-
*/
|
|
3230
|
-
exports.PropertySyntax = void 0;
|
|
3231
|
-
(function (PropertySyntax) {
|
|
3232
|
-
/**
|
|
3233
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#coordinate
|
|
3234
|
-
*/
|
|
3235
|
-
PropertySyntax["COORDINATE"] = "<coordinate>";
|
|
3236
|
-
/**
|
|
3237
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#color
|
|
3238
|
-
*/
|
|
3239
|
-
PropertySyntax["COLOR"] = "<color>";
|
|
3240
|
-
/**
|
|
3241
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#paint
|
|
3242
|
-
*/
|
|
3243
|
-
PropertySyntax["PAINT"] = "<paint>";
|
|
3244
|
-
/**
|
|
3245
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#number
|
|
3246
|
-
*/
|
|
3247
|
-
PropertySyntax["NUMBER"] = "<number>";
|
|
3248
|
-
/**
|
|
3249
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/angle
|
|
3250
|
-
*/
|
|
3251
|
-
PropertySyntax["ANGLE"] = "<angle>";
|
|
3252
|
-
/**
|
|
3253
|
-
* <number> with range 0..1
|
|
3254
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#opacity_value
|
|
3255
|
-
*/
|
|
3256
|
-
PropertySyntax["OPACITY_VALUE"] = "<opacity-value>";
|
|
3257
|
-
/**
|
|
3258
|
-
* <number> with range 0..Infinity
|
|
3259
|
-
*/
|
|
3260
|
-
PropertySyntax["SHADOW_BLUR"] = "<shadow-blur>";
|
|
3261
|
-
/**
|
|
3262
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#length
|
|
3263
|
-
*/
|
|
3264
|
-
PropertySyntax["LENGTH"] = "<length>";
|
|
3265
|
-
/**
|
|
3266
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage
|
|
3267
|
-
*/
|
|
3268
|
-
PropertySyntax["PERCENTAGE"] = "<percentage>";
|
|
3269
|
-
PropertySyntax["LENGTH_PERCENTAGE"] = "<length> | <percentage>";
|
|
3270
|
-
PropertySyntax["LENGTH_PERCENTAGE_12"] = "[<length> | <percentage>]{1,2}";
|
|
3271
|
-
/**
|
|
3272
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/margin#formal_syntax
|
|
3273
|
-
*/
|
|
3274
|
-
PropertySyntax["LENGTH_PERCENTAGE_14"] = "[<length> | <percentage>]{1,4}";
|
|
3275
|
-
/**
|
|
3276
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#list-of-ts
|
|
3277
|
-
*/
|
|
3278
|
-
PropertySyntax["LIST_OF_POINTS"] = "<list-of-points>";
|
|
3279
|
-
PropertySyntax["PATH"] = "<path>";
|
|
3280
|
-
/**
|
|
3281
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/filter#formal_syntax
|
|
3282
|
-
*/
|
|
3283
|
-
PropertySyntax["FILTER"] = "<filter>";
|
|
3284
|
-
PropertySyntax["Z_INDEX"] = "<z-index>";
|
|
3285
|
-
PropertySyntax["OFFSET_DISTANCE"] = "<offset-distance>";
|
|
3286
|
-
PropertySyntax["DEFINED_PATH"] = "<defined-path>";
|
|
3287
|
-
PropertySyntax["MARKER"] = "<marker>";
|
|
3288
|
-
PropertySyntax["TRANSFORM"] = "<transform>";
|
|
3289
|
-
PropertySyntax["TRANSFORM_ORIGIN"] = "<transform-origin>";
|
|
3290
|
-
PropertySyntax["TEXT"] = "<text>";
|
|
3291
|
-
PropertySyntax["TEXT_TRANSFORM"] = "<text-transform>";
|
|
3292
|
-
})(exports.PropertySyntax || (exports.PropertySyntax = {}));
|
|
3293
|
-
|
|
3294
3185
|
/**
|
|
3295
3186
|
* borrow from gradient-parser, but we delete some browser compatible prefix such as `-webkit-`
|
|
3296
3187
|
* @see https://github.com/rafaelcaricio/gradient-parser
|
|
@@ -4114,16 +4005,6 @@ function parseDimensionArrayFormat(string, size) {
|
|
|
4114
4005
|
}
|
|
4115
4006
|
}
|
|
4116
4007
|
}
|
|
4117
|
-
function parseDimensionArray(string) {
|
|
4118
|
-
if (util.isString(string)) {
|
|
4119
|
-
// "1px 2px 3px"
|
|
4120
|
-
return string.split(' ').map(function (segment) { return parseLengthOrPercentage(segment); });
|
|
4121
|
-
}
|
|
4122
|
-
else {
|
|
4123
|
-
// [1, '2px', 3]
|
|
4124
|
-
return string.map(function (segment) { return parseLengthOrPercentage(segment.toString()); });
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
4008
|
// export function mergeDimensionList(
|
|
4128
4009
|
// left: CSSUnitValue[],
|
|
4129
4010
|
// right: CSSUnitValue[],
|
|
@@ -5972,39 +5853,6 @@ var parseTransformOrigin = memoize(function (value) {
|
|
|
5972
5853
|
];
|
|
5973
5854
|
}
|
|
5974
5855
|
});
|
|
5975
|
-
var parseTransformOriginUnmemoize = function (value) {
|
|
5976
|
-
if (util.isString(value)) {
|
|
5977
|
-
if (value === 'text-anchor') {
|
|
5978
|
-
return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
|
|
5979
|
-
}
|
|
5980
|
-
var values = value.split(' ');
|
|
5981
|
-
if (values.length === 1) {
|
|
5982
|
-
if (values[0] === 'top' || values[0] === 'bottom') {
|
|
5983
|
-
// 'top' -> 'center top'
|
|
5984
|
-
values[1] = values[0];
|
|
5985
|
-
values[0] = 'center';
|
|
5986
|
-
}
|
|
5987
|
-
else {
|
|
5988
|
-
// '50px' -> '50px center'
|
|
5989
|
-
values[1] = 'center';
|
|
5990
|
-
}
|
|
5991
|
-
}
|
|
5992
|
-
if (values.length !== 2) {
|
|
5993
|
-
return null;
|
|
5994
|
-
}
|
|
5995
|
-
// eg. center bottom
|
|
5996
|
-
return [
|
|
5997
|
-
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[0])),
|
|
5998
|
-
parseLengthOrPercentageUnmemoize(convertKeyword2Percent(values[1])),
|
|
5999
|
-
];
|
|
6000
|
-
}
|
|
6001
|
-
else {
|
|
6002
|
-
return [
|
|
6003
|
-
getOrCreateUnitValue(value[0] || 0, 'px'),
|
|
6004
|
-
getOrCreateUnitValue(value[1] || 0, 'px'),
|
|
6005
|
-
];
|
|
6006
|
-
}
|
|
6007
|
-
};
|
|
6008
5856
|
function convertKeyword2Percent(keyword) {
|
|
6009
5857
|
if (keyword === 'center') {
|
|
6010
5858
|
return '50%';
|
|
@@ -6599,19 +6447,7 @@ var BUILT_IN_PROPERTIES = [
|
|
|
6599
6447
|
];
|
|
6600
6448
|
var GEOMETRY_ATTRIBUTE_NAMES = BUILT_IN_PROPERTIES.filter(function (n) { return !!n.l; }).map(function (n) { return n.n; });
|
|
6601
6449
|
var propertyMetadataCache = {};
|
|
6602
|
-
var unresolvedProperties = new WeakMap();
|
|
6603
|
-
var isPropertyResolved = function (object, name) {
|
|
6604
|
-
var properties = unresolvedProperties.get(object);
|
|
6605
|
-
if (!properties || properties.length === 0) {
|
|
6606
|
-
return true;
|
|
6607
|
-
}
|
|
6608
|
-
return properties.includes(name);
|
|
6609
|
-
};
|
|
6610
6450
|
var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
6611
|
-
/**
|
|
6612
|
-
* need recalc later
|
|
6613
|
-
*/
|
|
6614
|
-
// dirty = false;
|
|
6615
6451
|
function DefaultStyleValueRegistry(runtime) {
|
|
6616
6452
|
var _this = this;
|
|
6617
6453
|
this.runtime = runtime;
|
|
@@ -6624,9 +6460,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6624
6460
|
propertyMetadataCache[name] = metadata;
|
|
6625
6461
|
});
|
|
6626
6462
|
};
|
|
6627
|
-
DefaultStyleValueRegistry.prototype.unregisterMetadata = function (name) {
|
|
6628
|
-
delete propertyMetadataCache[name];
|
|
6629
|
-
};
|
|
6630
6463
|
DefaultStyleValueRegistry.prototype.getPropertySyntax = function (syntax) {
|
|
6631
6464
|
return this.runtime.CSSPropertySyntaxFactory[syntax];
|
|
6632
6465
|
};
|
|
@@ -6639,344 +6472,124 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
6639
6472
|
* * calculate used value
|
|
6640
6473
|
* * post process
|
|
6641
6474
|
*/
|
|
6642
|
-
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes,
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
object.parsedStyle.radius = parseDimensionArrayFormat(
|
|
6680
|
-
// @ts-ignore
|
|
6681
|
-
attributes.radius, 4);
|
|
6682
|
-
}
|
|
6683
|
-
// Polyline
|
|
6684
|
-
if (!util.isNil(attributes.lineDash)) {
|
|
6685
|
-
object.parsedStyle.lineDash = parseDimensionArrayFormat(attributes.lineDash, 2);
|
|
6686
|
-
}
|
|
6687
|
-
// @ts-ignore
|
|
6688
|
-
if (attributes.points) {
|
|
6689
|
-
// @ts-ignore
|
|
6690
|
-
object.parsedStyle.points = parsePoints(attributes.points);
|
|
6691
|
-
}
|
|
6692
|
-
// Path
|
|
6693
|
-
// @ts-ignore
|
|
6694
|
-
if (attributes.d === '') {
|
|
6695
|
-
object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
|
|
6696
|
-
}
|
|
6697
|
-
// @ts-ignore
|
|
6698
|
-
if (attributes.d) {
|
|
6699
|
-
object.parsedStyle.d = parsePath(
|
|
6700
|
-
// @ts-ignore
|
|
6701
|
-
attributes.d);
|
|
6702
|
-
}
|
|
6703
|
-
// Text
|
|
6704
|
-
if (attributes.textTransform) {
|
|
6705
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TEXT_TRANSFORM].calculator(null, null, { value: attributes.textTransform }, object, null);
|
|
6706
|
-
}
|
|
6707
|
-
}
|
|
6708
|
-
if (!util.isUndefined(attributes.clipPath)) {
|
|
6709
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.DEFINED_PATH].calculator('clipPath', oldClipPath, attributes.clipPath, object, this.runtime);
|
|
6710
|
-
}
|
|
6711
|
-
if (needParseStyle && attributes.offsetPath) {
|
|
6712
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.DEFINED_PATH].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
|
|
6713
|
-
}
|
|
6714
|
-
if (attributes.transform) {
|
|
6715
|
-
object.parsedStyle.transform = parseTransform(attributes.transform);
|
|
6716
|
-
}
|
|
6717
|
-
if (attributes.transformOrigin) {
|
|
6718
|
-
object.parsedStyle.transformOrigin = parseTransformOrigin(attributes.transformOrigin);
|
|
6719
|
-
}
|
|
6720
|
-
if (util.isNumber(attributes.zIndex)) {
|
|
6721
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.Z_INDEX].postProcessor(object);
|
|
6722
|
-
}
|
|
6723
|
-
if (needParseStyle) {
|
|
6724
|
-
// Marker
|
|
6725
|
-
// @ts-ignore
|
|
6726
|
-
if (attributes.markerStart) {
|
|
6727
|
-
object.parsedStyle.markerStart =
|
|
6728
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator(null,
|
|
6729
|
-
// @ts-ignore
|
|
6730
|
-
attributes.markerStart,
|
|
6731
|
-
// @ts-ignore
|
|
6732
|
-
attributes.markerStart, null, null);
|
|
6733
|
-
}
|
|
6734
|
-
// @ts-ignore
|
|
6735
|
-
if (attributes.markerEnd) {
|
|
6736
|
-
object.parsedStyle.markerEnd = this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator(null,
|
|
6737
|
-
// @ts-ignore
|
|
6738
|
-
attributes.markerEnd,
|
|
6739
|
-
// @ts-ignore
|
|
6740
|
-
attributes.markerEnd, null, null);
|
|
6741
|
-
}
|
|
6742
|
-
// @ts-ignore
|
|
6743
|
-
if (attributes.markerMid) {
|
|
6744
|
-
object.parsedStyle.markerMid = this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator('',
|
|
6745
|
-
// @ts-ignore
|
|
6746
|
-
attributes.markerMid,
|
|
6747
|
-
// @ts-ignore
|
|
6748
|
-
attributes.markerMid, null, null);
|
|
6749
|
-
}
|
|
6750
|
-
if (util.isNumber(attributes.offsetDistance)) {
|
|
6751
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.OFFSET_DISTANCE].postProcessor(object);
|
|
6752
|
-
}
|
|
6753
|
-
}
|
|
6754
|
-
if (attributes.transform) {
|
|
6755
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TRANSFORM].postProcessor(object);
|
|
6756
|
-
}
|
|
6757
|
-
if (attributes.transformOrigin) {
|
|
6758
|
-
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TRANSFORM_ORIGIN].postProcessor(object);
|
|
6759
|
-
}
|
|
6760
|
-
if (needUpdateGeometry) {
|
|
6761
|
-
object.geometry.dirty = true;
|
|
6762
|
-
object.renderable.boundsDirty = true;
|
|
6763
|
-
object.renderable.renderBoundsDirty = true;
|
|
6764
|
-
if (!forceUpdateGeometry) {
|
|
6765
|
-
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6766
|
-
}
|
|
6767
|
-
}
|
|
6475
|
+
DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
|
|
6476
|
+
if (options === void 0) { options = {
|
|
6477
|
+
skipUpdateAttribute: false,
|
|
6478
|
+
skipParse: false,
|
|
6479
|
+
forceUpdateGeometry: false,
|
|
6480
|
+
usedAttributes: [],
|
|
6481
|
+
memoize: true,
|
|
6482
|
+
}; }
|
|
6483
|
+
Object.assign(object.attributes, attributes);
|
|
6484
|
+
// clipPath
|
|
6485
|
+
var oldClipPath = object.parsedStyle.clipPath;
|
|
6486
|
+
var oldOffsetPath = object.parsedStyle.offsetPath;
|
|
6487
|
+
Object.assign(object.parsedStyle, attributes);
|
|
6488
|
+
var needUpdateGeometry = !!options.forceUpdateGeometry;
|
|
6489
|
+
if (!needUpdateGeometry &&
|
|
6490
|
+
GEOMETRY_ATTRIBUTE_NAMES.some(function (name) { return name in attributes; })) {
|
|
6491
|
+
needUpdateGeometry = true;
|
|
6492
|
+
}
|
|
6493
|
+
if (attributes.fill) {
|
|
6494
|
+
object.parsedStyle.fill = parseColor(attributes.fill);
|
|
6495
|
+
}
|
|
6496
|
+
if (attributes.stroke) {
|
|
6497
|
+
object.parsedStyle.stroke = parseColor(attributes.stroke);
|
|
6498
|
+
}
|
|
6499
|
+
if (attributes.shadowColor) {
|
|
6500
|
+
object.parsedStyle.shadowColor = parseColor(attributes.shadowColor);
|
|
6501
|
+
}
|
|
6502
|
+
if (attributes.filter) {
|
|
6503
|
+
object.parsedStyle.filter = parseFilter(attributes.filter);
|
|
6504
|
+
}
|
|
6505
|
+
// Rect
|
|
6506
|
+
// @ts-ignore
|
|
6507
|
+
if (!util.isNil(attributes.radius)) {
|
|
6508
|
+
// @ts-ignore
|
|
6509
|
+
object.parsedStyle.radius = parseDimensionArrayFormat(
|
|
6510
|
+
// @ts-ignore
|
|
6511
|
+
attributes.radius, 4);
|
|
6768
6512
|
}
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
attributeNames_1.forEach(function (attributeName) {
|
|
6773
|
-
var _a;
|
|
6774
|
-
if (!skipUpdateAttribute) {
|
|
6775
|
-
object.attributes[attributeName] = attributes[attributeName];
|
|
6776
|
-
}
|
|
6777
|
-
if (!needUpdateGeometry_1 && ((_a = propertyMetadataCache[attributeName]) === null || _a === void 0 ? void 0 : _a.l)) {
|
|
6778
|
-
needUpdateGeometry_1 = true;
|
|
6779
|
-
}
|
|
6780
|
-
});
|
|
6781
|
-
if (!skipParse) {
|
|
6782
|
-
attributeNames_1.forEach(function (name) {
|
|
6783
|
-
object.computedStyle[name] = _this.parseProperty(name, object.attributes[name], object, memoize);
|
|
6784
|
-
});
|
|
6785
|
-
}
|
|
6786
|
-
// let hasUnresolvedProperties = false;
|
|
6787
|
-
// parse according to priority
|
|
6788
|
-
// path 50
|
|
6789
|
-
// points 50
|
|
6790
|
-
// text 50
|
|
6791
|
-
// textTransform 51
|
|
6792
|
-
// transform 100
|
|
6793
|
-
// transformOrigin 100
|
|
6794
|
-
if (usedAttributes === null || usedAttributes === void 0 ? void 0 : usedAttributes.length) {
|
|
6795
|
-
// uniqueAttributeSet.clear();
|
|
6796
|
-
attributeNames_1 = Array.from(new Set(attributeNames_1.concat(usedAttributes)));
|
|
6797
|
-
}
|
|
6798
|
-
attributeNames_1.forEach(function (name) {
|
|
6799
|
-
// some style props maybe deleted after parsing such as `anchor` in Text
|
|
6800
|
-
if (name in object.computedStyle) {
|
|
6801
|
-
object.parsedStyle[name] = _this.computeProperty(name, object.computedStyle[name], object, memoize);
|
|
6802
|
-
}
|
|
6803
|
-
});
|
|
6804
|
-
// update geometry
|
|
6805
|
-
if (needUpdateGeometry_1) {
|
|
6806
|
-
object.geometry.dirty = true;
|
|
6807
|
-
object.renderable.boundsDirty = true;
|
|
6808
|
-
object.renderable.renderBoundsDirty = true;
|
|
6809
|
-
if (!forceUpdateGeometry) {
|
|
6810
|
-
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6811
|
-
}
|
|
6812
|
-
}
|
|
6813
|
-
attributeNames_1.forEach(function (name) {
|
|
6814
|
-
if (name in object.parsedStyle) {
|
|
6815
|
-
_this.postProcessProperty(name, object, attributeNames_1);
|
|
6816
|
-
}
|
|
6817
|
-
});
|
|
6818
|
-
if (this.runtime.enableCSSParsing && object.children.length) {
|
|
6819
|
-
attributeNames_1.forEach(function (name) {
|
|
6820
|
-
if (name in object.parsedStyle && _this.isPropertyInheritable(name)) {
|
|
6821
|
-
// update children's inheritable
|
|
6822
|
-
object.children.forEach(function (child) {
|
|
6823
|
-
child.internalSetAttribute(name, null, true, true, undefined, undefined, undefined);
|
|
6824
|
-
});
|
|
6825
|
-
}
|
|
6826
|
-
});
|
|
6827
|
-
}
|
|
6513
|
+
// Polyline
|
|
6514
|
+
if (!util.isNil(attributes.lineDash)) {
|
|
6515
|
+
object.parsedStyle.lineDash = parseDimensionArrayFormat(attributes.lineDash, 2);
|
|
6828
6516
|
}
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
DefaultStyleValueRegistry.prototype.parseProperty = function (name, value, object, memoized) {
|
|
6834
|
-
var metadata = propertyMetadataCache[name];
|
|
6835
|
-
var computed = value;
|
|
6836
|
-
if (value === '' || util.isNil(value)) {
|
|
6837
|
-
value = 'unset';
|
|
6517
|
+
// @ts-ignore
|
|
6518
|
+
if (attributes.points) {
|
|
6519
|
+
// @ts-ignore
|
|
6520
|
+
object.parsedStyle.points = parsePoints(attributes.points);
|
|
6838
6521
|
}
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6522
|
+
// Path
|
|
6523
|
+
// @ts-ignore
|
|
6524
|
+
if (attributes.d === '') {
|
|
6525
|
+
object.parsedStyle.d = tslib.__assign({}, EMPTY_PARSED_PATH);
|
|
6842
6526
|
}
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
if (keywords && keywords.indexOf(value) > -1) {
|
|
6849
|
-
// computed = new CSSKeywordValue(value);
|
|
6850
|
-
computed = getOrCreateKeyword(value);
|
|
6851
|
-
}
|
|
6852
|
-
else if (handler) {
|
|
6853
|
-
if (!memoized && handler.parserUnmemoize) {
|
|
6854
|
-
computed = handler.parserUnmemoize(value, object);
|
|
6855
|
-
}
|
|
6856
|
-
else if (handler.parser) {
|
|
6857
|
-
// try to parse it to CSSStyleValue, eg. '10px' -> CSS.px(10)
|
|
6858
|
-
computed = handler.parser(value, object);
|
|
6859
|
-
}
|
|
6860
|
-
}
|
|
6861
|
-
}
|
|
6527
|
+
// @ts-ignore
|
|
6528
|
+
if (attributes.d) {
|
|
6529
|
+
object.parsedStyle.d = parsePath(
|
|
6530
|
+
// @ts-ignore
|
|
6531
|
+
attributes.d);
|
|
6862
6532
|
}
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
* computed value -> used value
|
|
6867
|
-
*/
|
|
6868
|
-
DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object, memoized) {
|
|
6869
|
-
var metadata = propertyMetadataCache[name];
|
|
6870
|
-
var isDocumentElement = object.id === 'g-root';
|
|
6871
|
-
// let used: CSSStyleValue = computed instanceof CSSStyleValue ? computed.clone() : computed;
|
|
6872
|
-
var used = computed;
|
|
6873
|
-
if (metadata) {
|
|
6874
|
-
var syntax = metadata.syntax, inherited = metadata.inh, defaultValue = metadata.d;
|
|
6875
|
-
if (computed instanceof CSSKeywordValue) {
|
|
6876
|
-
var value = computed.value;
|
|
6877
|
-
/**
|
|
6878
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/unset
|
|
6879
|
-
*/
|
|
6880
|
-
if (value === 'unset') {
|
|
6881
|
-
if (inherited && !isDocumentElement) {
|
|
6882
|
-
value = 'inherit';
|
|
6883
|
-
}
|
|
6884
|
-
else {
|
|
6885
|
-
value = 'initial';
|
|
6886
|
-
}
|
|
6887
|
-
}
|
|
6888
|
-
if (value === 'initial') {
|
|
6889
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/initial
|
|
6890
|
-
if (!util.isNil(defaultValue)) {
|
|
6891
|
-
computed = this.parseProperty(name, util.isFunction(defaultValue)
|
|
6892
|
-
? defaultValue(object.nodeName)
|
|
6893
|
-
: defaultValue, object, memoized);
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
else if (value === 'inherit') {
|
|
6897
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/inherit
|
|
6898
|
-
// behave like `inherit`
|
|
6899
|
-
var resolved = this.tryToResolveProperty(object, name, {
|
|
6900
|
-
inherited: true,
|
|
6901
|
-
});
|
|
6902
|
-
if (!util.isNil(resolved)) {
|
|
6903
|
-
// object.parsedStyle[name] = resolved;
|
|
6904
|
-
// return false;
|
|
6905
|
-
return resolved;
|
|
6906
|
-
}
|
|
6907
|
-
else {
|
|
6908
|
-
this.addUnresolveProperty(object, name);
|
|
6909
|
-
return;
|
|
6910
|
-
}
|
|
6911
|
-
}
|
|
6912
|
-
}
|
|
6913
|
-
var handler = syntax && this.getPropertySyntax(syntax);
|
|
6914
|
-
if (handler && handler.calculator) {
|
|
6915
|
-
// convert computed value to used value
|
|
6916
|
-
var oldParsedValue = object.parsedStyle[name];
|
|
6917
|
-
used = handler.calculator(name, oldParsedValue, computed, object, this.runtime);
|
|
6918
|
-
}
|
|
6919
|
-
else if (computed instanceof CSSKeywordValue) {
|
|
6920
|
-
used = computed.value;
|
|
6921
|
-
}
|
|
6922
|
-
else {
|
|
6923
|
-
used = computed;
|
|
6924
|
-
}
|
|
6533
|
+
// Text
|
|
6534
|
+
if (attributes.textTransform) {
|
|
6535
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TEXT_TRANSFORM].calculator(null, null, { value: attributes.textTransform }, object, null);
|
|
6925
6536
|
}
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object, attributes) {
|
|
6929
|
-
var metadata = propertyMetadataCache[name];
|
|
6930
|
-
if (metadata && metadata.syntax) {
|
|
6931
|
-
var handler = metadata.syntax && this.getPropertySyntax(metadata.syntax);
|
|
6932
|
-
var propertyHandler = handler;
|
|
6933
|
-
if (propertyHandler && propertyHandler.postProcessor) {
|
|
6934
|
-
propertyHandler.postProcessor(object, attributes);
|
|
6935
|
-
}
|
|
6537
|
+
if (!util.isUndefined(attributes.clipPath)) {
|
|
6538
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.DEFINED_PATH].calculator('clipPath', oldClipPath, attributes.clipPath, object, this.runtime);
|
|
6936
6539
|
}
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
* resolve later
|
|
6940
|
-
*/
|
|
6941
|
-
DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
|
|
6942
|
-
var properties = unresolvedProperties.get(object);
|
|
6943
|
-
if (!properties) {
|
|
6944
|
-
unresolvedProperties.set(object, []);
|
|
6945
|
-
properties = unresolvedProperties.get(object);
|
|
6540
|
+
if (attributes.offsetPath) {
|
|
6541
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.DEFINED_PATH].calculator('offsetPath', oldOffsetPath, attributes.offsetPath, object, this.runtime);
|
|
6946
6542
|
}
|
|
6947
|
-
if (
|
|
6948
|
-
|
|
6543
|
+
if (attributes.transform) {
|
|
6544
|
+
object.parsedStyle.transform = parseTransform(attributes.transform);
|
|
6949
6545
|
}
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
if (options === void 0) { options = {}; }
|
|
6953
|
-
var inherited = options.inherited;
|
|
6954
|
-
if (inherited) {
|
|
6955
|
-
if (object.parentElement &&
|
|
6956
|
-
isPropertyResolved(object.parentElement, name)) {
|
|
6957
|
-
// const computedValue = object.parentElement.computedStyle[name];
|
|
6958
|
-
var usedValue = object.parentElement.parsedStyle[name];
|
|
6959
|
-
if (
|
|
6960
|
-
// usedValue instanceof CSSKeywordValue &&
|
|
6961
|
-
usedValue === 'unset' ||
|
|
6962
|
-
usedValue === 'initial' ||
|
|
6963
|
-
usedValue === 'inherit') {
|
|
6964
|
-
return;
|
|
6965
|
-
}
|
|
6966
|
-
return usedValue;
|
|
6967
|
-
}
|
|
6546
|
+
if (attributes.transformOrigin) {
|
|
6547
|
+
object.parsedStyle.transformOrigin = parseTransformOrigin(attributes.transformOrigin);
|
|
6968
6548
|
}
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6549
|
+
// Marker
|
|
6550
|
+
// @ts-ignore
|
|
6551
|
+
if (attributes.markerStart) {
|
|
6552
|
+
object.parsedStyle.markerStart = this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator(null,
|
|
6553
|
+
// @ts-ignore
|
|
6554
|
+
attributes.markerStart,
|
|
6555
|
+
// @ts-ignore
|
|
6556
|
+
attributes.markerStart, null, null);
|
|
6557
|
+
}
|
|
6558
|
+
// @ts-ignore
|
|
6559
|
+
if (attributes.markerEnd) {
|
|
6560
|
+
object.parsedStyle.markerEnd = this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator(null,
|
|
6561
|
+
// @ts-ignore
|
|
6562
|
+
attributes.markerEnd,
|
|
6563
|
+
// @ts-ignore
|
|
6564
|
+
attributes.markerEnd, null, null);
|
|
6565
|
+
}
|
|
6566
|
+
// @ts-ignore
|
|
6567
|
+
if (attributes.markerMid) {
|
|
6568
|
+
object.parsedStyle.markerMid = this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.MARKER].calculator('',
|
|
6569
|
+
// @ts-ignore
|
|
6570
|
+
attributes.markerMid,
|
|
6571
|
+
// @ts-ignore
|
|
6572
|
+
attributes.markerMid, null, null);
|
|
6573
|
+
}
|
|
6574
|
+
if (!util.isNil(attributes.zIndex)) {
|
|
6575
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.Z_INDEX].postProcessor(object);
|
|
6576
|
+
}
|
|
6577
|
+
if (!util.isNil(attributes.offsetDistance)) {
|
|
6578
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.OFFSET_DISTANCE].postProcessor(object);
|
|
6579
|
+
}
|
|
6580
|
+
if (attributes.transform) {
|
|
6581
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TRANSFORM].postProcessor(object);
|
|
6582
|
+
}
|
|
6583
|
+
if (attributes.transformOrigin) {
|
|
6584
|
+
this.runtime.CSSPropertySyntaxFactory[exports.PropertySyntax.TRANSFORM_ORIGIN].postProcessor(object);
|
|
6585
|
+
}
|
|
6586
|
+
if (needUpdateGeometry) {
|
|
6587
|
+
object.geometry.dirty = true;
|
|
6588
|
+
object.renderable.boundsDirty = true;
|
|
6589
|
+
object.renderable.renderBoundsDirty = true;
|
|
6590
|
+
if (!options.forceUpdateGeometry) {
|
|
6591
|
+
this.runtime.sceneGraphService.dirtifyToRoot(object);
|
|
6592
|
+
}
|
|
6980
6593
|
}
|
|
6981
6594
|
};
|
|
6982
6595
|
/**
|
|
@@ -7114,21 +6727,11 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
|
|
|
7114
6727
|
}
|
|
7115
6728
|
}
|
|
7116
6729
|
};
|
|
7117
|
-
DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
|
|
7118
|
-
var metadata = propertyMetadataCache[name];
|
|
7119
|
-
if (!metadata) {
|
|
7120
|
-
return false;
|
|
7121
|
-
}
|
|
7122
|
-
return metadata.inh;
|
|
7123
|
-
};
|
|
7124
6730
|
return DefaultStyleValueRegistry;
|
|
7125
6731
|
}());
|
|
7126
6732
|
|
|
7127
6733
|
var CSSPropertyAngle = /** @class */ (function () {
|
|
7128
6734
|
function CSSPropertyAngle() {
|
|
7129
|
-
this.parser = parseAngle;
|
|
7130
|
-
this.parserUnmemoize = parseAngleUnmemoize;
|
|
7131
|
-
this.parserWithCSSDisabled = null;
|
|
7132
6735
|
this.mixer = mergeNumbers;
|
|
7133
6736
|
}
|
|
7134
6737
|
CSSPropertyAngle.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -7165,7 +6768,6 @@ var CSSPropertyClipPath = /** @class */ (function () {
|
|
|
7165
6768
|
var CSSPropertyColor = /** @class */ (function () {
|
|
7166
6769
|
function CSSPropertyColor() {
|
|
7167
6770
|
this.parser = parseColor;
|
|
7168
|
-
this.parserWithCSSDisabled = parseColor;
|
|
7169
6771
|
this.mixer = mergeColors;
|
|
7170
6772
|
}
|
|
7171
6773
|
CSSPropertyColor.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -7180,7 +6782,6 @@ var CSSPropertyColor = /** @class */ (function () {
|
|
|
7180
6782
|
|
|
7181
6783
|
var CSSPropertyFilter = /** @class */ (function () {
|
|
7182
6784
|
function CSSPropertyFilter() {
|
|
7183
|
-
this.parser = parseFilter;
|
|
7184
6785
|
}
|
|
7185
6786
|
CSSPropertyFilter.prototype.calculator = function (name, oldParsed, parsed) {
|
|
7186
6787
|
// unset or none
|
|
@@ -7201,9 +6802,6 @@ function getFontSize(object) {
|
|
|
7201
6802
|
*/
|
|
7202
6803
|
var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
7203
6804
|
function CSSPropertyLengthOrPercentage() {
|
|
7204
|
-
this.parser = parseLengthOrPercentage;
|
|
7205
|
-
this.parserUnmemoize = parseLengthOrPercentageUnmemoize;
|
|
7206
|
-
this.parserWithCSSDisabled = null;
|
|
7207
6805
|
this.mixer = mergeNumbers;
|
|
7208
6806
|
}
|
|
7209
6807
|
/**
|
|
@@ -7218,7 +6816,6 @@ var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
|
7218
6816
|
return computed;
|
|
7219
6817
|
}
|
|
7220
6818
|
if (CSSUnitValue.isRelativeUnit(computed.unit)) {
|
|
7221
|
-
var registry = runtime.styleValueRegistry;
|
|
7222
6819
|
if (computed.unit === exports.UnitType.kPercentage) {
|
|
7223
6820
|
// TODO: merge dimensions
|
|
7224
6821
|
return 0;
|
|
@@ -7230,12 +6827,6 @@ var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
|
7230
6827
|
fontSize *= computed.value;
|
|
7231
6828
|
return fontSize;
|
|
7232
6829
|
}
|
|
7233
|
-
else {
|
|
7234
|
-
registry.addUnresolveProperty(object, name);
|
|
7235
|
-
}
|
|
7236
|
-
}
|
|
7237
|
-
else {
|
|
7238
|
-
registry.addUnresolveProperty(object, name);
|
|
7239
6830
|
}
|
|
7240
6831
|
return 0;
|
|
7241
6832
|
}
|
|
@@ -7246,12 +6837,6 @@ var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
|
7246
6837
|
fontSize *= computed.value;
|
|
7247
6838
|
return fontSize;
|
|
7248
6839
|
}
|
|
7249
|
-
else {
|
|
7250
|
-
registry.addUnresolveProperty(object, name);
|
|
7251
|
-
}
|
|
7252
|
-
}
|
|
7253
|
-
else {
|
|
7254
|
-
registry.addUnresolveProperty(object, name);
|
|
7255
6840
|
}
|
|
7256
6841
|
return 0;
|
|
7257
6842
|
}
|
|
@@ -7274,21 +6859,10 @@ var CSSPropertyLengthOrPercentage = /** @class */ (function () {
|
|
|
7274
6859
|
* rect.style.lineDash = [10, 10];
|
|
7275
6860
|
* rect.style.lineDash = '10 10';
|
|
7276
6861
|
*/
|
|
7277
|
-
var CSSPropertyLengthOrPercentage12 = /** @class */ (function () {
|
|
7278
|
-
function CSSPropertyLengthOrPercentage12() {
|
|
7279
|
-
this.mixer = mergeNumberLists;
|
|
7280
|
-
}
|
|
7281
|
-
CSSPropertyLengthOrPercentage12.prototype.parser = function (radius) {
|
|
7282
|
-
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
7283
|
-
var formatted;
|
|
7284
|
-
if (parsed.length === 1) {
|
|
7285
|
-
formatted = [parsed[0], parsed[0]];
|
|
7286
|
-
}
|
|
7287
|
-
else {
|
|
7288
|
-
formatted = [parsed[0], parsed[1]];
|
|
7289
|
-
}
|
|
7290
|
-
return formatted;
|
|
7291
|
-
};
|
|
6862
|
+
var CSSPropertyLengthOrPercentage12 = /** @class */ (function () {
|
|
6863
|
+
function CSSPropertyLengthOrPercentage12() {
|
|
6864
|
+
this.mixer = mergeNumberLists;
|
|
6865
|
+
}
|
|
7292
6866
|
CSSPropertyLengthOrPercentage12.prototype.calculator = function (name, oldParsed, computed) {
|
|
7293
6867
|
return computed.map(function (c) { return c.value; });
|
|
7294
6868
|
};
|
|
@@ -7307,24 +6881,6 @@ var CSSPropertyLengthOrPercentage14 = /** @class */ (function () {
|
|
|
7307
6881
|
function CSSPropertyLengthOrPercentage14() {
|
|
7308
6882
|
this.mixer = mergeNumberLists;
|
|
7309
6883
|
}
|
|
7310
|
-
CSSPropertyLengthOrPercentage14.prototype.parser = function (radius) {
|
|
7311
|
-
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
7312
|
-
var formatted;
|
|
7313
|
-
// format to Tuple<CSSUnitValue>
|
|
7314
|
-
if (parsed.length === 1) {
|
|
7315
|
-
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
7316
|
-
}
|
|
7317
|
-
else if (parsed.length === 2) {
|
|
7318
|
-
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
7319
|
-
}
|
|
7320
|
-
else if (parsed.length === 3) {
|
|
7321
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
7322
|
-
}
|
|
7323
|
-
else {
|
|
7324
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
7325
|
-
}
|
|
7326
|
-
return formatted;
|
|
7327
|
-
};
|
|
7328
6884
|
CSSPropertyLengthOrPercentage14.prototype.calculator = function (name, oldParsed, computed) {
|
|
7329
6885
|
return computed.map(function (c) { return c.value; });
|
|
7330
6886
|
};
|
|
@@ -7352,9 +6908,6 @@ var CSSPropertyMarker = /** @class */ (function () {
|
|
|
7352
6908
|
var CSSPropertyNumber = /** @class */ (function () {
|
|
7353
6909
|
function CSSPropertyNumber() {
|
|
7354
6910
|
this.mixer = mergeNumbers;
|
|
7355
|
-
this.parser = parseNumber;
|
|
7356
|
-
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7357
|
-
this.parserWithCSSDisabled = null;
|
|
7358
6911
|
}
|
|
7359
6912
|
CSSPropertyNumber.prototype.calculator = function (name, oldParsed, computed) {
|
|
7360
6913
|
return computed.value;
|
|
@@ -7364,9 +6917,6 @@ var CSSPropertyNumber = /** @class */ (function () {
|
|
|
7364
6917
|
|
|
7365
6918
|
var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
7366
6919
|
function CSSPropertyOffsetDistance() {
|
|
7367
|
-
this.parser = parseNumber;
|
|
7368
|
-
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7369
|
-
this.parserWithCSSDisabled = null;
|
|
7370
6920
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7371
6921
|
}
|
|
7372
6922
|
CSSPropertyOffsetDistance.prototype.calculator = function (name, oldParsed, computed) {
|
|
@@ -7396,9 +6946,6 @@ var CSSPropertyOffsetDistance = /** @class */ (function () {
|
|
|
7396
6946
|
*/
|
|
7397
6947
|
var CSSPropertyOpacity = /** @class */ (function () {
|
|
7398
6948
|
function CSSPropertyOpacity() {
|
|
7399
|
-
this.parser = parseNumber;
|
|
7400
|
-
this.parserUnmemoize = parseNumberUnmemoize;
|
|
7401
|
-
this.parserWithCSSDisabled = null;
|
|
7402
6949
|
this.mixer = clampedMergeNumbers(0, 1);
|
|
7403
6950
|
}
|
|
7404
6951
|
CSSPropertyOpacity.prototype.calculator = function (name, oldParsed, computed) {
|
|
@@ -7413,7 +6960,6 @@ var CSSPropertyPath = /** @class */ (function () {
|
|
|
7413
6960
|
* path2Curve
|
|
7414
6961
|
*/
|
|
7415
6962
|
this.parser = parsePath;
|
|
7416
|
-
this.parserWithCSSDisabled = parsePath;
|
|
7417
6963
|
this.mixer = mergePaths;
|
|
7418
6964
|
}
|
|
7419
6965
|
CSSPropertyPath.prototype.calculator = function (name, oldParsed, parsed) {
|
|
@@ -7437,7 +6983,6 @@ var CSSPropertyPath = /** @class */ (function () {
|
|
|
7437
6983
|
|
|
7438
6984
|
var CSSPropertyPoints = /** @class */ (function () {
|
|
7439
6985
|
function CSSPropertyPoints() {
|
|
7440
|
-
this.parser = parsePoints;
|
|
7441
6986
|
this.mixer = mergePoints;
|
|
7442
6987
|
}
|
|
7443
6988
|
return CSSPropertyPoints;
|
|
@@ -7501,17 +7046,24 @@ var CSSPropertyTextTransform = /** @class */ (function () {
|
|
|
7501
7046
|
return CSSPropertyTextTransform;
|
|
7502
7047
|
}());
|
|
7503
7048
|
|
|
7049
|
+
var definedProps = function (obj) {
|
|
7050
|
+
return Object.fromEntries(Object.entries(obj).filter(function (_a) {
|
|
7051
|
+
var _b = tslib.__read(_a, 2), v = _b[1];
|
|
7052
|
+
return v !== undefined;
|
|
7053
|
+
}));
|
|
7054
|
+
};
|
|
7055
|
+
|
|
7504
7056
|
var CANVAS_Map = new WeakMap();
|
|
7505
7057
|
/**
|
|
7506
7058
|
* destroy existed canvas with the same id
|
|
7507
7059
|
*/
|
|
7508
|
-
function cleanExistedCanvas(container, canvas,
|
|
7060
|
+
function cleanExistedCanvas(container, canvas, cleanUp) {
|
|
7509
7061
|
if (container) {
|
|
7510
7062
|
var $dom = typeof container === 'string'
|
|
7511
7063
|
? document.getElementById(container)
|
|
7512
7064
|
: container;
|
|
7513
7065
|
if (CANVAS_Map.has($dom))
|
|
7514
|
-
CANVAS_Map.get($dom).destroy(
|
|
7066
|
+
CANVAS_Map.get($dom).destroy(cleanUp);
|
|
7515
7067
|
else
|
|
7516
7068
|
CANVAS_Map.set($dom, canvas);
|
|
7517
7069
|
}
|
|
@@ -7598,6 +7150,12 @@ var TOUCH_TO_POINTER = {
|
|
|
7598
7150
|
};
|
|
7599
7151
|
var clock = typeof performance === 'object' && performance.now ? performance : Date;
|
|
7600
7152
|
|
|
7153
|
+
function isInFragment(node) {
|
|
7154
|
+
if (node.nodeName === exports.Shape.FRAGMENT)
|
|
7155
|
+
return true;
|
|
7156
|
+
return node.getRootNode().nodeName === exports.Shape.FRAGMENT;
|
|
7157
|
+
}
|
|
7158
|
+
|
|
7601
7159
|
function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
|
|
7602
7160
|
// account for pointerEvents
|
|
7603
7161
|
// @see https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
|
|
@@ -7989,9 +7547,7 @@ function parsedTransformToMat4(transform, object) {
|
|
|
7989
7547
|
*/
|
|
7990
7548
|
var CSSPropertyTransform = /** @class */ (function () {
|
|
7991
7549
|
function CSSPropertyTransform() {
|
|
7992
|
-
this.parser =
|
|
7993
|
-
this.parserUnmemoize = parseTransformUnmemoize;
|
|
7994
|
-
this.parserWithCSSDisabled = parseTransformUnmemoize;
|
|
7550
|
+
this.parser = parseTransformUnmemoize;
|
|
7995
7551
|
this.mixer = mergeTransforms;
|
|
7996
7552
|
}
|
|
7997
7553
|
CSSPropertyTransform.prototype.calculator = function (name, oldParsed, parsed, object) {
|
|
@@ -8014,8 +7570,6 @@ var CSSPropertyTransform = /** @class */ (function () {
|
|
|
8014
7570
|
*/
|
|
8015
7571
|
var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
8016
7572
|
function CSSPropertyTransformOrigin() {
|
|
8017
|
-
this.parser = parseTransformOrigin;
|
|
8018
|
-
this.parserUnmemoize = parseTransformOriginUnmemoize;
|
|
8019
7573
|
}
|
|
8020
7574
|
CSSPropertyTransformOrigin.prototype.postProcessor = function (object) {
|
|
8021
7575
|
var transformOrigin = object.parsedStyle.transformOrigin;
|
|
@@ -8033,8 +7587,6 @@ var CSSPropertyTransformOrigin = /** @class */ (function () {
|
|
|
8033
7587
|
|
|
8034
7588
|
var CSSPropertyZIndex = /** @class */ (function () {
|
|
8035
7589
|
function CSSPropertyZIndex() {
|
|
8036
|
-
this.parser = parseNumber;
|
|
8037
|
-
this.parserUnmemoize = parseNumberUnmemoize;
|
|
8038
7590
|
}
|
|
8039
7591
|
CSSPropertyZIndex.prototype.calculator = function (name, oldParsed, computed, object) {
|
|
8040
7592
|
return computed.value;
|
|
@@ -8193,17 +7745,8 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8193
7745
|
this.globalRuntime = globalRuntime;
|
|
8194
7746
|
}
|
|
8195
7747
|
TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
|
|
8196
|
-
var text = parsedStyle.text
|
|
8197
|
-
return
|
|
8198
|
-
? text &&
|
|
8199
|
-
fontSize &&
|
|
8200
|
-
fontStyle &&
|
|
8201
|
-
fontWeight &&
|
|
8202
|
-
fontVariant &&
|
|
8203
|
-
textAlign &&
|
|
8204
|
-
textBaseline &&
|
|
8205
|
-
!util.isNil(lineWidth)
|
|
8206
|
-
: text;
|
|
7748
|
+
var text = parsedStyle.text;
|
|
7749
|
+
return text;
|
|
8207
7750
|
};
|
|
8208
7751
|
TextUpdater.prototype.update = function (parsedStyle, object) {
|
|
8209
7752
|
var _a, _b;
|
|
@@ -8234,7 +7777,7 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8234
7777
|
var offscreenCanvas = (((_b = (_a = object === null || object === void 0 ? void 0 : object.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.getConfig()) || {}).offscreenCanvas;
|
|
8235
7778
|
var metrics = this.globalRuntime.textService.measureText(text, parsedStyle, offscreenCanvas);
|
|
8236
7779
|
parsedStyle.metrics = metrics;
|
|
8237
|
-
var width = metrics.width, height = metrics.height
|
|
7780
|
+
var width = metrics.width, height = metrics.height;
|
|
8238
7781
|
var hwidth = width / 2;
|
|
8239
7782
|
var hheight = height / 2;
|
|
8240
7783
|
// default 'left'
|
|
@@ -8247,18 +7790,12 @@ var TextUpdater = /** @class */ (function () {
|
|
|
8247
7790
|
}
|
|
8248
7791
|
var lineYOffset = y - hheight;
|
|
8249
7792
|
if (textBaseline === 'middle') {
|
|
8250
|
-
// eslint-disable-next-line prefer-destructuring
|
|
8251
7793
|
lineYOffset += hheight;
|
|
8252
7794
|
}
|
|
8253
7795
|
else if (textBaseline === 'top' || textBaseline === 'hanging') {
|
|
8254
7796
|
lineYOffset += hheight * 2;
|
|
8255
7797
|
}
|
|
8256
|
-
else if (textBaseline === 'alphabetic')
|
|
8257
|
-
// prevent calling getImageData for ascent metrics
|
|
8258
|
-
lineYOffset += this.globalRuntime.enableCSSParsing
|
|
8259
|
-
? lineHeight - fontProperties.ascent
|
|
8260
|
-
: 0;
|
|
8261
|
-
}
|
|
7798
|
+
else if (textBaseline === 'alphabetic') ;
|
|
8262
7799
|
else if (textBaseline === 'bottom' || textBaseline === 'ideographic') {
|
|
8263
7800
|
lineYOffset += 0;
|
|
8264
7801
|
}
|
|
@@ -8308,6 +7845,9 @@ var HTMLUpdater = /** @class */ (function () {
|
|
|
8308
7845
|
return HTMLUpdater;
|
|
8309
7846
|
}());
|
|
8310
7847
|
|
|
7848
|
+
function isFederatedEvent(value) {
|
|
7849
|
+
return !!value.type;
|
|
7850
|
+
}
|
|
8311
7851
|
/**
|
|
8312
7852
|
* An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
|
|
8313
7853
|
* FederatedEvent or native Event.
|
|
@@ -8719,6 +8259,10 @@ var CANVAS_CACHE = new WeakMap();
|
|
|
8719
8259
|
*/
|
|
8720
8260
|
var EventTarget = /** @class */ (function () {
|
|
8721
8261
|
function EventTarget() {
|
|
8262
|
+
/**
|
|
8263
|
+
* event emitter
|
|
8264
|
+
*/
|
|
8265
|
+
this.emitter = new EventEmitter();
|
|
8722
8266
|
}
|
|
8723
8267
|
/**
|
|
8724
8268
|
* @deprecated
|
|
@@ -8734,9 +8278,8 @@ var EventTarget = /** @class */ (function () {
|
|
|
8734
8278
|
*/
|
|
8735
8279
|
EventTarget.prototype.addEventListener = function (type, listener, options) {
|
|
8736
8280
|
var _a, _b;
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
var capture = false, once = false;
|
|
8281
|
+
var capture = false;
|
|
8282
|
+
var once = false;
|
|
8740
8283
|
if (util.isBoolean(options))
|
|
8741
8284
|
capture = options;
|
|
8742
8285
|
else if (options)
|
|
@@ -8832,7 +8375,7 @@ var EventTarget = /** @class */ (function () {
|
|
|
8832
8375
|
var Node = /** @class */ (function (_super) {
|
|
8833
8376
|
tslib.__extends(Node, _super);
|
|
8834
8377
|
function Node() {
|
|
8835
|
-
var _this = _super.
|
|
8378
|
+
var _this = _super.call(this) || this;
|
|
8836
8379
|
_this.shadow = false;
|
|
8837
8380
|
/**
|
|
8838
8381
|
* points to canvas.document
|
|
@@ -9117,12 +8660,19 @@ var Node = /** @class */ (function (_super) {
|
|
|
9117
8660
|
}
|
|
9118
8661
|
return temp;
|
|
9119
8662
|
};
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
8663
|
+
/**
|
|
8664
|
+
* iterate current node and its descendants
|
|
8665
|
+
* @param callback - callback to execute for each node, return false to break
|
|
8666
|
+
* @param assigned - whether to iterate assigned nodes
|
|
8667
|
+
*/
|
|
8668
|
+
Node.prototype.forEach = function (callback) {
|
|
8669
|
+
var result = callback(this);
|
|
8670
|
+
if (result !== false) {
|
|
8671
|
+
var nodes = this.childNodes;
|
|
8672
|
+
var length_1 = nodes.length;
|
|
8673
|
+
for (var i = 0; i < length_1; i++) {
|
|
8674
|
+
nodes[i].forEach(callback);
|
|
8675
|
+
}
|
|
9126
8676
|
}
|
|
9127
8677
|
};
|
|
9128
8678
|
/**
|
|
@@ -9861,8 +9411,6 @@ var EventService = /** @class */ (function () {
|
|
|
9861
9411
|
// hack EventEmitter, stops if the `propagationImmediatelyStopped` flag is set
|
|
9862
9412
|
// @ts-ignore
|
|
9863
9413
|
var emitter = e.currentTarget.emitter;
|
|
9864
|
-
if (!emitter)
|
|
9865
|
-
return;
|
|
9866
9414
|
// @ts-ignore
|
|
9867
9415
|
var listeners = emitter._events[type];
|
|
9868
9416
|
if (!listeners)
|
|
@@ -10000,12 +9548,6 @@ var RenderingService = /** @class */ (function () {
|
|
|
10000
9548
|
*/
|
|
10001
9549
|
rendered: 0,
|
|
10002
9550
|
};
|
|
10003
|
-
/**
|
|
10004
|
-
* frame counter
|
|
10005
|
-
* - 1 - init root container
|
|
10006
|
-
* - 2 - user first frame
|
|
10007
|
-
*/
|
|
10008
|
-
this.frame = 0;
|
|
10009
9551
|
this.zIndexCounter = 0;
|
|
10010
9552
|
this.hooks = {
|
|
10011
9553
|
/**
|
|
@@ -10094,19 +9636,13 @@ var RenderingService = /** @class */ (function () {
|
|
|
10094
9636
|
this.context.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED));
|
|
10095
9637
|
};
|
|
10096
9638
|
RenderingService.prototype.render = function (canvasConfig, frame, rerenderCallback) {
|
|
9639
|
+
var _this = this;
|
|
10097
9640
|
this.stats.total = 0;
|
|
10098
9641
|
this.stats.rendered = 0;
|
|
10099
9642
|
this.zIndexCounter = 0;
|
|
10100
|
-
this.frame++;
|
|
10101
9643
|
var renderingContext = this.context.renderingContext;
|
|
10102
|
-
if (this.frame === 2) {
|
|
10103
|
-
// @ts-expect-error private method
|
|
10104
|
-
this.globalRuntime.sceneGraphService.dirtifyEntireSceneGraph(renderingContext.root);
|
|
10105
|
-
}
|
|
10106
9644
|
this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
|
|
10107
|
-
|
|
10108
|
-
this.globalRuntime.sceneGraphService.triggerPendingEvents(this.frame === 3 ? renderingContext.root : undefined);
|
|
10109
|
-
}
|
|
9645
|
+
this.globalRuntime.sceneGraphService.triggerPendingEvents();
|
|
10110
9646
|
if (renderingContext.renderReasons.size && this.inited) {
|
|
10111
9647
|
// @ts-ignore
|
|
10112
9648
|
renderingContext.dirtyRectangleRenderingDisabled =
|
|
@@ -10120,23 +9656,22 @@ var RenderingService = /** @class */ (function () {
|
|
|
10120
9656
|
}
|
|
10121
9657
|
this.hooks.beginFrame.call(frame);
|
|
10122
9658
|
if (shouldTriggerRenderHooks) {
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
9659
|
+
renderingContext.renderListCurrentFrame.forEach(function (object) {
|
|
9660
|
+
_this.hooks.beforeRender.call(object);
|
|
9661
|
+
_this.hooks.render.call(object);
|
|
9662
|
+
_this.hooks.afterRender.call(object);
|
|
9663
|
+
});
|
|
10127
9664
|
}
|
|
10128
9665
|
this.hooks.endFrame.call(frame);
|
|
10129
|
-
renderingContext.renderListCurrentFrame
|
|
9666
|
+
renderingContext.renderListCurrentFrame = [];
|
|
10130
9667
|
renderingContext.renderReasons.clear();
|
|
10131
9668
|
rerenderCallback();
|
|
10132
9669
|
}
|
|
9670
|
+
// console.log('stats', this.stats);
|
|
10133
9671
|
};
|
|
10134
9672
|
RenderingService.prototype.renderDisplayObject = function (displayObject, canvasConfig, renderingContext) {
|
|
9673
|
+
var _this = this;
|
|
10135
9674
|
var _a = canvasConfig.renderer.getConfig(), enableDirtyCheck = _a.enableDirtyCheck, enableCulling = _a.enableCulling;
|
|
10136
|
-
// recalc style values
|
|
10137
|
-
if (this.globalRuntime.enableCSSParsing) {
|
|
10138
|
-
this.globalRuntime.styleValueRegistry.recalc(displayObject);
|
|
10139
|
-
}
|
|
10140
9675
|
// TODO: relayout
|
|
10141
9676
|
// dirtycheck first
|
|
10142
9677
|
var renderable = displayObject.renderable;
|
|
@@ -10167,11 +9702,9 @@ var RenderingService = /** @class */ (function () {
|
|
|
10167
9702
|
sortable.dirtyReason = undefined;
|
|
10168
9703
|
}
|
|
10169
9704
|
// recursive rendering its children
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
this.renderDisplayObject(nodes[i], canvasConfig, renderingContext);
|
|
10174
|
-
}
|
|
9705
|
+
(sortable.sorted || displayObject.childNodes).forEach(function (child) {
|
|
9706
|
+
_this.renderDisplayObject(child, canvasConfig, renderingContext);
|
|
9707
|
+
});
|
|
10175
9708
|
};
|
|
10176
9709
|
RenderingService.prototype.sort = function (displayObject, sortable) {
|
|
10177
9710
|
if (sortable.sorted &&
|
|
@@ -10345,26 +9878,6 @@ var DefaultSceneGraphSelector = /** @class */ (function () {
|
|
|
10345
9878
|
return DefaultSceneGraphSelector;
|
|
10346
9879
|
}());
|
|
10347
9880
|
|
|
10348
|
-
var MutationEvent = /** @class */ (function (_super) {
|
|
10349
|
-
tslib.__extends(MutationEvent, _super);
|
|
10350
|
-
function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
|
|
10351
|
-
var _this = _super.call(this, null) || this;
|
|
10352
|
-
_this.relatedNode = relatedNode;
|
|
10353
|
-
_this.prevValue = prevValue;
|
|
10354
|
-
_this.newValue = newValue;
|
|
10355
|
-
_this.attrName = attrName;
|
|
10356
|
-
_this.attrChange = attrChange;
|
|
10357
|
-
_this.prevParsedValue = prevParsedValue;
|
|
10358
|
-
_this.newParsedValue = newParsedValue;
|
|
10359
|
-
_this.type = typeArg;
|
|
10360
|
-
return _this;
|
|
10361
|
-
}
|
|
10362
|
-
MutationEvent.ADDITION = 2;
|
|
10363
|
-
MutationEvent.MODIFICATION = 1;
|
|
10364
|
-
MutationEvent.REMOVAL = 3;
|
|
10365
|
-
return MutationEvent;
|
|
10366
|
-
}(FederatedEvent));
|
|
10367
|
-
|
|
10368
9881
|
/**
|
|
10369
9882
|
* built-in events for element
|
|
10370
9883
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MutationEvent
|
|
@@ -10402,6 +9915,26 @@ exports.ElementEvent = void 0;
|
|
|
10402
9915
|
ElementEvent["CULLED"] = "culled";
|
|
10403
9916
|
})(exports.ElementEvent || (exports.ElementEvent = {}));
|
|
10404
9917
|
|
|
9918
|
+
var MutationEvent = /** @class */ (function (_super) {
|
|
9919
|
+
tslib.__extends(MutationEvent, _super);
|
|
9920
|
+
function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
|
|
9921
|
+
var _this = _super.call(this, null) || this;
|
|
9922
|
+
_this.relatedNode = relatedNode;
|
|
9923
|
+
_this.prevValue = prevValue;
|
|
9924
|
+
_this.newValue = newValue;
|
|
9925
|
+
_this.attrName = attrName;
|
|
9926
|
+
_this.attrChange = attrChange;
|
|
9927
|
+
_this.prevParsedValue = prevParsedValue;
|
|
9928
|
+
_this.newParsedValue = newParsedValue;
|
|
9929
|
+
_this.type = typeArg;
|
|
9930
|
+
return _this;
|
|
9931
|
+
}
|
|
9932
|
+
MutationEvent.ADDITION = 2;
|
|
9933
|
+
MutationEvent.MODIFICATION = 1;
|
|
9934
|
+
MutationEvent.REMOVAL = 3;
|
|
9935
|
+
return MutationEvent;
|
|
9936
|
+
}(FederatedEvent));
|
|
9937
|
+
|
|
10405
9938
|
function markRenderableDirty(e) {
|
|
10406
9939
|
var renderable = e.renderable;
|
|
10407
9940
|
if (renderable) {
|
|
@@ -10410,19 +9943,6 @@ function markRenderableDirty(e) {
|
|
|
10410
9943
|
}
|
|
10411
9944
|
}
|
|
10412
9945
|
var reparentEvent = new MutationEvent(exports.ElementEvent.REPARENT, null, '', '', '', 0, '', '');
|
|
10413
|
-
var EPSILON = 0.000001;
|
|
10414
|
-
/**
|
|
10415
|
-
* an optimized version of gl-matrix's equals
|
|
10416
|
-
*/
|
|
10417
|
-
function equals(a, b) {
|
|
10418
|
-
var a0 = a[0], a1 = a[1], a2 = a[2];
|
|
10419
|
-
var b0 = b[0], b1 = b[1], b2 = b[2];
|
|
10420
|
-
if (a0 === b0 && a1 === b1 && a2 === b2)
|
|
10421
|
-
return true;
|
|
10422
|
-
return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
|
|
10423
|
-
Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
|
|
10424
|
-
Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)));
|
|
10425
|
-
}
|
|
10426
9946
|
// Object pooling
|
|
10427
9947
|
/** do not modify this objects */
|
|
10428
9948
|
var $vec2Zero = glMatrix.vec2.create();
|
|
@@ -10458,9 +9978,9 @@ var $triggerPendingEvents_detail = { affectChildren: true };
|
|
|
10458
9978
|
var DefaultSceneGraphService = /** @class */ (function () {
|
|
10459
9979
|
function DefaultSceneGraphService(runtime) {
|
|
10460
9980
|
this.runtime = runtime;
|
|
9981
|
+
// target -> affectChildren
|
|
10461
9982
|
this.pendingEvents = new Map();
|
|
10462
9983
|
this.boundsChangedEvent = new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);
|
|
10463
|
-
this.eventEntitySet = new Set();
|
|
10464
9984
|
this.displayObjectDependencyMap = new WeakMap();
|
|
10465
9985
|
}
|
|
10466
9986
|
DefaultSceneGraphService.prototype.matches = function (query, root) {
|
|
@@ -10480,12 +10000,23 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10480
10000
|
detached = child.parentNode !== parent;
|
|
10481
10001
|
this.detach(child);
|
|
10482
10002
|
}
|
|
10003
|
+
var isChildFragment = child.nodeName === exports.Shape.FRAGMENT;
|
|
10004
|
+
var isAttachToFragment = isInFragment(parent);
|
|
10483
10005
|
child.parentNode = parent;
|
|
10006
|
+
var nodes = isChildFragment
|
|
10007
|
+
? child.childNodes
|
|
10008
|
+
: [child];
|
|
10484
10009
|
if (util.isNumber(index)) {
|
|
10485
|
-
|
|
10010
|
+
nodes.forEach(function (node) {
|
|
10011
|
+
parent.childNodes.splice(index, 0, node);
|
|
10012
|
+
node.parentNode = parent;
|
|
10013
|
+
});
|
|
10486
10014
|
}
|
|
10487
10015
|
else {
|
|
10488
|
-
|
|
10016
|
+
nodes.forEach(function (node) {
|
|
10017
|
+
parent.childNodes.push(node);
|
|
10018
|
+
node.parentNode = parent;
|
|
10019
|
+
});
|
|
10489
10020
|
}
|
|
10490
10021
|
// parent needs re-sort
|
|
10491
10022
|
var sortable = parent.sortable;
|
|
@@ -10494,17 +10025,20 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10494
10025
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
10495
10026
|
sortable.dirtyChildren.push(child);
|
|
10496
10027
|
}
|
|
10028
|
+
// if (sortable) {
|
|
10497
10029
|
// only child has z-Index
|
|
10498
10030
|
sortable.dirty = true;
|
|
10499
10031
|
sortable.dirtyReason = exports.SortReason.ADDED;
|
|
10500
10032
|
}
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
if (
|
|
10504
|
-
this.
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10033
|
+
if (isAttachToFragment)
|
|
10034
|
+
return;
|
|
10035
|
+
if (isChildFragment)
|
|
10036
|
+
this.dirtifyFragment(child);
|
|
10037
|
+
else {
|
|
10038
|
+
var transform = child.transformable;
|
|
10039
|
+
if (transform) {
|
|
10040
|
+
this.dirtifyWorld(child, transform);
|
|
10041
|
+
}
|
|
10508
10042
|
}
|
|
10509
10043
|
if (detached) {
|
|
10510
10044
|
child.dispatchEvent(reparentEvent);
|
|
@@ -10514,8 +10048,16 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10514
10048
|
var _a, _b;
|
|
10515
10049
|
if (child.parentNode) {
|
|
10516
10050
|
var transform = child.transformable;
|
|
10051
|
+
// if (transform) {
|
|
10052
|
+
// const worldTransform = this.getWorldTransform(child, transform);
|
|
10053
|
+
// mat4.getScaling(transform.localScale, worldTransform);
|
|
10054
|
+
// mat4.getTranslation(transform.localPosition, worldTransform);
|
|
10055
|
+
// mat4.getRotation(transform.localRotation, worldTransform);
|
|
10056
|
+
// transform.localDirtyFlag = true;
|
|
10057
|
+
// }
|
|
10517
10058
|
// parent needs re-sort
|
|
10518
10059
|
var sortable = child.parentNode.sortable;
|
|
10060
|
+
// if (sortable) {
|
|
10519
10061
|
if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
10520
10062
|
((_b = child.style) === null || _b === void 0 ? void 0 : _b.zIndex)) {
|
|
10521
10063
|
if (sortable.dirtyChildren.indexOf(child) === -1) {
|
|
@@ -10556,6 +10098,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10556
10098
|
return;
|
|
10557
10099
|
}
|
|
10558
10100
|
var originVec = transform.origin;
|
|
10101
|
+
// const delta = vec3.subtract(vec3.create(), origin, originVec);
|
|
10102
|
+
// vec3.add(transform.localPosition, transform.localPosition, delta);
|
|
10559
10103
|
// update origin
|
|
10560
10104
|
originVec[0] = origin[0];
|
|
10561
10105
|
originVec[1] = origin[1];
|
|
@@ -10658,7 +10202,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10658
10202
|
translation = glMatrix.vec3.fromValues(translation, y, z);
|
|
10659
10203
|
}
|
|
10660
10204
|
var transform = element.transformable;
|
|
10661
|
-
if (equals(translation, $vec3Zero))
|
|
10205
|
+
if (glMatrix.vec3.equals(translation, $vec3Zero))
|
|
10662
10206
|
return;
|
|
10663
10207
|
glMatrix.vec3.transformQuat(translation, translation, transform.localRotation);
|
|
10664
10208
|
glMatrix.vec3.add(transform.localPosition, transform.localPosition, translation);
|
|
@@ -10676,7 +10220,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10676
10220
|
$setPosition_1[0] = position[0];
|
|
10677
10221
|
$setPosition_1[1] = position[1];
|
|
10678
10222
|
$setPosition_1[2] = (_a = position[2]) !== null && _a !== void 0 ? _a : 0;
|
|
10679
|
-
if (equals(this.getPosition(element), $setPosition_1)) {
|
|
10223
|
+
if (glMatrix.vec3.equals(this.getPosition(element), $setPosition_1)) {
|
|
10680
10224
|
return;
|
|
10681
10225
|
}
|
|
10682
10226
|
glMatrix.vec3.copy(transform.position, $setPosition_1);
|
|
@@ -10702,7 +10246,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10702
10246
|
$setLocalPosition[0] = position[0];
|
|
10703
10247
|
$setLocalPosition[1] = position[1];
|
|
10704
10248
|
$setLocalPosition[2] = (_a = position[2]) !== null && _a !== void 0 ? _a : 0;
|
|
10705
|
-
if (equals(transform.localPosition, $setLocalPosition)) {
|
|
10249
|
+
if (glMatrix.vec3.equals(transform.localPosition, $setLocalPosition)) {
|
|
10706
10250
|
return;
|
|
10707
10251
|
}
|
|
10708
10252
|
glMatrix.vec3.copy(transform.localPosition, $setLocalPosition);
|
|
@@ -10724,7 +10268,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10724
10268
|
if (dirtify === void 0) { dirtify = true; }
|
|
10725
10269
|
var transform = element.transformable;
|
|
10726
10270
|
glMatrix.vec3.set($vec3$1, scaling[0], scaling[1], (_a = scaling[2]) !== null && _a !== void 0 ? _a : transform.localScale[2]);
|
|
10727
|
-
if (equals($vec3$1, transform.localScale)) {
|
|
10271
|
+
if (glMatrix.vec3.equals($vec3$1, transform.localScale)) {
|
|
10728
10272
|
return;
|
|
10729
10273
|
}
|
|
10730
10274
|
glMatrix.vec3.copy(transform.localScale, $vec3$1);
|
|
@@ -10750,7 +10294,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10750
10294
|
if (typeof translation === 'number') {
|
|
10751
10295
|
translation = glMatrix.vec3.set($vec3$1, translation, y, z);
|
|
10752
10296
|
}
|
|
10753
|
-
if (equals(translation, $vec3Zero))
|
|
10297
|
+
if (glMatrix.vec3.equals(translation, $vec3Zero))
|
|
10754
10298
|
return;
|
|
10755
10299
|
glMatrix.vec3.add($vec3$1, this.getPosition(element), translation);
|
|
10756
10300
|
this.setPosition(element, $vec3$1);
|
|
@@ -10796,9 +10340,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10796
10340
|
}
|
|
10797
10341
|
};
|
|
10798
10342
|
DefaultSceneGraphService.prototype.dirtifyLocal = function (element, transform) {
|
|
10799
|
-
|
|
10800
|
-
// 或者在调用 API 获取属性时标记
|
|
10801
|
-
if (element.renderable.rendered)
|
|
10343
|
+
if (isInFragment(element))
|
|
10802
10344
|
return;
|
|
10803
10345
|
if (!transform.localDirtyFlag) {
|
|
10804
10346
|
transform.localDirtyFlag = true;
|
|
@@ -10807,10 +10349,14 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10807
10349
|
}
|
|
10808
10350
|
}
|
|
10809
10351
|
};
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10352
|
+
DefaultSceneGraphService.prototype.dirtifyWorld = function (element, transform) {
|
|
10353
|
+
if (!transform.dirtyFlag) {
|
|
10354
|
+
this.unfreezeParentToRoot(element);
|
|
10355
|
+
}
|
|
10356
|
+
this.dirtifyWorldInternal(element, transform);
|
|
10357
|
+
this.dirtifyToRoot(element, true);
|
|
10358
|
+
};
|
|
10359
|
+
DefaultSceneGraphService.prototype.dirtifyFragment = function (element) {
|
|
10814
10360
|
var transform = element.transformable;
|
|
10815
10361
|
if (transform) {
|
|
10816
10362
|
transform.frozen = false;
|
|
@@ -10823,55 +10369,53 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10823
10369
|
renderable.boundsDirty = true;
|
|
10824
10370
|
renderable.dirty = true;
|
|
10825
10371
|
}
|
|
10826
|
-
if (!this.pendingEvents.has(element))
|
|
10827
|
-
this.pendingEvents.set(element, true);
|
|
10828
10372
|
var length = element.childNodes.length;
|
|
10829
10373
|
for (var i = 0; i < length; i++) {
|
|
10830
|
-
this.
|
|
10831
|
-
}
|
|
10832
|
-
};
|
|
10833
|
-
DefaultSceneGraphService.prototype.dirtifyWorld = function (element, transform) {
|
|
10834
|
-
if (!transform.dirtyFlag) {
|
|
10835
|
-
this.unfreezeParentToRoot(element);
|
|
10374
|
+
this.dirtifyFragment(element.childNodes[i]);
|
|
10836
10375
|
}
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
};
|
|
10840
|
-
DefaultSceneGraphService.prototype.triggerEvent = function (element, detail) {
|
|
10841
|
-
if (element.isConnected && !this.eventEntitySet.has(element.entity)) {
|
|
10842
|
-
this.boundsChangedEvent.detail = detail;
|
|
10843
|
-
this.boundsChangedEvent.target = element;
|
|
10844
|
-
if (element.isMutationObserved) {
|
|
10845
|
-
element.dispatchEvent(this.boundsChangedEvent);
|
|
10846
|
-
}
|
|
10847
|
-
else {
|
|
10848
|
-
element.ownerDocument.defaultView.dispatchEvent(this.boundsChangedEvent, true);
|
|
10849
|
-
}
|
|
10850
|
-
this.eventEntitySet.add(element.entity);
|
|
10376
|
+
if (element.nodeName === exports.Shape.FRAGMENT) {
|
|
10377
|
+
this.pendingEvents.set(element, false);
|
|
10851
10378
|
}
|
|
10852
10379
|
};
|
|
10853
|
-
DefaultSceneGraphService.prototype.triggerPendingEvents = function (
|
|
10380
|
+
DefaultSceneGraphService.prototype.triggerPendingEvents = function () {
|
|
10854
10381
|
var _this = this;
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10382
|
+
var triggered = new Set();
|
|
10383
|
+
var skipped = new Set();
|
|
10384
|
+
this.pendingEvents.forEach(function (_, element) {
|
|
10385
|
+
if (element.nodeName === exports.Shape.FRAGMENT) {
|
|
10386
|
+
element.forEach(function (e) {
|
|
10387
|
+
if (e !== element)
|
|
10388
|
+
skipped.add(e);
|
|
10389
|
+
});
|
|
10390
|
+
}
|
|
10391
|
+
});
|
|
10392
|
+
var trigger = function (element, detail) {
|
|
10393
|
+
if (element.isConnected &&
|
|
10394
|
+
!triggered.has(element) &&
|
|
10395
|
+
!skipped.has(element)) {
|
|
10396
|
+
_this.boundsChangedEvent.detail = detail;
|
|
10397
|
+
_this.boundsChangedEvent.target = element;
|
|
10398
|
+
if (element.isMutationObserved) {
|
|
10399
|
+
element.dispatchEvent(_this.boundsChangedEvent);
|
|
10868
10400
|
}
|
|
10869
10401
|
else {
|
|
10870
|
-
_this.
|
|
10402
|
+
element.ownerDocument.defaultView.dispatchEvent(_this.boundsChangedEvent, true);
|
|
10871
10403
|
}
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10404
|
+
triggered.add(element);
|
|
10405
|
+
}
|
|
10406
|
+
};
|
|
10407
|
+
this.pendingEvents.forEach(function (affectChildren, element) {
|
|
10408
|
+
$triggerPendingEvents_detail.affectChildren = affectChildren;
|
|
10409
|
+
if (affectChildren) {
|
|
10410
|
+
element.forEach(function (e) {
|
|
10411
|
+
trigger(e, $triggerPendingEvents_detail);
|
|
10412
|
+
});
|
|
10413
|
+
}
|
|
10414
|
+
else
|
|
10415
|
+
trigger(element, $triggerPendingEvents_detail);
|
|
10416
|
+
});
|
|
10417
|
+
triggered.clear();
|
|
10418
|
+
skipped.clear();
|
|
10875
10419
|
this.clearPendingEvents();
|
|
10876
10420
|
};
|
|
10877
10421
|
DefaultSceneGraphService.prototype.clearPendingEvents = function () {
|
|
@@ -10882,8 +10426,6 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10882
10426
|
var p = element;
|
|
10883
10427
|
// only need to re-render itself
|
|
10884
10428
|
if (p.renderable) {
|
|
10885
|
-
if (!p.renderable.rendered)
|
|
10886
|
-
return;
|
|
10887
10429
|
p.renderable.dirty = true;
|
|
10888
10430
|
}
|
|
10889
10431
|
while (p) {
|
|
@@ -10895,11 +10437,8 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10895
10437
|
markRenderableDirty(e);
|
|
10896
10438
|
});
|
|
10897
10439
|
}
|
|
10898
|
-
// inform dependencies
|
|
10899
10440
|
this.informDependentDisplayObjects(element);
|
|
10900
|
-
|
|
10901
|
-
this.pendingEvents.set(element, affectChildren);
|
|
10902
|
-
}
|
|
10441
|
+
this.pendingEvents.set(element, affectChildren);
|
|
10903
10442
|
};
|
|
10904
10443
|
DefaultSceneGraphService.prototype.updateDisplayObjectDependency = function (name, oldPath, newPath, object) {
|
|
10905
10444
|
// clear ref to old clip path
|
|
@@ -10953,20 +10492,14 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
10953
10492
|
};
|
|
10954
10493
|
DefaultSceneGraphService.prototype.getWorldTransform = function (element, transform) {
|
|
10955
10494
|
if (transform === void 0) { transform = element.transformable; }
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
if (!localDirtyFlag && !dirtyFlag) {
|
|
10959
|
-
if (rendered || computed)
|
|
10960
|
-
return worldTransform;
|
|
10495
|
+
if (!transform.localDirtyFlag && !transform.dirtyFlag) {
|
|
10496
|
+
return transform.worldTransform;
|
|
10961
10497
|
}
|
|
10962
10498
|
if (element.parentNode && element.parentNode.transformable) {
|
|
10963
|
-
|
|
10964
|
-
.transformable, dirtyFlag_1 = _a.dirtyFlag, localDirtyFlag_1 = _a.localDirtyFlag;
|
|
10965
|
-
if (dirtyFlag_1 || localDirtyFlag_1)
|
|
10966
|
-
this.getWorldTransform(element.parentNode);
|
|
10499
|
+
this.getWorldTransform(element.parentNode);
|
|
10967
10500
|
}
|
|
10968
10501
|
this.sync(element, transform);
|
|
10969
|
-
return worldTransform;
|
|
10502
|
+
return transform.worldTransform;
|
|
10970
10503
|
};
|
|
10971
10504
|
DefaultSceneGraphService.prototype.getLocalPosition = function (element) {
|
|
10972
10505
|
return element.transformable.localPosition;
|
|
@@ -11077,12 +10610,11 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11077
10610
|
var _this = this;
|
|
11078
10611
|
if (render === void 0) { render = false; }
|
|
11079
10612
|
var renderable = element.renderable;
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
return bounds;
|
|
10613
|
+
if (!renderable.boundsDirty && !render && renderable.bounds) {
|
|
10614
|
+
return renderable.bounds;
|
|
11083
10615
|
}
|
|
11084
|
-
if (
|
|
11085
|
-
return renderBounds;
|
|
10616
|
+
if (!renderable.renderBoundsDirty && render && renderable.renderBounds) {
|
|
10617
|
+
return renderable.renderBounds;
|
|
11086
10618
|
}
|
|
11087
10619
|
// reuse existed if possible
|
|
11088
10620
|
var existedAABB = render ? renderable.renderBounds : renderable.bounds;
|
|
@@ -11199,12 +10731,11 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11199
10731
|
}
|
|
11200
10732
|
};
|
|
11201
10733
|
DefaultSceneGraphService.prototype.sync = function (element, transform) {
|
|
11202
|
-
|
|
11203
|
-
if (force || transform.localDirtyFlag) {
|
|
10734
|
+
if (transform.localDirtyFlag) {
|
|
11204
10735
|
this.calcLocalTransform(transform);
|
|
11205
10736
|
transform.localDirtyFlag = false;
|
|
11206
10737
|
}
|
|
11207
|
-
if (
|
|
10738
|
+
if (transform.dirtyFlag) {
|
|
11208
10739
|
var parent_1 = element.parentNode;
|
|
11209
10740
|
var parentTransform = parent_1 && parent_1.transformable;
|
|
11210
10741
|
if (parent_1 === null || !parentTransform) {
|
|
@@ -11217,11 +10748,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
|
|
|
11217
10748
|
}
|
|
11218
10749
|
transform.dirtyFlag = false;
|
|
11219
10750
|
}
|
|
11220
|
-
transform.computed = true;
|
|
11221
10751
|
};
|
|
11222
|
-
/**
|
|
11223
|
-
* 解冻所有父节点,在下次关键帧时重新计算变换矩阵
|
|
11224
|
-
*/
|
|
11225
10752
|
DefaultSceneGraphService.prototype.unfreezeParentToRoot = function (child) {
|
|
11226
10753
|
var p = child.parentNode;
|
|
11227
10754
|
while (p) {
|
|
@@ -11394,19 +10921,12 @@ var TextService = /** @class */ (function () {
|
|
|
11394
10921
|
// dropShadowDistance = 0,
|
|
11395
10922
|
leading = _g === void 0 ? 0 : _g;
|
|
11396
10923
|
var font = toFontString(parsedStyle);
|
|
11397
|
-
// if (runtime.enableCSSParsing) {
|
|
11398
10924
|
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
11399
10925
|
// fallback in case UA disallow canvas data extraction
|
|
11400
|
-
// (toDataURI, getImageData functions)
|
|
11401
10926
|
if (fontProperties.fontSize === 0) {
|
|
11402
10927
|
fontProperties.fontSize = fontSize;
|
|
11403
10928
|
fontProperties.ascent = fontSize;
|
|
11404
10929
|
}
|
|
11405
|
-
// } else {
|
|
11406
|
-
// fontProperties = {
|
|
11407
|
-
// fontSize,
|
|
11408
|
-
// };
|
|
11409
|
-
// }
|
|
11410
10930
|
var context = this.runtime.offscreenCanvasCreator.getOrCreateContext(offscreenCanvas);
|
|
11411
10931
|
context.font = font;
|
|
11412
10932
|
// no overflowing by default
|
|
@@ -11728,10 +11248,7 @@ runtime.CSSPropertySyntaxFactory = CSSPropertySyntaxFactory;
|
|
|
11728
11248
|
runtime.styleValueRegistry = new DefaultStyleValueRegistry(runtime);
|
|
11729
11249
|
runtime.layoutRegistry = null;
|
|
11730
11250
|
runtime.globalThis = getGlobalThis();
|
|
11731
|
-
runtime.enableCSSParsing = false;
|
|
11732
|
-
runtime.enableDataset = false;
|
|
11733
11251
|
runtime.enableStyleSyntax = true;
|
|
11734
|
-
runtime.enableAttributeDashCased = false;
|
|
11735
11252
|
runtime.enableSizeAttenuation = false;
|
|
11736
11253
|
|
|
11737
11254
|
var entityCounter = 0;
|
|
@@ -11750,7 +11267,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
|
|
|
11750
11267
|
var Element = /** @class */ (function (_super) {
|
|
11751
11268
|
tslib.__extends(Element, _super);
|
|
11752
11269
|
function Element() {
|
|
11753
|
-
var _this = _super.
|
|
11270
|
+
var _this = _super.call(this) || this;
|
|
11754
11271
|
/**
|
|
11755
11272
|
* Unique id.
|
|
11756
11273
|
*/
|
|
@@ -11762,7 +11279,6 @@ var Element = /** @class */ (function (_super) {
|
|
|
11762
11279
|
renderBoundsDirty: true,
|
|
11763
11280
|
dirtyRenderBounds: undefined,
|
|
11764
11281
|
dirty: false,
|
|
11765
|
-
rendered: false,
|
|
11766
11282
|
};
|
|
11767
11283
|
_this.cullable = {
|
|
11768
11284
|
strategy: exports.Strategy.Standard,
|
|
@@ -11774,7 +11290,6 @@ var Element = /** @class */ (function (_super) {
|
|
|
11774
11290
|
dirtyFlag: false,
|
|
11775
11291
|
localDirtyFlag: false,
|
|
11776
11292
|
frozen: false,
|
|
11777
|
-
computed: false,
|
|
11778
11293
|
localPosition: [0, 0, 0],
|
|
11779
11294
|
localRotation: [0, 0, 0, 1],
|
|
11780
11295
|
localScale: [1, 1, 1],
|
|
@@ -11822,38 +11337,30 @@ var Element = /** @class */ (function (_super) {
|
|
|
11822
11337
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
11823
11338
|
*/
|
|
11824
11339
|
_this.style = {};
|
|
11825
|
-
_this.computedStyle =
|
|
11826
|
-
? {
|
|
11827
|
-
opacity: unsetKeywordValue,
|
|
11828
|
-
fillOpacity: unsetKeywordValue,
|
|
11829
|
-
strokeOpacity: unsetKeywordValue,
|
|
11830
|
-
fill: unsetKeywordValue,
|
|
11831
|
-
stroke: unsetKeywordValue,
|
|
11832
|
-
transform: unsetKeywordValue,
|
|
11833
|
-
transformOrigin: unsetKeywordValue,
|
|
11834
|
-
visibility: unsetKeywordValue,
|
|
11835
|
-
pointerEvents: unsetKeywordValue,
|
|
11836
|
-
lineWidth: unsetKeywordValue,
|
|
11837
|
-
lineCap: unsetKeywordValue,
|
|
11838
|
-
lineJoin: unsetKeywordValue,
|
|
11839
|
-
increasedLineWidthForHitTesting: unsetKeywordValue,
|
|
11840
|
-
fontSize: unsetKeywordValue,
|
|
11841
|
-
fontFamily: unsetKeywordValue,
|
|
11842
|
-
fontStyle: unsetKeywordValue,
|
|
11843
|
-
fontWeight: unsetKeywordValue,
|
|
11844
|
-
fontVariant: unsetKeywordValue,
|
|
11845
|
-
textAlign: unsetKeywordValue,
|
|
11846
|
-
textBaseline: unsetKeywordValue,
|
|
11847
|
-
textTransform: unsetKeywordValue,
|
|
11848
|
-
zIndex: unsetKeywordValue,
|
|
11849
|
-
filter: unsetKeywordValue,
|
|
11850
|
-
shadowType: unsetKeywordValue,
|
|
11851
|
-
}
|
|
11852
|
-
: {};
|
|
11340
|
+
_this.computedStyle = {};
|
|
11853
11341
|
/**
|
|
11854
11342
|
* Renderers will use these used values.
|
|
11855
11343
|
*/
|
|
11856
|
-
_this.parsedStyle = {
|
|
11344
|
+
_this.parsedStyle = {
|
|
11345
|
+
// opacity: '',
|
|
11346
|
+
// fillOpacity: '',
|
|
11347
|
+
// strokeOpacity: '',
|
|
11348
|
+
// transformOrigin: '',
|
|
11349
|
+
// visibility: '',
|
|
11350
|
+
// pointerEvents: '',
|
|
11351
|
+
// lineWidth: '',
|
|
11352
|
+
// lineCap: '',
|
|
11353
|
+
// lineJoin: '',
|
|
11354
|
+
// increasedLineWidthForHitTesting: '',
|
|
11355
|
+
// fontSize: '',
|
|
11356
|
+
// fontFamily: '',
|
|
11357
|
+
// fontStyle: '',
|
|
11358
|
+
// fontWeight: '',
|
|
11359
|
+
// fontVariant: '',
|
|
11360
|
+
// textAlign: '',
|
|
11361
|
+
// textBaseline: '',
|
|
11362
|
+
// textTransform: '',
|
|
11363
|
+
};
|
|
11857
11364
|
/**
|
|
11858
11365
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
11859
11366
|
*/
|
|
@@ -11959,7 +11466,12 @@ var Element = /** @class */ (function (_super) {
|
|
|
11959
11466
|
}
|
|
11960
11467
|
runtime.sceneGraphService.attach(child, this, index);
|
|
11961
11468
|
if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
|
|
11962
|
-
this.
|
|
11469
|
+
if (!isInFragment(this) && child.nodeName === exports.Shape.FRAGMENT) {
|
|
11470
|
+
this.ownerDocument.defaultView.mountFragment(child);
|
|
11471
|
+
}
|
|
11472
|
+
else {
|
|
11473
|
+
this.ownerDocument.defaultView.mountChildren(child);
|
|
11474
|
+
}
|
|
11963
11475
|
}
|
|
11964
11476
|
// @ts-ignore
|
|
11965
11477
|
if (this.isMutationObserved) {
|
|
@@ -12073,9 +11585,9 @@ var Element = /** @class */ (function (_super) {
|
|
|
12073
11585
|
this.forEach(function (object) {
|
|
12074
11586
|
if (object !== _this && filter(object)) {
|
|
12075
11587
|
target = object;
|
|
12076
|
-
return
|
|
11588
|
+
return false;
|
|
12077
11589
|
}
|
|
12078
|
-
return
|
|
11590
|
+
return true;
|
|
12079
11591
|
});
|
|
12080
11592
|
return target;
|
|
12081
11593
|
};
|
|
@@ -12175,13 +11687,12 @@ var Element = /** @class */ (function (_super) {
|
|
|
12175
11687
|
return this;
|
|
12176
11688
|
};
|
|
12177
11689
|
Element.prototype.destroy = function () {
|
|
12178
|
-
var _a;
|
|
12179
11690
|
// destroy itself before remove
|
|
12180
11691
|
this.dispatchEvent(destroyEvent);
|
|
12181
11692
|
// remove from scenegraph first
|
|
12182
11693
|
this.remove();
|
|
12183
11694
|
// remove event listeners
|
|
12184
|
-
|
|
11695
|
+
this.emitter.removeAllListeners();
|
|
12185
11696
|
this.destroyed = true;
|
|
12186
11697
|
};
|
|
12187
11698
|
Element.prototype.getGeometryBounds = function () {
|
|
@@ -12234,17 +11745,13 @@ var Element = /** @class */ (function (_super) {
|
|
|
12234
11745
|
*/
|
|
12235
11746
|
Element.prototype.getAttribute = function (name) {
|
|
12236
11747
|
// @see https://github.com/antvis/G/issues/1267
|
|
12237
|
-
if (
|
|
12238
|
-
return
|
|
11748
|
+
if (typeof name === 'symbol') {
|
|
11749
|
+
return undefined;
|
|
12239
11750
|
}
|
|
12240
11751
|
var value = this.attributes[name];
|
|
12241
11752
|
if (value === undefined) {
|
|
12242
|
-
if (runtime.enableAttributeDashCased) {
|
|
12243
|
-
var attributeName = formatAttributeName(name);
|
|
12244
|
-
value = this.attributes[attributeName];
|
|
12245
|
-
}
|
|
12246
11753
|
// if the given attribute does not exist, the value returned will either be null or ""
|
|
12247
|
-
return
|
|
11754
|
+
return value;
|
|
12248
11755
|
}
|
|
12249
11756
|
else {
|
|
12250
11757
|
return value;
|
|
@@ -12316,64 +11823,6 @@ var Proxy = runtime.globalThis.Proxy
|
|
|
12316
11823
|
? runtime.globalThis.Proxy
|
|
12317
11824
|
: function () { };
|
|
12318
11825
|
var mutationEvent = new MutationEvent(exports.ElementEvent.ATTR_MODIFIED, null, null, null, null, MutationEvent.MODIFICATION, null, null);
|
|
12319
|
-
var DEFAULT_STYLE_PROPS = {
|
|
12320
|
-
opacity: '',
|
|
12321
|
-
fillOpacity: '',
|
|
12322
|
-
strokeOpacity: '',
|
|
12323
|
-
fill: '',
|
|
12324
|
-
stroke: '',
|
|
12325
|
-
transform: '',
|
|
12326
|
-
transformOrigin: '',
|
|
12327
|
-
visibility: '',
|
|
12328
|
-
pointerEvents: '',
|
|
12329
|
-
lineWidth: '',
|
|
12330
|
-
lineCap: '',
|
|
12331
|
-
lineJoin: '',
|
|
12332
|
-
increasedLineWidthForHitTesting: '',
|
|
12333
|
-
fontSize: '',
|
|
12334
|
-
fontFamily: '',
|
|
12335
|
-
fontStyle: '',
|
|
12336
|
-
fontWeight: '',
|
|
12337
|
-
fontVariant: '',
|
|
12338
|
-
textAlign: '',
|
|
12339
|
-
textBaseline: '',
|
|
12340
|
-
textTransform: '',
|
|
12341
|
-
zIndex: '',
|
|
12342
|
-
filter: '',
|
|
12343
|
-
shadowType: '',
|
|
12344
|
-
};
|
|
12345
|
-
var DEFAULT_PARSED_STYLE_PROPS = {
|
|
12346
|
-
fill: noneColor,
|
|
12347
|
-
stroke: noneColor,
|
|
12348
|
-
transform: [],
|
|
12349
|
-
zIndex: 0,
|
|
12350
|
-
filter: [],
|
|
12351
|
-
shadowType: 'outer',
|
|
12352
|
-
miterLimit: 10,
|
|
12353
|
-
};
|
|
12354
|
-
var INHERITABLE_BASE_STYLE_PROPS = [
|
|
12355
|
-
'opacity',
|
|
12356
|
-
'fillOpacity',
|
|
12357
|
-
'strokeOpacity',
|
|
12358
|
-
'transformOrigin',
|
|
12359
|
-
'visibility',
|
|
12360
|
-
'pointerEvents',
|
|
12361
|
-
'lineWidth',
|
|
12362
|
-
'lineCap',
|
|
12363
|
-
'lineJoin',
|
|
12364
|
-
'increasedLineWidthForHitTesting',
|
|
12365
|
-
];
|
|
12366
|
-
var INHERITABLE_STYLE_PROPS = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(INHERITABLE_BASE_STYLE_PROPS), false), [
|
|
12367
|
-
'fontSize',
|
|
12368
|
-
'fontFamily',
|
|
12369
|
-
'fontStyle',
|
|
12370
|
-
'fontWeight',
|
|
12371
|
-
'fontVariant',
|
|
12372
|
-
'textAlign',
|
|
12373
|
-
'textBaseline',
|
|
12374
|
-
'textTransform',
|
|
12375
|
-
], false);
|
|
12376
|
-
var DATASET_PREFIX = 'data-';
|
|
12377
11826
|
var $vec3 = glMatrix.vec3.create();
|
|
12378
11827
|
var $quat = glMatrix.quat.create();
|
|
12379
11828
|
/**
|
|
@@ -12414,30 +11863,11 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12414
11863
|
_this.className = config.className || config.class;
|
|
12415
11864
|
}
|
|
12416
11865
|
_this.nodeName = config.type || exports.Shape.GROUP;
|
|
12417
|
-
if (
|
|
12418
|
-
Object.assign(_this.attributes, DEFAULT_STYLE_PROPS);
|
|
12419
|
-
Object.assign(_this.parsedStyle, DEFAULT_PARSED_STYLE_PROPS, _this.config.initialParsedStyle);
|
|
12420
|
-
}
|
|
12421
|
-
else if (config.initialParsedStyle) {
|
|
11866
|
+
if (config.initialParsedStyle) {
|
|
12422
11867
|
Object.assign(_this.parsedStyle, config.initialParsedStyle);
|
|
12423
11868
|
}
|
|
12424
11869
|
// start to process attributes
|
|
12425
11870
|
_this.initAttributes(config.style);
|
|
12426
|
-
if (runtime.enableDataset) {
|
|
12427
|
-
_this.dataset = new Proxy({}, {
|
|
12428
|
-
get: function (target, name) {
|
|
12429
|
-
var formattedName = "".concat(DATASET_PREFIX).concat(kebabize(name));
|
|
12430
|
-
if (target[formattedName] !== undefined) {
|
|
12431
|
-
return target[formattedName];
|
|
12432
|
-
}
|
|
12433
|
-
return _this.getAttribute(formattedName);
|
|
12434
|
-
},
|
|
12435
|
-
set: function (_, prop, value) {
|
|
12436
|
-
_this.setAttribute("".concat(DATASET_PREFIX).concat(kebabize(prop)), value);
|
|
12437
|
-
return true;
|
|
12438
|
-
},
|
|
12439
|
-
});
|
|
12440
|
-
}
|
|
12441
11871
|
if (runtime.enableStyleSyntax) {
|
|
12442
11872
|
_this.style = new Proxy(
|
|
12443
11873
|
// @ts-ignore
|
|
@@ -12477,13 +11907,6 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12477
11907
|
this.getAnimations().forEach(function (animation) {
|
|
12478
11908
|
animation.cancel();
|
|
12479
11909
|
});
|
|
12480
|
-
// FIXME
|
|
12481
|
-
// this.renderable = null;
|
|
12482
|
-
// this.cullable = null;
|
|
12483
|
-
// this.transformable = null;
|
|
12484
|
-
// this.rBushNode = null;
|
|
12485
|
-
// this.geometry = null;
|
|
12486
|
-
// this.sortable = null;
|
|
12487
11910
|
};
|
|
12488
11911
|
DisplayObject.prototype.cloneNode = function (deep, customCloneFunc) {
|
|
12489
11912
|
var clonedStyle = tslib.__assign({}, this.attributes);
|
|
@@ -12526,39 +11949,37 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12526
11949
|
};
|
|
12527
11950
|
DisplayObject.prototype.initAttributes = function (attributes) {
|
|
12528
11951
|
if (attributes === void 0) { attributes = {}; }
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
11952
|
+
var options = {
|
|
11953
|
+
forceUpdateGeometry: true,
|
|
11954
|
+
};
|
|
11955
|
+
runtime.styleValueRegistry.processProperties(this, attributes, options);
|
|
12533
11956
|
// redraw at next frame
|
|
12534
11957
|
this.renderable.dirty = true;
|
|
12535
11958
|
};
|
|
12536
11959
|
DisplayObject.prototype.setAttribute = function (name, value, force, memoize) {
|
|
12537
11960
|
if (force === void 0) { force = false; }
|
|
12538
11961
|
if (memoize === void 0) { memoize = true; }
|
|
12539
|
-
if (runtime.enableAttributeDashCased) {
|
|
12540
|
-
name = formatAttributeName(name);
|
|
12541
|
-
}
|
|
12542
11962
|
// ignore undefined value
|
|
12543
11963
|
if (util.isUndefined(value)) {
|
|
12544
11964
|
return;
|
|
12545
11965
|
}
|
|
12546
11966
|
if (force || value !== this.attributes[name]) {
|
|
12547
|
-
this.internalSetAttribute(name, value,
|
|
11967
|
+
this.internalSetAttribute(name, value, { memoize: memoize });
|
|
12548
11968
|
_super.prototype.setAttribute.call(this, name, value);
|
|
12549
11969
|
}
|
|
12550
11970
|
};
|
|
12551
11971
|
/**
|
|
12552
11972
|
* called when attributes get changed or initialized
|
|
12553
11973
|
*/
|
|
12554
|
-
DisplayObject.prototype.internalSetAttribute = function (name, value,
|
|
11974
|
+
DisplayObject.prototype.internalSetAttribute = function (name, value, parseOptions) {
|
|
12555
11975
|
var _a;
|
|
11976
|
+
if (parseOptions === void 0) { parseOptions = {}; }
|
|
12556
11977
|
var renderable = this.renderable;
|
|
12557
11978
|
var oldValue = this.attributes[name];
|
|
12558
11979
|
var oldParsedValue = this.parsedStyle[name];
|
|
12559
11980
|
runtime.styleValueRegistry.processProperties(this, (_a = {},
|
|
12560
11981
|
_a[name] = value,
|
|
12561
|
-
_a),
|
|
11982
|
+
_a), parseOptions);
|
|
12562
11983
|
// redraw at next frame
|
|
12563
11984
|
renderable.dirty = true;
|
|
12564
11985
|
var newParsedValue = this.parsedStyle[name];
|
|
@@ -12798,10 +12219,8 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12798
12219
|
* shortcut for Used value of `visibility`
|
|
12799
12220
|
*/
|
|
12800
12221
|
DisplayObject.prototype.isVisible = function () {
|
|
12801
|
-
var _a
|
|
12802
|
-
return
|
|
12803
|
-
? ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) === 'visible'
|
|
12804
|
-
: ((_b = this.parsedStyle) === null || _b === void 0 ? void 0 : _b.visibility) !== 'hidden';
|
|
12222
|
+
var _a;
|
|
12223
|
+
return ((_a = this.parsedStyle) === null || _a === void 0 ? void 0 : _a.visibility) !== 'hidden';
|
|
12805
12224
|
};
|
|
12806
12225
|
Object.defineProperty(DisplayObject.prototype, "interactive", {
|
|
12807
12226
|
get: function () {
|
|
@@ -12921,28 +12340,18 @@ var DisplayObject = /** @class */ (function (_super) {
|
|
|
12921
12340
|
* @deprecated
|
|
12922
12341
|
*/
|
|
12923
12342
|
DisplayObject.prototype.show = function () {
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
}
|
|
12927
|
-
else {
|
|
12928
|
-
this.forEach(function (object) {
|
|
12929
|
-
object.style.visibility = 'visible';
|
|
12930
|
-
});
|
|
12931
|
-
}
|
|
12343
|
+
this.forEach(function (object) {
|
|
12344
|
+
object.style.visibility = 'visible';
|
|
12345
|
+
});
|
|
12932
12346
|
};
|
|
12933
12347
|
/**
|
|
12934
12348
|
* Use `visibility: hidden` instead.
|
|
12935
12349
|
* @deprecated
|
|
12936
12350
|
*/
|
|
12937
12351
|
DisplayObject.prototype.hide = function () {
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
}
|
|
12941
|
-
else {
|
|
12942
|
-
this.forEach(function (object) {
|
|
12943
|
-
object.style.visibility = 'hidden';
|
|
12944
|
-
});
|
|
12945
|
-
}
|
|
12352
|
+
this.forEach(function (object) {
|
|
12353
|
+
object.style.visibility = 'hidden';
|
|
12354
|
+
});
|
|
12946
12355
|
};
|
|
12947
12356
|
/**
|
|
12948
12357
|
* Use `childElementCount` instead.
|
|
@@ -13052,12 +12461,15 @@ var Circle = /** @class */ (function (_super) {
|
|
|
13052
12461
|
*/
|
|
13053
12462
|
var CustomElement = /** @class */ (function (_super) {
|
|
13054
12463
|
tslib.__extends(CustomElement, _super);
|
|
12464
|
+
// private shadowNodes: DisplayObject[] = [];
|
|
13055
12465
|
function CustomElement(_a) {
|
|
13056
12466
|
if (_a === void 0) { _a = {}; }
|
|
13057
12467
|
var _this = this;
|
|
13058
12468
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13059
|
-
_this = _super.call(this, tslib.__assign({ style:
|
|
13060
|
-
|
|
12469
|
+
_this = _super.call(this, tslib.__assign({ style: style }, rest)) || this;
|
|
12470
|
+
// static get observedAttributes(): string[] {
|
|
12471
|
+
// return [];
|
|
12472
|
+
// }
|
|
13061
12473
|
_this.isCustomElement = true;
|
|
13062
12474
|
return _this;
|
|
13063
12475
|
}
|
|
@@ -13073,6 +12485,23 @@ var Ellipse = /** @class */ (function (_super) {
|
|
|
13073
12485
|
return Ellipse;
|
|
13074
12486
|
}(DisplayObject));
|
|
13075
12487
|
|
|
12488
|
+
/**
|
|
12489
|
+
* 节点片段,用于包裹多个节点并批量操作
|
|
12490
|
+
*
|
|
12491
|
+
* 向 Fragment 或者根节点为 Fragment 的节点添加子节点时,不会触发渲染和事件。
|
|
12492
|
+
*
|
|
12493
|
+
* 当 Fragment 被挂载到 Canvas 中的节点时,其子节点会一次性被渲染,并触发合并事件。
|
|
12494
|
+
*
|
|
12495
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment
|
|
12496
|
+
*/
|
|
12497
|
+
var Fragment = /** @class */ (function (_super) {
|
|
12498
|
+
tslib.__extends(Fragment, _super);
|
|
12499
|
+
function Fragment() {
|
|
12500
|
+
return _super.call(this, { type: exports.Shape.FRAGMENT }) || this;
|
|
12501
|
+
}
|
|
12502
|
+
return Fragment;
|
|
12503
|
+
}(DisplayObject));
|
|
12504
|
+
|
|
13076
12505
|
/**
|
|
13077
12506
|
* its attributes are inherited by its children.
|
|
13078
12507
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/g
|
|
@@ -13102,8 +12531,7 @@ var HTML = /** @class */ (function (_super) {
|
|
|
13102
12531
|
if (_a === void 0) { _a = {}; }
|
|
13103
12532
|
var _this = this;
|
|
13104
12533
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13105
|
-
_this = _super.call(this, tslib.__assign({ type: exports.Shape.HTML, style:
|
|
13106
|
-
? tslib.__assign({ x: '', y: '', width: 'auto', height: 'auto', innerHTML: '' }, style) : tslib.__assign({}, style) }, rest)) || this;
|
|
12534
|
+
_this = _super.call(this, tslib.__assign({ type: exports.Shape.HTML, style: style }, rest)) || this;
|
|
13107
12535
|
_this.cullable.enable = false;
|
|
13108
12536
|
return _this;
|
|
13109
12537
|
}
|
|
@@ -13295,13 +12723,10 @@ var Path = /** @class */ (function (_super) {
|
|
|
13295
12723
|
if (_a === void 0) { _a = {}; }
|
|
13296
12724
|
var _this = this;
|
|
13297
12725
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13298
|
-
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style:
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
miterLimit: 4,
|
|
13303
|
-
d: tslib.__assign({}, EMPTY_PARSED_PATH),
|
|
13304
|
-
} }, rest)) || this;
|
|
12726
|
+
_this = _super.call(this, tslib.__assign({ type: exports.Shape.PATH, style: style, initialParsedStyle: {
|
|
12727
|
+
miterLimit: 4,
|
|
12728
|
+
d: tslib.__assign({}, EMPTY_PARSED_PATH),
|
|
12729
|
+
} }, rest)) || this;
|
|
13305
12730
|
_this.markerStartAngle = 0;
|
|
13306
12731
|
_this.markerEndAngle = 0;
|
|
13307
12732
|
/**
|
|
@@ -13496,18 +12921,15 @@ var Polygon = /** @class */ (function (_super) {
|
|
|
13496
12921
|
if (_a === void 0) { _a = {}; }
|
|
13497
12922
|
var _this = this;
|
|
13498
12923
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13499
|
-
_this = _super.call(this, tslib.__assign({ type: exports.Shape.POLYGON, style:
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
|
|
13503
|
-
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
miterLimit: 4,
|
|
13509
|
-
isClosed: true,
|
|
13510
|
-
} }, rest)) || this;
|
|
12924
|
+
_this = _super.call(this, tslib.__assign({ type: exports.Shape.POLYGON, style: style, initialParsedStyle: {
|
|
12925
|
+
points: {
|
|
12926
|
+
points: [],
|
|
12927
|
+
totalLength: 0,
|
|
12928
|
+
segments: [],
|
|
12929
|
+
},
|
|
12930
|
+
miterLimit: 4,
|
|
12931
|
+
isClosed: true,
|
|
12932
|
+
} }, rest)) || this;
|
|
13511
12933
|
_this.markerStartAngle = 0;
|
|
13512
12934
|
_this.markerEndAngle = 0;
|
|
13513
12935
|
/**
|
|
@@ -13642,18 +13064,15 @@ var Polyline = /** @class */ (function (_super) {
|
|
|
13642
13064
|
function Polyline(_a) {
|
|
13643
13065
|
if (_a === void 0) { _a = {}; }
|
|
13644
13066
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13645
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.POLYLINE, style:
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
|
|
13652
|
-
|
|
13653
|
-
|
|
13654
|
-
miterLimit: 4,
|
|
13655
|
-
isClosed: false,
|
|
13656
|
-
} }, rest)) || this;
|
|
13067
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.POLYLINE, style: style, initialParsedStyle: {
|
|
13068
|
+
points: {
|
|
13069
|
+
points: [],
|
|
13070
|
+
totalLength: 0,
|
|
13071
|
+
segments: [],
|
|
13072
|
+
},
|
|
13073
|
+
miterLimit: 4,
|
|
13074
|
+
isClosed: false,
|
|
13075
|
+
} }, rest)) || this;
|
|
13657
13076
|
}
|
|
13658
13077
|
Polyline.prototype.getTotalLength = function () {
|
|
13659
13078
|
return getOrCalculatePolylineTotalLength(this);
|
|
@@ -13737,16 +13156,8 @@ var Text = /** @class */ (function (_super) {
|
|
|
13737
13156
|
function Text(_a) {
|
|
13738
13157
|
if (_a === void 0) { _a = {}; }
|
|
13739
13158
|
var style = _a.style, rest = tslib.__rest(_a, ["style"]);
|
|
13740
|
-
return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style:
|
|
13741
|
-
|
|
13742
|
-
// whiteSpace: 'pre',
|
|
13743
|
-
wordWrap: false, wordWrapWidth: 0, leading: 0, dx: '', dy: '' }, style) : tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13744
|
-
}
|
|
13745
|
-
// lengthAdjust: SVGAnimatedEnumeration;
|
|
13746
|
-
// textLength: SVGAnimatedLength;
|
|
13747
|
-
// getCharNumAtPosition(point?: DOMPointInit): number {
|
|
13748
|
-
// throw new Error('Method not implemented.');
|
|
13749
|
-
// }
|
|
13159
|
+
return _super.call(this, tslib.__assign({ type: exports.Shape.TEXT, style: tslib.__assign({ fill: 'black' }, style) }, rest)) || this;
|
|
13160
|
+
}
|
|
13750
13161
|
/**
|
|
13751
13162
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
|
|
13752
13163
|
*/
|
|
@@ -13755,27 +13166,6 @@ var Text = /** @class */ (function (_super) {
|
|
|
13755
13166
|
this.getGeometryBounds();
|
|
13756
13167
|
return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.maxLineWidth) || 0;
|
|
13757
13168
|
};
|
|
13758
|
-
// getEndPositionOfChar(charnum: number): DOMPoint {
|
|
13759
|
-
// throw new Error('Method not implemented.');
|
|
13760
|
-
// }
|
|
13761
|
-
// getExtentOfChar(charnum: number): DOMRect {
|
|
13762
|
-
// throw new Error('Method not implemented.');
|
|
13763
|
-
// }
|
|
13764
|
-
// getNumberOfChars(): number {
|
|
13765
|
-
// throw new Error('Method not implemented.');
|
|
13766
|
-
// }
|
|
13767
|
-
// getRotationOfChar(charnum: number): number {
|
|
13768
|
-
// throw new Error('Method not implemented.');
|
|
13769
|
-
// }
|
|
13770
|
-
// getStartPositionOfChar(charnum: number): DOMPoint {
|
|
13771
|
-
// throw new Error('Method not implemented.');
|
|
13772
|
-
// }
|
|
13773
|
-
// getSubStringLength(charnum: number, nchars: number): number {
|
|
13774
|
-
// throw new Error('Method not implemented.');
|
|
13775
|
-
// }
|
|
13776
|
-
// selectSubString(charnum: number, nchars: number): void {
|
|
13777
|
-
// throw new Error('Method not implemented.');
|
|
13778
|
-
// }
|
|
13779
13169
|
Text.prototype.getLineBoundingRects = function () {
|
|
13780
13170
|
var _a;
|
|
13781
13171
|
this.getGeometryBounds();
|
|
@@ -14289,30 +13679,37 @@ var CullingPlugin = /** @class */ (function () {
|
|
|
14289
13679
|
renderingService.hooks.cull.tap(CullingPlugin.tag, function (object) {
|
|
14290
13680
|
if (object) {
|
|
14291
13681
|
var cullable = object.cullable;
|
|
13682
|
+
// cullable.visible = true;
|
|
13683
|
+
// const renderBounds = object.getRenderBounds();
|
|
13684
|
+
// if (AABB.isEmpty(renderBounds)) {
|
|
13685
|
+
// cullable.visible = false;
|
|
13686
|
+
// } else {
|
|
13687
|
+
// const isShape2D = shape2D.indexOf(object.nodeName as Shape) > -1;
|
|
13688
|
+
// const [p0, p1, p2, p3] = camera.getFrustum().planes;
|
|
13689
|
+
// tmpAABB.setMinMax([-p1.distance, -p3.distance, 0], [p0.distance, p2.distance, 0]);
|
|
13690
|
+
// cullable.visible = isShape2D ? renderBounds.intersects(tmpAABB) : true;
|
|
13691
|
+
// }
|
|
14292
13692
|
if (strategies.length === 0) {
|
|
14293
|
-
cullable.visible =
|
|
14294
|
-
renderingContext.unculledEntities.indexOf(object.entity) > -1;
|
|
13693
|
+
cullable.visible = renderingContext.unculledEntities.indexOf(object.entity) > -1;
|
|
14295
13694
|
}
|
|
14296
13695
|
else {
|
|
14297
13696
|
// eg. implemented by g-webgl(frustum culling)
|
|
14298
|
-
cullable.visible = strategies.every(function (strategy) {
|
|
14299
|
-
return strategy.isVisible(camera, object);
|
|
14300
|
-
});
|
|
13697
|
+
cullable.visible = strategies.every(function (strategy) { return strategy.isVisible(camera, object); });
|
|
14301
13698
|
}
|
|
14302
13699
|
if (!object.isCulled() && object.isVisible()) {
|
|
14303
13700
|
return object;
|
|
14304
13701
|
}
|
|
14305
13702
|
else {
|
|
13703
|
+
// if (this.renderingContext.renderListLastFrame.indexOf(object) > -1) {
|
|
14306
13704
|
object.dispatchEvent(new CustomEvent(exports.ElementEvent.CULLED));
|
|
13705
|
+
// }
|
|
14307
13706
|
}
|
|
14308
13707
|
return null;
|
|
14309
13708
|
}
|
|
14310
13709
|
return object;
|
|
14311
13710
|
});
|
|
14312
|
-
renderingService.hooks.afterRender.tap(CullingPlugin.tag, function (
|
|
14313
|
-
|
|
14314
|
-
object.cullable.visibilityPlaneMask = -1;
|
|
14315
|
-
});
|
|
13711
|
+
renderingService.hooks.afterRender.tap(CullingPlugin.tag, function (object) {
|
|
13712
|
+
object.cullable.visibilityPlaneMask = -1;
|
|
14316
13713
|
});
|
|
14317
13714
|
};
|
|
14318
13715
|
CullingPlugin.tag = 'Culling';
|
|
@@ -14723,10 +14120,8 @@ var FrustumCullingStrategy = /** @class */ (function () {
|
|
|
14723
14120
|
|
|
14724
14121
|
var PrepareRendererPlugin = /** @class */ (function () {
|
|
14725
14122
|
function PrepareRendererPlugin() {
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
*/
|
|
14729
|
-
this.toSync = new Set();
|
|
14123
|
+
this.syncTasks = new Map();
|
|
14124
|
+
this.isFirstTimeRendering = true;
|
|
14730
14125
|
this.syncing = false;
|
|
14731
14126
|
this.isFirstTimeRenderingFinished = false;
|
|
14732
14127
|
}
|
|
@@ -14742,20 +14137,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14742
14137
|
renderingService.dirtify();
|
|
14743
14138
|
};
|
|
14744
14139
|
var handleBoundsChanged = function (e) {
|
|
14745
|
-
|
|
14746
|
-
var object = e.target;
|
|
14747
|
-
if (affectChildren) {
|
|
14748
|
-
object.forEach(function (node) {
|
|
14749
|
-
_this.toSync.add(node);
|
|
14750
|
-
});
|
|
14751
|
-
}
|
|
14752
|
-
var p = object;
|
|
14753
|
-
while (p) {
|
|
14754
|
-
if (p.renderable) {
|
|
14755
|
-
_this.toSync.add(p);
|
|
14756
|
-
}
|
|
14757
|
-
p = p.parentElement;
|
|
14758
|
-
}
|
|
14140
|
+
_this.syncTasks.set(e.target, e.detail.affectChildren);
|
|
14759
14141
|
renderingService.dirtify();
|
|
14760
14142
|
};
|
|
14761
14143
|
var handleMounted = function (e) {
|
|
@@ -14763,13 +14145,6 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14763
14145
|
if (runtime.enableSizeAttenuation) {
|
|
14764
14146
|
runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
|
|
14765
14147
|
}
|
|
14766
|
-
if (runtime.enableCSSParsing) {
|
|
14767
|
-
// recalc style values
|
|
14768
|
-
runtime.styleValueRegistry.recalc(object);
|
|
14769
|
-
}
|
|
14770
|
-
if (object.renderable.rendered)
|
|
14771
|
-
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
14772
|
-
renderingService.dirtify();
|
|
14773
14148
|
};
|
|
14774
14149
|
var handleUnmounted = function (e) {
|
|
14775
14150
|
var object = e.target;
|
|
@@ -14777,7 +14152,7 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14777
14152
|
if (rBushNode.aabb) {
|
|
14778
14153
|
_this.rBush.remove(rBushNode.aabb);
|
|
14779
14154
|
}
|
|
14780
|
-
_this.
|
|
14155
|
+
_this.syncTasks.delete(object);
|
|
14781
14156
|
runtime.sceneGraphService.dirtifyToRoot(object);
|
|
14782
14157
|
renderingService.dirtify();
|
|
14783
14158
|
};
|
|
@@ -14792,77 +14167,95 @@ var PrepareRendererPlugin = /** @class */ (function () {
|
|
|
14792
14167
|
canvas.removeEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
14793
14168
|
canvas.removeEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
14794
14169
|
canvas.removeEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
14795
|
-
_this.
|
|
14170
|
+
_this.syncTasks.clear();
|
|
14796
14171
|
});
|
|
14797
14172
|
var ric = (_a = runtime.globalThis.requestIdleCallback) !== null && _a !== void 0 ? _a : raf.bind(runtime.globalThis);
|
|
14798
14173
|
renderingService.hooks.endFrame.tap(PrepareRendererPlugin.tag, function () {
|
|
14799
|
-
|
|
14800
|
-
|
|
14174
|
+
if (_this.isFirstTimeRendering) {
|
|
14175
|
+
_this.isFirstTimeRendering = false;
|
|
14801
14176
|
_this.syncing = true;
|
|
14802
14177
|
ric(function () {
|
|
14803
14178
|
_this.syncRTree(true);
|
|
14804
14179
|
_this.isFirstTimeRenderingFinished = true;
|
|
14805
14180
|
});
|
|
14806
14181
|
}
|
|
14807
|
-
else
|
|
14182
|
+
else {
|
|
14808
14183
|
_this.syncRTree();
|
|
14809
14184
|
}
|
|
14810
|
-
_this.toSync.forEach(function (node) { return (node.renderable.rendered = true); });
|
|
14811
14185
|
});
|
|
14812
14186
|
};
|
|
14187
|
+
PrepareRendererPlugin.prototype.syncNode = function (node, force) {
|
|
14188
|
+
if (force === void 0) { force = false; }
|
|
14189
|
+
if (!node.isConnected)
|
|
14190
|
+
return;
|
|
14191
|
+
var rBushNode = node.rBushNode;
|
|
14192
|
+
// clear dirty node
|
|
14193
|
+
if (rBushNode.aabb)
|
|
14194
|
+
this.rBush.remove(rBushNode.aabb);
|
|
14195
|
+
var renderBounds = node.getRenderBounds();
|
|
14196
|
+
if (renderBounds) {
|
|
14197
|
+
var renderable = node.renderable;
|
|
14198
|
+
if (force) {
|
|
14199
|
+
if (!renderable.dirtyRenderBounds) {
|
|
14200
|
+
renderable.dirtyRenderBounds = new AABB();
|
|
14201
|
+
}
|
|
14202
|
+
// save last dirty aabb
|
|
14203
|
+
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
14204
|
+
}
|
|
14205
|
+
var _a = tslib.__read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
|
|
14206
|
+
var _b = tslib.__read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
|
|
14207
|
+
if (!rBushNode.aabb) {
|
|
14208
|
+
rBushNode.aabb = {};
|
|
14209
|
+
}
|
|
14210
|
+
rBushNode.aabb.displayObject = node;
|
|
14211
|
+
rBushNode.aabb.minX = minX;
|
|
14212
|
+
rBushNode.aabb.minY = minY;
|
|
14213
|
+
rBushNode.aabb.maxX = maxX;
|
|
14214
|
+
rBushNode.aabb.maxY = maxY;
|
|
14215
|
+
}
|
|
14216
|
+
if (rBushNode.aabb) {
|
|
14217
|
+
// TODO: NaN occurs when width/height of Rect is 0
|
|
14218
|
+
if (!isNaN(rBushNode.aabb.maxX) &&
|
|
14219
|
+
!isNaN(rBushNode.aabb.maxX) &&
|
|
14220
|
+
!isNaN(rBushNode.aabb.minX) &&
|
|
14221
|
+
!isNaN(rBushNode.aabb.minY)) {
|
|
14222
|
+
return rBushNode.aabb;
|
|
14223
|
+
}
|
|
14224
|
+
}
|
|
14225
|
+
};
|
|
14813
14226
|
PrepareRendererPlugin.prototype.syncRTree = function (force) {
|
|
14814
14227
|
var _this = this;
|
|
14815
14228
|
if (force === void 0) { force = false; }
|
|
14816
|
-
if (!force && (this.syncing || this.
|
|
14229
|
+
if (!force && (this.syncing || this.syncTasks.size === 0)) {
|
|
14817
14230
|
return;
|
|
14818
14231
|
}
|
|
14819
14232
|
this.syncing = true;
|
|
14820
14233
|
// bounds changed, need re-inserting its children
|
|
14821
14234
|
var bulk = [];
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
}
|
|
14830
|
-
var renderBounds = node.getRenderBounds();
|
|
14831
|
-
if (renderBounds) {
|
|
14832
|
-
var renderable = node.renderable;
|
|
14833
|
-
if (force) {
|
|
14834
|
-
if (!renderable.dirtyRenderBounds) {
|
|
14835
|
-
renderable.dirtyRenderBounds = new AABB();
|
|
14836
|
-
}
|
|
14837
|
-
// save last dirty aabb
|
|
14838
|
-
renderable.dirtyRenderBounds.update(renderBounds.center, renderBounds.halfExtents);
|
|
14839
|
-
}
|
|
14840
|
-
var _a = tslib.__read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
|
|
14841
|
-
var _b = tslib.__read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
|
|
14842
|
-
if (!rBushNode.aabb) {
|
|
14843
|
-
rBushNode.aabb = {};
|
|
14235
|
+
var synced = new Set();
|
|
14236
|
+
var sync = function (node) {
|
|
14237
|
+
if (!synced.has(node) && node.renderable) {
|
|
14238
|
+
var aabb = _this.syncNode(node, force);
|
|
14239
|
+
if (aabb) {
|
|
14240
|
+
bulk.push(aabb);
|
|
14241
|
+
synced.add(node);
|
|
14844
14242
|
}
|
|
14845
|
-
rBushNode.aabb.displayObject = node;
|
|
14846
|
-
rBushNode.aabb.minX = minX;
|
|
14847
|
-
rBushNode.aabb.minY = minY;
|
|
14848
|
-
rBushNode.aabb.maxX = maxX;
|
|
14849
|
-
rBushNode.aabb.maxY = maxY;
|
|
14850
14243
|
}
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
|
|
14857
|
-
|
|
14858
|
-
|
|
14244
|
+
};
|
|
14245
|
+
this.syncTasks.forEach(function (affectChildren, node) {
|
|
14246
|
+
if (affectChildren) {
|
|
14247
|
+
node.forEach(sync);
|
|
14248
|
+
}
|
|
14249
|
+
var parent = node;
|
|
14250
|
+
while (parent) {
|
|
14251
|
+
sync(parent);
|
|
14252
|
+
parent = parent.parentElement;
|
|
14859
14253
|
}
|
|
14860
14254
|
});
|
|
14861
14255
|
// use bulk inserting, which is ~2-3 times faster
|
|
14862
14256
|
// @see https://github.com/mourner/rbush#bulk-inserting-data
|
|
14863
14257
|
this.rBush.load(bulk);
|
|
14864
14258
|
bulk.length = 0;
|
|
14865
|
-
this.toSync.clear();
|
|
14866
14259
|
this.syncing = false;
|
|
14867
14260
|
};
|
|
14868
14261
|
PrepareRendererPlugin.tag = 'Prepare';
|
|
@@ -14919,9 +14312,9 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
14919
14312
|
_this.document.defaultView = _this;
|
|
14920
14313
|
// create registry of custom elements
|
|
14921
14314
|
_this.customElements = new CustomElementRegistry();
|
|
14922
|
-
var container = config.container, canvas = config.canvas, offscreenCanvas = config.offscreenCanvas, width = config.width, height = config.height, devicePixelRatio = config.devicePixelRatio, renderer = config.renderer, background = config.background, cursor = config.cursor, document = config.document, requestAnimationFrame = config.requestAnimationFrame, cancelAnimationFrame = config.cancelAnimationFrame, createImage = config.createImage, supportsPointerEvents = config.supportsPointerEvents, supportsTouchEvents = config.supportsTouchEvents, supportsCSSTransform = config.supportsCSSTransform,
|
|
14315
|
+
var container = config.container, canvas = config.canvas, offscreenCanvas = config.offscreenCanvas, width = config.width, height = config.height, devicePixelRatio = config.devicePixelRatio, renderer = config.renderer, background = config.background, cursor = config.cursor, document = config.document, requestAnimationFrame = config.requestAnimationFrame, cancelAnimationFrame = config.cancelAnimationFrame, createImage = config.createImage, supportsPointerEvents = config.supportsPointerEvents, supportsTouchEvents = config.supportsTouchEvents, supportsCSSTransform = config.supportsCSSTransform, _a = config.cleanUpOnDestroy, cleanUpOnDestroy = _a === void 0 ? true : _a, supportsMutipleCanvasesInOneContainer = config.supportsMutipleCanvasesInOneContainer, useNativeClickEvent = config.useNativeClickEvent, alwaysTriggerPointerEventOnCanvas = config.alwaysTriggerPointerEventOnCanvas, isTouchEvent = config.isTouchEvent, isMouseEvent = config.isMouseEvent, dblClickSpeed = config.dblClickSpeed;
|
|
14923
14316
|
if (!supportsMutipleCanvasesInOneContainer) {
|
|
14924
|
-
cleanExistedCanvas(container, _this,
|
|
14317
|
+
cleanExistedCanvas(container, _this, cleanUpOnDestroy);
|
|
14925
14318
|
}
|
|
14926
14319
|
var canvasWidth = width;
|
|
14927
14320
|
var canvasHeight = height;
|
|
@@ -14982,8 +14375,8 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
14982
14375
|
document: document,
|
|
14983
14376
|
supportsCSSTransform: supportsCSSTransform,
|
|
14984
14377
|
useNativeClickEvent: useNativeClickEvent,
|
|
14378
|
+
cleanUpOnDestroy: cleanUpOnDestroy,
|
|
14985
14379
|
alwaysTriggerPointerEventOnCanvas: alwaysTriggerPointerEventOnCanvas,
|
|
14986
|
-
fastCleanExistingCanvas: fastCleanExistingCanvas,
|
|
14987
14380
|
});
|
|
14988
14381
|
_this.initDefaultCamera(canvasWidth, canvasHeight, renderer.clipSpaceNearZ);
|
|
14989
14382
|
_this.initRenderer(renderer, true);
|
|
@@ -15093,9 +14486,8 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15093
14486
|
*/
|
|
15094
14487
|
Canvas.prototype.destroy = function (cleanUp, skipTriggerEvent) {
|
|
15095
14488
|
if (cleanUp === void 0) { cleanUp = true; }
|
|
15096
|
-
var fastCleanExistingCanvas = this.getConfig().fastCleanExistingCanvas;
|
|
15097
14489
|
if (skipTriggerEvent === undefined)
|
|
15098
|
-
skipTriggerEvent = fastCleanExistingCanvas;
|
|
14490
|
+
skipTriggerEvent = this.getConfig().fastCleanExistingCanvas;
|
|
15099
14491
|
if (!skipTriggerEvent) {
|
|
15100
14492
|
this.dispatchEvent(new CustomEvent(exports.CanvasEvent.BEFORE_DESTROY));
|
|
15101
14493
|
}
|
|
@@ -15108,8 +14500,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15108
14500
|
this.unmountChildren(root);
|
|
15109
14501
|
if (cleanUp) {
|
|
15110
14502
|
// destroy Document
|
|
15111
|
-
|
|
15112
|
-
this.document.destroy();
|
|
14503
|
+
this.document.destroy();
|
|
15113
14504
|
this.getEventService().destroy();
|
|
15114
14505
|
}
|
|
15115
14506
|
// destroy services
|
|
@@ -15122,10 +14513,20 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15122
14513
|
this.context.rBushRoot = null;
|
|
15123
14514
|
this.context.renderingContext.root = null;
|
|
15124
14515
|
}
|
|
15125
|
-
this.destroyed = true;
|
|
15126
14516
|
if (!skipTriggerEvent) {
|
|
15127
14517
|
this.dispatchEvent(new CustomEvent(exports.CanvasEvent.AFTER_DESTROY));
|
|
15128
14518
|
}
|
|
14519
|
+
var clearEventRetain = function (event) {
|
|
14520
|
+
event.currentTarget = null;
|
|
14521
|
+
event.manager = null;
|
|
14522
|
+
event.target = null;
|
|
14523
|
+
};
|
|
14524
|
+
clearEventRetain(mountedEvent);
|
|
14525
|
+
clearEventRetain(unmountedEvent);
|
|
14526
|
+
clearEventRetain(beforeRenderEvent);
|
|
14527
|
+
clearEventRetain(rerenderEvent);
|
|
14528
|
+
clearEventRetain(afterRenderEvent);
|
|
14529
|
+
this.destroyed = true;
|
|
15129
14530
|
};
|
|
15130
14531
|
/**
|
|
15131
14532
|
* compatible with G 3.0
|
|
@@ -15239,13 +14640,13 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15239
14640
|
});
|
|
15240
14641
|
}
|
|
15241
14642
|
};
|
|
15242
|
-
Canvas.prototype.initRenderingService = function (renderer,
|
|
14643
|
+
Canvas.prototype.initRenderingService = function (renderer, firstContentfullPaint, async) {
|
|
15243
14644
|
var _this = this;
|
|
15244
|
-
if (
|
|
14645
|
+
if (firstContentfullPaint === void 0) { firstContentfullPaint = false; }
|
|
15245
14646
|
if (async === void 0) { async = false; }
|
|
15246
14647
|
this.context.renderingService.init(function () {
|
|
15247
14648
|
_this.inited = true;
|
|
15248
|
-
if (
|
|
14649
|
+
if (firstContentfullPaint) {
|
|
15249
14650
|
if (async) {
|
|
15250
14651
|
_this.requestAnimationFrame(function () {
|
|
15251
14652
|
_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));
|
|
@@ -15261,7 +14662,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15261
14662
|
if (_this.readyPromise) {
|
|
15262
14663
|
_this.resolveReadyPromise();
|
|
15263
14664
|
}
|
|
15264
|
-
if (!
|
|
14665
|
+
if (!firstContentfullPaint) {
|
|
15265
14666
|
_this.getRoot().forEach(function (node) {
|
|
15266
14667
|
var renderable = node.renderable;
|
|
15267
14668
|
if (renderable) {
|
|
@@ -15315,7 +14716,7 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15315
14716
|
_this.unmountChildren(child);
|
|
15316
14717
|
});
|
|
15317
14718
|
if (this.inited) {
|
|
15318
|
-
if (!this.getConfig().
|
|
14719
|
+
if (!this.getConfig().cleanUpOnDestroy) {
|
|
15319
14720
|
if (parent.isMutationObserved) {
|
|
15320
14721
|
parent.dispatchEvent(unmountedEvent);
|
|
15321
14722
|
}
|
|
@@ -15337,35 +14738,41 @@ var Canvas = /** @class */ (function (_super) {
|
|
|
15337
14738
|
}
|
|
15338
14739
|
}
|
|
15339
14740
|
};
|
|
15340
|
-
Canvas.prototype.mountChildren = function (
|
|
14741
|
+
Canvas.prototype.mountChildren = function (child, skipTriggerEvent) {
|
|
15341
14742
|
var _this = this;
|
|
14743
|
+
if (skipTriggerEvent === void 0) { skipTriggerEvent = isInFragment(child); }
|
|
15342
14744
|
if (this.inited) {
|
|
15343
|
-
if (!
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
if (
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
14745
|
+
if (!child.isConnected) {
|
|
14746
|
+
child.ownerDocument = this.document;
|
|
14747
|
+
child.isConnected = true;
|
|
14748
|
+
if (!skipTriggerEvent) {
|
|
14749
|
+
if (child.isMutationObserved) {
|
|
14750
|
+
child.dispatchEvent(mountedEvent);
|
|
14751
|
+
}
|
|
14752
|
+
else {
|
|
14753
|
+
mountedEvent.target = child;
|
|
14754
|
+
this.dispatchEvent(mountedEvent, true);
|
|
14755
|
+
}
|
|
15352
14756
|
}
|
|
15353
14757
|
}
|
|
15354
14758
|
}
|
|
15355
14759
|
else {
|
|
15356
|
-
console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ',
|
|
14760
|
+
console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.", 'appended child: ', child.nodeName);
|
|
15357
14761
|
}
|
|
15358
14762
|
// recursively mount children
|
|
15359
|
-
|
|
15360
|
-
_this.mountChildren(
|
|
14763
|
+
child.childNodes.forEach(function (c) {
|
|
14764
|
+
_this.mountChildren(c, skipTriggerEvent);
|
|
15361
14765
|
});
|
|
15362
14766
|
// trigger after mounted
|
|
15363
|
-
if (
|
|
15364
|
-
if (
|
|
15365
|
-
|
|
14767
|
+
if (child.isCustomElement) {
|
|
14768
|
+
if (child.connectedCallback) {
|
|
14769
|
+
child.connectedCallback();
|
|
15366
14770
|
}
|
|
15367
14771
|
}
|
|
15368
14772
|
};
|
|
14773
|
+
Canvas.prototype.mountFragment = function (child) {
|
|
14774
|
+
this.mountChildren(child, false);
|
|
14775
|
+
};
|
|
15369
14776
|
Canvas.prototype.client2Viewport = function (client) {
|
|
15370
14777
|
return this.getEventService().client2Viewport(client);
|
|
15371
14778
|
};
|
|
@@ -15427,6 +14834,7 @@ exports.FederatedEvent = FederatedEvent;
|
|
|
15427
14834
|
exports.FederatedMouseEvent = FederatedMouseEvent;
|
|
15428
14835
|
exports.FederatedPointerEvent = FederatedPointerEvent;
|
|
15429
14836
|
exports.FederatedWheelEvent = FederatedWheelEvent;
|
|
14837
|
+
exports.Fragment = Fragment;
|
|
15430
14838
|
exports.Frustum = Frustum;
|
|
15431
14839
|
exports.Group = Group;
|
|
15432
14840
|
exports.GroupUpdater = GroupUpdater;
|
|
@@ -15472,6 +14880,7 @@ exports.isCSSGradientValue = isCSSGradientValue;
|
|
|
15472
14880
|
exports.isCSSRGB = isCSSRGB;
|
|
15473
14881
|
exports.isCanvas = isCanvas;
|
|
15474
14882
|
exports.isDisplayObject = isDisplayObject;
|
|
14883
|
+
exports.isFederatedEvent = isFederatedEvent;
|
|
15475
14884
|
exports.isFillOrStrokeAffected = isFillOrStrokeAffected;
|
|
15476
14885
|
exports.isPattern = isPattern;
|
|
15477
14886
|
exports.mergeColors = mergeColors;
|