@antv/g 1.0.0-alpha.20 → 1.0.0-alpha.24
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/es/Canvas.d.ts +40 -18
- package/es/Canvas.js +121 -65
- package/es/DisplayObjectPool.d.ts +2 -1
- package/es/DisplayObjectPool.js +4 -0
- package/{lib → es/camera}/Camera.d.ts +6 -3
- package/es/{Camera.js → camera/Camera.js} +22 -16
- package/es/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/es/{Landmark.js → camera/Landmark.js} +1 -1
- package/es/camera/index.d.ts +2 -0
- package/es/camera/index.js +2 -0
- package/es/components/Cullable.js +1 -1
- package/es/components/Geometry.d.ts +8 -1
- package/es/components/Renderable.d.ts +9 -8
- package/es/components/Renderable.js +2 -6
- package/es/components/Sortable.d.ts +6 -2
- package/es/display-objects/Circle.d.ts +2 -3
- package/es/display-objects/Circle.js +2 -5
- package/es/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/es/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{lib → es/display-objects}/DisplayObject.d.ts +136 -141
- package/es/{DisplayObject.js → display-objects/DisplayObject.js} +408 -292
- package/es/display-objects/Ellipse.d.ts +2 -3
- package/es/display-objects/Ellipse.js +2 -5
- package/es/display-objects/Group.d.ts +2 -1
- package/es/display-objects/Group.js +13 -5
- package/es/display-objects/HTML.d.ts +2 -2
- package/es/display-objects/HTML.js +4 -7
- package/es/display-objects/Image.d.ts +2 -2
- package/es/display-objects/Image.js +2 -6
- package/es/display-objects/Line.d.ts +2 -2
- package/es/display-objects/Line.js +8 -8
- package/es/display-objects/Path.d.ts +3 -2
- package/es/display-objects/Path.js +8 -8
- package/es/display-objects/Polygon.d.ts +2 -2
- package/es/display-objects/Polygon.js +2 -6
- package/es/display-objects/Polyline.d.ts +2 -2
- package/es/display-objects/Polyline.js +8 -8
- package/es/display-objects/Rect.d.ts +2 -2
- package/es/display-objects/Rect.js +2 -6
- package/es/display-objects/Text.d.ts +2 -3
- package/es/display-objects/Text.js +8 -7
- package/es/display-objects/index.d.ts +2 -0
- package/es/display-objects/index.js +2 -0
- package/es/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/es/{Animation.js → dom/Animation.js} +2 -3
- package/{lib → es/dom}/AnimationEffectTiming.d.ts +2 -0
- package/es/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -2
- package/es/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/es/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/es/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/es/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/es/dom/CustomElementRegistry.d.ts +15 -0
- package/es/dom/CustomElementRegistry.js +40 -0
- package/{lib → es/dom}/CustomEvent.d.ts +1 -1
- package/es/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/es/dom/Document.d.ts +36 -17
- package/es/dom/Document.js +98 -14
- package/es/dom/Element.d.ts +71 -92
- package/es/dom/Element.js +179 -195
- package/es/dom/EventTarget.d.ts +11 -6
- package/es/dom/EventTarget.js +12 -4
- package/es/dom/FederatedEvent.d.ts +15 -7
- package/es/dom/FederatedEvent.js +33 -0
- package/es/dom/FederatedMouseEvent.d.ts +1 -1
- package/es/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/es/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/es/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/es/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/es/dom/Node.d.ts +38 -23
- package/es/dom/Node.js +37 -33
- package/es/dom/index.d.ts +15 -2
- package/es/dom/index.js +16 -3
- package/es/dom/interfaces.d.ts +301 -0
- package/es/dom/interfaces.js +1 -0
- package/es/global-module.d.ts +0 -2
- package/es/global-module.js +31 -29
- package/es/index.d.ts +7 -14
- package/es/index.js +8 -15
- package/es/plugins/CullingPlugin.d.ts +2 -2
- package/es/plugins/CullingPlugin.js +13 -16
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +8 -7
- package/es/plugins/EventPlugin.js +52 -31
- package/es/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/es/plugins/FrustumCullingStrategy.js +5 -4
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +42 -38
- package/es/property-handlers/aabb.d.ts +2 -3
- package/es/property-handlers/aabb.js +29 -21
- package/es/property-handlers/anchor.d.ts +3 -0
- package/es/property-handlers/anchor.js +21 -0
- package/es/property-handlers/clipPath.d.ts +1 -1
- package/es/property-handlers/clipPath.js +3 -4
- package/es/property-handlers/color.d.ts +1 -1
- package/es/property-handlers/dimension.d.ts +1 -1
- package/es/property-handlers/dimension.js +6 -9
- package/es/property-handlers/filter.d.ts +1 -1
- package/es/property-handlers/index.d.ts +5 -4
- package/es/property-handlers/index.js +1 -0
- package/es/property-handlers/localPosition.d.ts +1 -1
- package/es/property-handlers/localPosition.js +1 -6
- package/es/property-handlers/offsetDistance.d.ts +1 -1
- package/es/property-handlers/offsetPath.d.ts +1 -1
- package/es/property-handlers/origin.d.ts +1 -1
- package/es/property-handlers/origin.js +9 -2
- package/es/property-handlers/path.d.ts +2 -2
- package/es/property-handlers/path.js +8 -4
- package/es/property-handlers/points.d.ts +1 -1
- package/es/property-handlers/transform.d.ts +1 -1
- package/es/property-handlers/zIndex.d.ts +1 -1
- package/es/services/ContextService.d.ts +3 -2
- package/es/services/EventService.d.ts +18 -13
- package/es/services/EventService.js +604 -384
- package/es/services/RenderingContext.d.ts +1 -1
- package/es/services/RenderingService.d.ts +23 -29
- package/es/services/RenderingService.js +63 -54
- package/es/services/SceneGraphSelector.d.ts +7 -7
- package/es/services/SceneGraphSelector.js +10 -6
- package/es/services/SceneGraphService.d.ts +73 -78
- package/es/services/SceneGraphService.js +165 -78
- package/es/services/aabb/PathUpdater.d.ts +1 -1
- package/es/services/aabb/RectUpdater.d.ts +2 -2
- package/es/services/aabb/interfaces.d.ts +1 -1
- package/es/shapes/Point.d.ts +4 -0
- package/es/shapes/Polygon.d.ts +9 -0
- package/es/shapes/Polygon.js +62 -0
- package/es/shapes/index.d.ts +1 -0
- package/es/shapes/index.js +2 -1
- package/es/types.d.ts +18 -6
- package/es/utils/animation.d.ts +1 -2
- package/es/utils/animation.js +5 -10
- package/es/utils/canvas.d.ts +1 -1
- package/es/utils/custom-easing.d.ts +3 -2
- package/es/utils/custom-easing.js +12 -6
- package/es/utils/event.js +1 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/interpolation.d.ts +3 -4
- package/es/utils/interpolation.js +0 -16
- package/es/utils/path.d.ts +2 -2
- package/lib/Canvas.d.ts +40 -18
- package/lib/Canvas.js +131 -74
- package/lib/DisplayObjectPool.d.ts +2 -1
- package/lib/DisplayObjectPool.js +4 -0
- package/{es → lib/camera}/Camera.d.ts +6 -3
- package/lib/{Camera.js → camera/Camera.js} +25 -20
- package/lib/{Landmark.d.ts → camera/Landmark.d.ts} +2 -2
- package/lib/{Landmark.js → camera/Landmark.js} +2 -3
- package/lib/camera/index.d.ts +2 -0
- package/lib/camera/index.js +31 -0
- package/lib/components/Cullable.js +1 -1
- package/lib/components/Geometry.d.ts +8 -1
- package/lib/components/Renderable.d.ts +9 -8
- package/lib/components/Renderable.js +2 -6
- package/lib/components/Sortable.d.ts +6 -2
- package/lib/display-objects/Circle.d.ts +2 -3
- package/lib/display-objects/Circle.js +3 -6
- package/lib/{CustomElement.d.ts → display-objects/CustomElement.d.ts} +1 -1
- package/lib/{CustomElement.js → display-objects/CustomElement.js} +22 -12
- package/{es → lib/display-objects}/DisplayObject.d.ts +136 -141
- package/lib/{DisplayObject.js → display-objects/DisplayObject.js} +418 -299
- package/lib/display-objects/Ellipse.d.ts +2 -3
- package/lib/display-objects/Ellipse.js +3 -6
- package/lib/display-objects/Group.d.ts +2 -1
- package/lib/display-objects/Group.js +12 -4
- package/lib/display-objects/HTML.d.ts +2 -2
- package/lib/display-objects/HTML.js +4 -7
- package/lib/display-objects/Image.d.ts +2 -2
- package/lib/display-objects/Image.js +2 -6
- package/lib/display-objects/Line.d.ts +2 -2
- package/lib/display-objects/Line.js +8 -8
- package/lib/display-objects/Path.d.ts +3 -2
- package/lib/display-objects/Path.js +8 -8
- package/lib/display-objects/Polygon.d.ts +2 -2
- package/lib/display-objects/Polygon.js +2 -6
- package/lib/display-objects/Polyline.d.ts +2 -2
- package/lib/display-objects/Polyline.js +8 -8
- package/lib/display-objects/Rect.d.ts +2 -2
- package/lib/display-objects/Rect.js +2 -6
- package/lib/display-objects/Text.d.ts +2 -3
- package/lib/display-objects/Text.js +9 -8
- package/lib/display-objects/index.d.ts +2 -0
- package/lib/display-objects/index.js +26 -0
- package/lib/{Animation.d.ts → dom/Animation.d.ts} +3 -3
- package/lib/{Animation.js → dom/Animation.js} +2 -3
- package/{es → lib/dom}/AnimationEffectTiming.d.ts +2 -0
- package/lib/{AnimationEffectTiming.js → dom/AnimationEffectTiming.js} +3 -3
- package/lib/{AnimationEvent.d.ts → dom/AnimationEvent.d.ts} +3 -2
- package/lib/{AnimationEvent.js → dom/AnimationEvent.js} +1 -1
- package/lib/{Timeline.d.ts → dom/AnimationTimeline.d.ts} +1 -1
- package/lib/{Timeline.js → dom/AnimationTimeline.js} +1 -1
- package/lib/dom/CustomElementRegistry.d.ts +15 -0
- package/lib/dom/CustomElementRegistry.js +48 -0
- package/{es → lib/dom}/CustomEvent.d.ts +1 -1
- package/lib/{CustomEvent.js → dom/CustomEvent.js} +1 -1
- package/lib/dom/Document.d.ts +36 -17
- package/lib/dom/Document.js +99 -15
- package/lib/dom/Element.d.ts +71 -92
- package/lib/dom/Element.js +180 -198
- package/lib/dom/EventTarget.d.ts +11 -6
- package/lib/dom/EventTarget.js +20 -10
- package/lib/dom/FederatedEvent.d.ts +15 -7
- package/lib/dom/FederatedEvent.js +33 -0
- package/lib/dom/FederatedMouseEvent.d.ts +1 -1
- package/lib/{KeyframeEffect.d.ts → dom/KeyframeEffect.d.ts} +16 -5
- package/lib/{KeyframeEffect.js → dom/KeyframeEffect.js} +50 -4
- package/lib/{KeyframeList.d.ts → dom/KeyframeList.d.ts} +1 -1
- package/lib/{KeyframeList.js → dom/KeyframeList.js} +0 -0
- package/lib/dom/Node.d.ts +38 -23
- package/lib/dom/Node.js +37 -33
- package/lib/dom/index.d.ts +15 -2
- package/lib/dom/index.js +177 -8
- package/lib/dom/interfaces.d.ts +301 -0
- package/lib/dom/interfaces.js +5 -0
- package/lib/global-module.d.ts +0 -2
- package/lib/global-module.js +30 -30
- package/lib/index.d.ts +7 -14
- package/lib/index.js +44 -135
- package/lib/plugins/CullingPlugin.d.ts +2 -2
- package/lib/plugins/CullingPlugin.js +14 -16
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +9 -7
- package/lib/plugins/EventPlugin.js +52 -30
- package/lib/plugins/FrustumCullingStrategy.d.ts +1 -1
- package/lib/plugins/FrustumCullingStrategy.js +5 -4
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +41 -37
- package/lib/property-handlers/aabb.d.ts +2 -3
- package/lib/property-handlers/aabb.js +28 -22
- package/lib/property-handlers/anchor.d.ts +3 -0
- package/lib/property-handlers/anchor.js +34 -0
- package/lib/property-handlers/clipPath.d.ts +1 -1
- package/lib/property-handlers/clipPath.js +3 -4
- package/lib/property-handlers/color.d.ts +1 -1
- package/lib/property-handlers/dimension.d.ts +1 -1
- package/lib/property-handlers/dimension.js +6 -9
- package/lib/property-handlers/filter.d.ts +1 -1
- package/lib/property-handlers/index.d.ts +5 -4
- package/lib/property-handlers/index.js +14 -0
- package/lib/property-handlers/localPosition.d.ts +1 -1
- package/lib/property-handlers/localPosition.js +1 -7
- package/lib/property-handlers/offsetDistance.d.ts +1 -1
- package/lib/property-handlers/offsetPath.d.ts +1 -1
- package/lib/property-handlers/origin.d.ts +1 -1
- package/lib/property-handlers/origin.js +10 -2
- package/lib/property-handlers/path.d.ts +2 -2
- package/lib/property-handlers/path.js +8 -4
- package/lib/property-handlers/points.d.ts +1 -1
- package/lib/property-handlers/transform.d.ts +1 -1
- package/lib/property-handlers/zIndex.d.ts +1 -1
- package/lib/services/ContextService.d.ts +3 -2
- package/lib/services/EventService.d.ts +18 -13
- package/lib/services/EventService.js +616 -385
- package/lib/services/RenderingContext.d.ts +1 -1
- package/lib/services/RenderingService.d.ts +23 -29
- package/lib/services/RenderingService.js +66 -56
- package/lib/services/SceneGraphSelector.d.ts +7 -7
- package/lib/services/SceneGraphSelector.js +10 -6
- package/lib/services/SceneGraphService.d.ts +73 -78
- package/lib/services/SceneGraphService.js +166 -79
- package/lib/services/aabb/PathUpdater.d.ts +1 -1
- package/lib/services/aabb/RectUpdater.d.ts +2 -2
- package/lib/services/aabb/interfaces.d.ts +1 -1
- package/lib/shapes/Point.d.ts +4 -0
- package/lib/shapes/Polygon.d.ts +9 -0
- package/lib/shapes/Polygon.js +69 -0
- package/lib/shapes/index.d.ts +1 -0
- package/lib/shapes/index.js +13 -0
- package/lib/types.d.ts +18 -6
- package/lib/utils/animation.d.ts +1 -2
- package/lib/utils/animation.js +8 -16
- package/lib/utils/canvas.d.ts +1 -1
- package/lib/utils/custom-easing.d.ts +3 -2
- package/lib/utils/custom-easing.js +16 -8
- package/lib/utils/event.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/interpolation.d.ts +3 -4
- package/lib/utils/interpolation.js +0 -17
- package/lib/utils/path.d.ts +2 -2
- package/package.json +6 -6
- package/es/Batch.d.ts +0 -25
- package/es/Batch.js +0 -82
- package/es/shapes-type.d.ts +0 -175
- package/es/shapes-type.js +0 -18
- package/es/utils/matrix-decompose.d.ts +0 -3
- package/es/utils/matrix-decompose.js +0 -404
- package/lib/Batch.d.ts +0 -25
- package/lib/Batch.js +0 -91
- package/lib/shapes-type.d.ts +0 -175
- package/lib/shapes-type.js +0 -41
- package/lib/utils/matrix-decompose.d.ts +0 -3
- package/lib/utils/matrix-decompose.js +0 -414
package/lib/dom/Element.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Element = exports.
|
|
6
|
+
exports.Element = exports.ElementEvent = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
10
10
|
var _util = require("@antv/util");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _ = require("..");
|
|
13
13
|
|
|
14
14
|
var _services = require("../services");
|
|
15
15
|
|
|
@@ -17,41 +17,39 @@ var _components = require("../components");
|
|
|
17
17
|
|
|
18
18
|
var _Node = require("./Node");
|
|
19
19
|
|
|
20
|
-
var _KeyframeEffect = require("../KeyframeEffect");
|
|
21
|
-
|
|
22
|
-
var _shapes = require("../shapes");
|
|
23
|
-
|
|
24
20
|
/**
|
|
25
|
-
* events for
|
|
21
|
+
* built-in events for element
|
|
26
22
|
*/
|
|
27
|
-
var
|
|
28
|
-
exports.
|
|
23
|
+
var ElementEvent;
|
|
24
|
+
exports.ElementEvent = ElementEvent;
|
|
29
25
|
|
|
30
|
-
(function (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
DISPLAY_OBJECT_EVENT["AttributeChanged"] = "attributeChanged";
|
|
26
|
+
(function (ElementEvent) {
|
|
27
|
+
ElementEvent["DESTROY"] = "destroy";
|
|
28
|
+
ElementEvent["ATTRIBUTE_CHANGED"] = "attribute-changed";
|
|
34
29
|
/**
|
|
35
30
|
* it has been inserted
|
|
36
31
|
*/
|
|
37
32
|
|
|
38
|
-
|
|
33
|
+
ElementEvent["INSERTED"] = "inserted";
|
|
39
34
|
/**
|
|
40
35
|
* it has had a child inserted
|
|
41
36
|
*/
|
|
42
37
|
|
|
43
|
-
|
|
38
|
+
ElementEvent["CHILD_INSERTED"] = "child-inserted";
|
|
44
39
|
/**
|
|
45
40
|
* it has been removed
|
|
46
41
|
*/
|
|
47
42
|
|
|
48
|
-
|
|
43
|
+
ElementEvent["REMOVED"] = "removed";
|
|
49
44
|
/**
|
|
50
45
|
* it has had a child removed
|
|
51
46
|
*/
|
|
52
47
|
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
ElementEvent["CHILD_REMOVED"] = "child-removed";
|
|
49
|
+
ElementEvent["MOUNTED"] = "mounted";
|
|
50
|
+
ElementEvent["UNMOUNTED"] = "unmounted";
|
|
51
|
+
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
|
|
52
|
+
})(ElementEvent || (exports.ElementEvent = ElementEvent = {}));
|
|
55
53
|
/**
|
|
56
54
|
* Has following capabilities:
|
|
57
55
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -63,15 +61,17 @@ exports.DISPLAY_OBJECT_EVENT = DISPLAY_OBJECT_EVENT;
|
|
|
63
61
|
var Element = function (_super) {
|
|
64
62
|
(0, _tslib.__extends)(Element, _super);
|
|
65
63
|
|
|
66
|
-
function Element() {
|
|
64
|
+
function Element(config) {
|
|
67
65
|
var _this = _super.call(this) || this;
|
|
66
|
+
|
|
67
|
+
_this.sceneGraphService = _.container.get(_services.SceneGraphService);
|
|
68
|
+
_this.scrollLeft = 0;
|
|
69
|
+
_this.scrollTop = 0;
|
|
68
70
|
/**
|
|
69
|
-
*
|
|
71
|
+
* is destroyed or not
|
|
70
72
|
*/
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
_this.activeAnimations = [];
|
|
74
|
-
_this.sceneGraphService = _inversify.container.get(_services.SceneGraphService);
|
|
74
|
+
_this.destroyed = false;
|
|
75
75
|
/**
|
|
76
76
|
* compatible with `style`
|
|
77
77
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
@@ -83,12 +83,7 @@ var Element = function (_super) {
|
|
|
83
83
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
|
-
_this.attributes = {};
|
|
87
|
-
/**
|
|
88
|
-
* is destroyed or not
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
_this.destroyed = false; // create entity with shape's name, unique ID
|
|
86
|
+
_this.attributes = {}; // create entity with shape's name, unique ID
|
|
92
87
|
|
|
93
88
|
var entity = _this.entity;
|
|
94
89
|
entity.addComponent(_components.Renderable);
|
|
@@ -99,6 +94,10 @@ var Element = function (_super) {
|
|
|
99
94
|
return _this;
|
|
100
95
|
}
|
|
101
96
|
|
|
97
|
+
Element.isElement = function (target) {
|
|
98
|
+
return !!target.getAttribute;
|
|
99
|
+
};
|
|
100
|
+
|
|
102
101
|
Object.defineProperty(Element.prototype, "classList", {
|
|
103
102
|
/**
|
|
104
103
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
|
|
@@ -109,38 +108,133 @@ var Element = function (_super) {
|
|
|
109
108
|
enumerable: false,
|
|
110
109
|
configurable: true
|
|
111
110
|
});
|
|
111
|
+
Object.defineProperty(Element.prototype, "tagName", {
|
|
112
|
+
get: function get() {
|
|
113
|
+
return this.nodeName;
|
|
114
|
+
},
|
|
115
|
+
enumerable: false,
|
|
116
|
+
configurable: true
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(Element.prototype, "children", {
|
|
119
|
+
get: function get() {
|
|
120
|
+
return this.childNodes;
|
|
121
|
+
},
|
|
122
|
+
enumerable: false,
|
|
123
|
+
configurable: true
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(Element.prototype, "childElementCount", {
|
|
126
|
+
get: function get() {
|
|
127
|
+
return this.childNodes.length;
|
|
128
|
+
},
|
|
129
|
+
enumerable: false,
|
|
130
|
+
configurable: true
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(Element.prototype, "firstElementChild", {
|
|
133
|
+
get: function get() {
|
|
134
|
+
return this.firstChild;
|
|
135
|
+
},
|
|
136
|
+
enumerable: false,
|
|
137
|
+
configurable: true
|
|
138
|
+
});
|
|
139
|
+
Object.defineProperty(Element.prototype, "lastElementChild", {
|
|
140
|
+
get: function get() {
|
|
141
|
+
return this.lastChild;
|
|
142
|
+
},
|
|
143
|
+
enumerable: false,
|
|
144
|
+
configurable: true
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(Element.prototype, "parentElement", {
|
|
147
|
+
get: function get() {
|
|
148
|
+
return this.parentNode;
|
|
149
|
+
},
|
|
150
|
+
enumerable: false,
|
|
151
|
+
configurable: true
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(Element.prototype, "nextSibling", {
|
|
154
|
+
get: function get() {
|
|
155
|
+
if (this.parentNode) {
|
|
156
|
+
var index = this.parentNode.childNodes.indexOf(this);
|
|
157
|
+
return this.parentNode.childNodes[index + 1] || null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return null;
|
|
161
|
+
},
|
|
162
|
+
enumerable: false,
|
|
163
|
+
configurable: true
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(Element.prototype, "previousSibling", {
|
|
166
|
+
get: function get() {
|
|
167
|
+
if (this.parentNode) {
|
|
168
|
+
var index = this.parentNode.childNodes.indexOf(this);
|
|
169
|
+
return this.parentNode.childNodes[index - 1] || null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return null;
|
|
173
|
+
},
|
|
174
|
+
enumerable: false,
|
|
175
|
+
configurable: true
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
Element.prototype.cloneNode = function (deep) {
|
|
179
|
+
throw new Error('Method not implemented.');
|
|
180
|
+
};
|
|
112
181
|
|
|
113
182
|
Element.prototype.appendChild = function (child, index) {
|
|
114
183
|
this.sceneGraphService.attach(child, this, index);
|
|
115
|
-
this.
|
|
116
|
-
|
|
184
|
+
this.emit(ElementEvent.CHILD_INSERTED, {
|
|
185
|
+
child: child
|
|
186
|
+
});
|
|
187
|
+
child.emit(ElementEvent.INSERTED, {
|
|
188
|
+
parent: this
|
|
189
|
+
});
|
|
117
190
|
return child;
|
|
118
191
|
};
|
|
119
192
|
|
|
120
|
-
Element.prototype.insertBefore = function (
|
|
121
|
-
if (!
|
|
122
|
-
this.appendChild(
|
|
193
|
+
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
194
|
+
if (!refChild) {
|
|
195
|
+
this.appendChild(newChild);
|
|
123
196
|
} else {
|
|
124
|
-
var index = this.childNodes.indexOf(
|
|
125
|
-
this.appendChild(
|
|
197
|
+
var index = this.childNodes.indexOf(refChild);
|
|
198
|
+
this.appendChild(newChild, index - 1);
|
|
126
199
|
}
|
|
127
200
|
|
|
128
|
-
return
|
|
201
|
+
return newChild;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
Element.prototype.replaceChild = function (newChild, oldChild, destroy) {
|
|
205
|
+
var index = this.childNodes.indexOf(oldChild);
|
|
206
|
+
this.removeChild(oldChild, destroy);
|
|
207
|
+
this.appendChild(newChild, index);
|
|
208
|
+
return oldChild;
|
|
129
209
|
};
|
|
130
210
|
|
|
131
211
|
Element.prototype.removeChild = function (child, destroy) {
|
|
132
212
|
if (destroy === void 0) {
|
|
133
213
|
destroy = true;
|
|
134
|
-
}
|
|
214
|
+
} // should emit on itself before detach
|
|
215
|
+
|
|
135
216
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
217
|
+
child.emit(ElementEvent.REMOVED, {
|
|
218
|
+
parent: this
|
|
219
|
+
}); // emit destroy event
|
|
139
220
|
|
|
140
221
|
if (destroy) {
|
|
141
|
-
child.
|
|
142
|
-
|
|
143
|
-
|
|
222
|
+
child.emit(ElementEvent.DESTROY, {});
|
|
223
|
+
child.destroyed = true;
|
|
224
|
+
} // emit on parent
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
this.emit(ElementEvent.CHILD_REMOVED, {
|
|
228
|
+
child: child
|
|
229
|
+
}); // remove from scene graph
|
|
230
|
+
|
|
231
|
+
this.sceneGraphService.detach(child); // cannot emit Destroy event now
|
|
232
|
+
|
|
233
|
+
if (destroy) {
|
|
234
|
+
// this.removeChildren();
|
|
235
|
+
child.entity.destroy(); // remove event listeners
|
|
236
|
+
|
|
237
|
+
child.emitter.removeAllListeners();
|
|
144
238
|
}
|
|
145
239
|
|
|
146
240
|
return child;
|
|
@@ -157,41 +251,11 @@ var Element = function (_super) {
|
|
|
157
251
|
_this.removeChild(child, destroy);
|
|
158
252
|
});
|
|
159
253
|
};
|
|
160
|
-
|
|
161
|
-
Object.defineProperty(Element.prototype, "children", {
|
|
162
|
-
get: function get() {
|
|
163
|
-
return this.childNodes;
|
|
164
|
-
},
|
|
165
|
-
enumerable: false,
|
|
166
|
-
configurable: true
|
|
167
|
-
});
|
|
168
|
-
Object.defineProperty(Element.prototype, "childElementCount", {
|
|
169
|
-
get: function get() {
|
|
170
|
-
return this.childNodes.length;
|
|
171
|
-
},
|
|
172
|
-
enumerable: false,
|
|
173
|
-
configurable: true
|
|
174
|
-
});
|
|
175
|
-
Object.defineProperty(Element.prototype, "firstElementChild", {
|
|
176
|
-
get: function get() {
|
|
177
|
-
// To avoid the issue with node.firstChild returning #text or #comment nodes,
|
|
178
|
-
// ParentNode.firstElementChild can be used to return only the first element node.
|
|
179
|
-
return this.firstChild;
|
|
180
|
-
},
|
|
181
|
-
enumerable: false,
|
|
182
|
-
configurable: true
|
|
183
|
-
});
|
|
184
|
-
Object.defineProperty(Element.prototype, "lastElementChild", {
|
|
185
|
-
get: function get() {
|
|
186
|
-
return this.lastChild;
|
|
187
|
-
},
|
|
188
|
-
enumerable: false,
|
|
189
|
-
configurable: true
|
|
190
|
-
});
|
|
191
254
|
/**
|
|
192
255
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
193
256
|
*/
|
|
194
257
|
|
|
258
|
+
|
|
195
259
|
Element.prototype.matches = function (selector) {
|
|
196
260
|
return this.sceneGraphService.matches(selector, this);
|
|
197
261
|
};
|
|
@@ -212,24 +276,12 @@ var Element = function (_super) {
|
|
|
212
276
|
return this.sceneGraphService.querySelectorAll(tagName, this);
|
|
213
277
|
};
|
|
214
278
|
|
|
215
|
-
Element.prototype.querySelector = function (
|
|
216
|
-
return this.sceneGraphService.querySelector(
|
|
279
|
+
Element.prototype.querySelector = function (selectors) {
|
|
280
|
+
return this.sceneGraphService.querySelector(selectors, this);
|
|
217
281
|
};
|
|
218
282
|
|
|
219
|
-
Element.prototype.querySelectorAll = function (
|
|
220
|
-
return this.sceneGraphService.querySelectorAll(
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* traverse in descendants
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
Element.prototype.forEach = function (callback) {
|
|
228
|
-
if (!callback(this)) {
|
|
229
|
-
this.childNodes.forEach(function (child) {
|
|
230
|
-
child.forEach(callback);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
283
|
+
Element.prototype.querySelectorAll = function (selectors) {
|
|
284
|
+
return this.sceneGraphService.querySelectorAll(selectors, this);
|
|
233
285
|
};
|
|
234
286
|
/**
|
|
235
287
|
* search in scene group, but should not include itself
|
|
@@ -262,47 +314,6 @@ var Element = function (_super) {
|
|
|
262
314
|
});
|
|
263
315
|
return objects;
|
|
264
316
|
};
|
|
265
|
-
/**
|
|
266
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
267
|
-
*/
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
Element.prototype.getAttribute = function (attributeName) {
|
|
271
|
-
var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
272
|
-
|
|
273
|
-
return (0, _util.isNil)(value) ? undefined : value;
|
|
274
|
-
};
|
|
275
|
-
/**
|
|
276
|
-
* should use removeAttribute() instead of setting the attribute value to null either directly or using setAttribute(). Many attributes will not behave as expected if you set them to null.
|
|
277
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Element.prototype.removeAttribute = function (attributeName) {
|
|
282
|
-
delete this.attributes[attributeName];
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
286
|
-
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
290
|
-
if (force === void 0) {
|
|
291
|
-
force = false;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (force || !(0, _util.isEqual)(value, this.attributes[attributeName]) || attributeName === 'visibility' // will affect children
|
|
295
|
-
) {
|
|
296
|
-
if (attributeName === 'visibility') {
|
|
297
|
-
// set value cascade
|
|
298
|
-
this.forEach(function (object) {
|
|
299
|
-
object.changeAttribute(attributeName, value);
|
|
300
|
-
});
|
|
301
|
-
} else {
|
|
302
|
-
this.changeAttribute(attributeName, value);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
317
|
/**
|
|
307
318
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
|
|
308
319
|
*/
|
|
@@ -434,67 +445,25 @@ var Element = function (_super) {
|
|
|
434
445
|
|
|
435
446
|
return this;
|
|
436
447
|
};
|
|
437
|
-
/**
|
|
438
|
-
* @override
|
|
439
|
-
*/
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
Element.prototype.changeAttribute = function (name, value) {
|
|
443
|
-
throw new Error('Method not implemented.');
|
|
444
|
-
};
|
|
445
448
|
|
|
446
449
|
Element.prototype.destroy = function () {
|
|
447
|
-
//
|
|
448
|
-
this.
|
|
450
|
+
// destroy itself before remove
|
|
451
|
+
this.emit(ElementEvent.DESTROY, {}); // remove from scenegraph first
|
|
449
452
|
|
|
450
|
-
this.
|
|
453
|
+
this.remove(false);
|
|
451
454
|
this.entity.destroy(); // remove event listeners
|
|
452
455
|
|
|
453
|
-
this.emitter.removeAllListeners();
|
|
454
|
-
|
|
455
|
-
this.getAnimations().forEach(function (animation) {
|
|
456
|
-
animation.cancel();
|
|
457
|
-
});
|
|
456
|
+
this.emitter.removeAllListeners();
|
|
458
457
|
this.destroyed = true;
|
|
459
458
|
};
|
|
460
|
-
/**
|
|
461
|
-
* returns an array of all Animation objects affecting this element
|
|
462
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations
|
|
463
|
-
*/
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
Element.prototype.getAnimations = function () {
|
|
467
|
-
return this.activeAnimations;
|
|
468
|
-
};
|
|
469
|
-
/**
|
|
470
|
-
* create an animation with WAAPI
|
|
471
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
Element.prototype.animate = function (keyframes, options) {
|
|
476
|
-
var _a, _b;
|
|
477
|
-
|
|
478
|
-
var timeline = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.timeline; // accounte for clip path, use target's timeline
|
|
479
|
-
|
|
480
|
-
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
481
|
-
var target = this.attributes.clipPathTargets[0];
|
|
482
|
-
timeline = (_b = target.ownerDocument) === null || _b === void 0 ? void 0 : _b.timeline;
|
|
483
|
-
} // clear old parsed transform
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
this.parsedStyle.transform = undefined;
|
|
487
|
-
|
|
488
|
-
if (timeline) {
|
|
489
|
-
return timeline.play(new _KeyframeEffect.KeyframeEffect(this, keyframes, options));
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
return null;
|
|
493
|
-
};
|
|
494
459
|
|
|
495
460
|
Element.prototype.getGeometryBounds = function () {
|
|
496
461
|
return this.sceneGraphService.getGeometryBounds(this);
|
|
497
462
|
};
|
|
463
|
+
|
|
464
|
+
Element.prototype.getRenderBounds = function () {
|
|
465
|
+
return this.sceneGraphService.getBounds(this, true);
|
|
466
|
+
};
|
|
498
467
|
/**
|
|
499
468
|
* get bounds in world space, account for children
|
|
500
469
|
*/
|
|
@@ -519,33 +488,46 @@ var Element = function (_super) {
|
|
|
519
488
|
|
|
520
489
|
|
|
521
490
|
Element.prototype.getBoundingClientRect = function () {
|
|
522
|
-
|
|
491
|
+
return this.sceneGraphService.getBoundingClientRect(this);
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getClientRects
|
|
495
|
+
*/
|
|
523
496
|
|
|
524
|
-
var bounds = this.sceneGraphService.getGeometryBounds(this);
|
|
525
497
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
498
|
+
Element.prototype.getClientRects = function () {
|
|
499
|
+
return [this.getBoundingClientRect()];
|
|
500
|
+
};
|
|
501
|
+
/**
|
|
502
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
503
|
+
*/
|
|
529
504
|
|
|
530
|
-
var _c = (0, _tslib.__read)(bounds.getMin(), 2),
|
|
531
|
-
left = _c[0],
|
|
532
|
-
top = _c[1];
|
|
533
505
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
bottom = _d[1]; // calc context's offset
|
|
506
|
+
Element.prototype.getAttribute = function (attributeName) {
|
|
507
|
+
var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
537
508
|
|
|
509
|
+
return (0, _util.isNil)(value) ? undefined : value;
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* should use removeAttribute() instead of setting the attribute value to null either directly or using setAttribute(). Many attributes will not behave as expected if you set them to null.
|
|
513
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
514
|
+
*/
|
|
538
515
|
|
|
539
|
-
|
|
540
|
-
|
|
516
|
+
|
|
517
|
+
Element.prototype.removeAttribute = function (attributeName) {
|
|
518
|
+
delete this.attributes[attributeName];
|
|
541
519
|
};
|
|
542
520
|
/**
|
|
543
|
-
* @see https://developer.mozilla.org/
|
|
521
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
544
522
|
*/
|
|
545
523
|
|
|
546
524
|
|
|
547
|
-
Element.prototype.
|
|
548
|
-
|
|
525
|
+
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
526
|
+
if (force === void 0) {
|
|
527
|
+
force = false;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
this.attributes[attributeName] = value;
|
|
549
531
|
};
|
|
550
532
|
|
|
551
533
|
return Element;
|
package/lib/dom/EventTarget.d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { Entity } from '@antv/g-ecs';
|
|
1
|
+
import type { Entity } from '@antv/g-ecs';
|
|
2
2
|
import { FederatedEvent } from './FederatedEvent';
|
|
3
|
+
import type { IEventTarget } from './interfaces';
|
|
4
|
+
export declare const DELEGATION_SPLITTER = ":";
|
|
3
5
|
/**
|
|
4
6
|
* Objects that can receive events and may have listeners for them.
|
|
5
7
|
* eg. Element, Canvas, DisplayObject
|
|
6
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
|
|
7
9
|
*/
|
|
8
|
-
export declare class EventTarget {
|
|
10
|
+
export declare class EventTarget implements IEventTarget {
|
|
9
11
|
/**
|
|
10
12
|
* event emitter
|
|
11
13
|
*/
|
|
12
14
|
emitter: import("eventemitter3")<string | symbol, any>;
|
|
13
|
-
|
|
14
|
-
getEntity(): Entity;
|
|
15
|
+
entity: Entity;
|
|
15
16
|
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
20
|
+
getEntity(): Entity;
|
|
16
21
|
/**
|
|
17
22
|
* @deprecated
|
|
18
23
|
* @alias addEventListener
|
|
@@ -27,9 +32,9 @@ export declare class EventTarget {
|
|
|
27
32
|
* @deprecated
|
|
28
33
|
* @alias removeEventListener
|
|
29
34
|
*/
|
|
30
|
-
off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions):
|
|
35
|
+
off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
|
|
31
36
|
removeAllEventListeners(): void;
|
|
32
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions):
|
|
37
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
|
|
33
38
|
/**
|
|
34
39
|
* @deprecated
|
|
35
40
|
* @alias dispatchEvent
|
package/lib/dom/EventTarget.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.EventTarget = void 0;
|
|
6
|
+
exports.EventTarget = exports.DELEGATION_SPLITTER = void 0;
|
|
7
7
|
|
|
8
8
|
var _tslib = require("tslib");
|
|
9
9
|
|
|
@@ -11,19 +11,21 @@ var _util = require("@antv/util");
|
|
|
11
11
|
|
|
12
12
|
var _eventemitter = require("eventemitter3");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _ = require("..");
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _EventService = require("../services/EventService");
|
|
16
|
+
var _CustomEvent = require("./CustomEvent");
|
|
19
17
|
|
|
20
|
-
var
|
|
18
|
+
var _FederatedEvent = require("./FederatedEvent");
|
|
21
19
|
|
|
20
|
+
var DELEGATION_SPLITTER = ':';
|
|
22
21
|
/**
|
|
23
22
|
* Objects that can receive events and may have listeners for them.
|
|
24
23
|
* eg. Element, Canvas, DisplayObject
|
|
25
24
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
|
|
26
25
|
*/
|
|
26
|
+
|
|
27
|
+
exports.DELEGATION_SPLITTER = DELEGATION_SPLITTER;
|
|
28
|
+
|
|
27
29
|
var EventTarget = function () {
|
|
28
30
|
function EventTarget() {
|
|
29
31
|
/**
|
|
@@ -31,10 +33,14 @@ var EventTarget = function () {
|
|
|
31
33
|
*/
|
|
32
34
|
this.emitter = new _eventemitter.EventEmitter(); // create entity with shape's name, unique ID
|
|
33
35
|
|
|
34
|
-
var entity =
|
|
36
|
+
var entity = _.world.createEntity();
|
|
35
37
|
|
|
36
38
|
this.entity = entity;
|
|
37
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
*/
|
|
43
|
+
|
|
38
44
|
|
|
39
45
|
EventTarget.prototype.getEntity = function () {
|
|
40
46
|
return this.entity;
|
|
@@ -64,8 +70,8 @@ var EventTarget = function () {
|
|
|
64
70
|
var useDelegatedName = false;
|
|
65
71
|
var delegatedName = '';
|
|
66
72
|
|
|
67
|
-
if (type.indexOf(
|
|
68
|
-
var _a = (0, _tslib.__read)(type.split(
|
|
73
|
+
if (type.indexOf(DELEGATION_SPLITTER) > -1) {
|
|
74
|
+
var _a = (0, _tslib.__read)(type.split(DELEGATION_SPLITTER), 2),
|
|
69
75
|
name_1 = _a[0],
|
|
70
76
|
eventType = _a[1];
|
|
71
77
|
|
|
@@ -118,6 +124,8 @@ var EventTarget = function () {
|
|
|
118
124
|
// remove all listeners
|
|
119
125
|
this.removeAllEventListeners();
|
|
120
126
|
}
|
|
127
|
+
|
|
128
|
+
return this;
|
|
121
129
|
};
|
|
122
130
|
|
|
123
131
|
EventTarget.prototype.removeAllEventListeners = function () {
|
|
@@ -130,6 +138,7 @@ var EventTarget = function () {
|
|
|
130
138
|
type = capture ? type + "capture" : type;
|
|
131
139
|
listener = (0, _util.isFunction)(listener) ? listener : listener.handleEvent;
|
|
132
140
|
this.emitter.off(type, listener, context);
|
|
141
|
+
return this;
|
|
133
142
|
};
|
|
134
143
|
/**
|
|
135
144
|
* @deprecated
|
|
@@ -152,7 +161,8 @@ var EventTarget = function () {
|
|
|
152
161
|
throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
|
|
153
162
|
}
|
|
154
163
|
|
|
155
|
-
var document =
|
|
164
|
+
var document = // @ts-ignore
|
|
165
|
+
this.ownerDocument || this.document; // assign event manager
|
|
156
166
|
|
|
157
167
|
if (document) {
|
|
158
168
|
e.manager = ((_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.getEventService()) || null;
|