@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/es/dom/Element.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { __extends, __read, __spreadArray } from "tslib";
|
|
2
|
-
import {
|
|
3
|
-
import { container } from '
|
|
2
|
+
import { isNil } from '@antv/util';
|
|
3
|
+
import { container } from '..';
|
|
4
4
|
import { SceneGraphService } from '../services';
|
|
5
5
|
import { Cullable, Geometry, Renderable, Transform, Sortable } from '../components';
|
|
6
6
|
import { Node } from './Node';
|
|
7
|
-
import { KeyframeEffect } from '../KeyframeEffect';
|
|
8
|
-
import { Rectangle } from '../shapes';
|
|
9
7
|
/**
|
|
10
|
-
* events for
|
|
8
|
+
* built-in events for element
|
|
11
9
|
*/
|
|
12
10
|
|
|
13
|
-
export var
|
|
11
|
+
export var ElementEvent;
|
|
14
12
|
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
DISPLAY_OBJECT_EVENT["AttributeChanged"] = "attributeChanged";
|
|
13
|
+
(function (ElementEvent) {
|
|
14
|
+
ElementEvent["DESTROY"] = "destroy";
|
|
15
|
+
ElementEvent["ATTRIBUTE_CHANGED"] = "attribute-changed";
|
|
19
16
|
/**
|
|
20
17
|
* it has been inserted
|
|
21
18
|
*/
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
ElementEvent["INSERTED"] = "inserted";
|
|
24
21
|
/**
|
|
25
22
|
* it has had a child inserted
|
|
26
23
|
*/
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
ElementEvent["CHILD_INSERTED"] = "child-inserted";
|
|
29
26
|
/**
|
|
30
27
|
* it has been removed
|
|
31
28
|
*/
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
ElementEvent["REMOVED"] = "removed";
|
|
34
31
|
/**
|
|
35
32
|
* it has had a child removed
|
|
36
33
|
*/
|
|
37
34
|
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
ElementEvent["CHILD_REMOVED"] = "child-removed";
|
|
36
|
+
ElementEvent["MOUNTED"] = "mounted";
|
|
37
|
+
ElementEvent["UNMOUNTED"] = "unmounted";
|
|
38
|
+
ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
|
|
39
|
+
})(ElementEvent || (ElementEvent = {}));
|
|
40
40
|
/**
|
|
41
41
|
* Has following capabilities:
|
|
42
42
|
* * Node insert/remove, eg. appendChild, removeChild, remove...
|
|
@@ -48,15 +48,17 @@ export var DISPLAY_OBJECT_EVENT;
|
|
|
48
48
|
var Element = function (_super) {
|
|
49
49
|
__extends(Element, _super);
|
|
50
50
|
|
|
51
|
-
function Element() {
|
|
51
|
+
function Element(config) {
|
|
52
52
|
var _this = _super.call(this) || this;
|
|
53
|
+
|
|
54
|
+
_this.sceneGraphService = container.get(SceneGraphService);
|
|
55
|
+
_this.scrollLeft = 0;
|
|
56
|
+
_this.scrollTop = 0;
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
58
|
+
* is destroyed or not
|
|
55
59
|
*/
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
_this.activeAnimations = [];
|
|
59
|
-
_this.sceneGraphService = container.get(SceneGraphService);
|
|
61
|
+
_this.destroyed = false;
|
|
60
62
|
/**
|
|
61
63
|
* compatible with `style`
|
|
62
64
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
@@ -68,12 +70,7 @@ var Element = function (_super) {
|
|
|
68
70
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
69
71
|
*/
|
|
70
72
|
|
|
71
|
-
_this.attributes = {};
|
|
72
|
-
/**
|
|
73
|
-
* is destroyed or not
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
_this.destroyed = false; // create entity with shape's name, unique ID
|
|
73
|
+
_this.attributes = {}; // create entity with shape's name, unique ID
|
|
77
74
|
|
|
78
75
|
var entity = _this.entity;
|
|
79
76
|
entity.addComponent(Renderable);
|
|
@@ -84,6 +81,10 @@ var Element = function (_super) {
|
|
|
84
81
|
return _this;
|
|
85
82
|
}
|
|
86
83
|
|
|
84
|
+
Element.isElement = function (target) {
|
|
85
|
+
return !!target.getAttribute;
|
|
86
|
+
};
|
|
87
|
+
|
|
87
88
|
Object.defineProperty(Element.prototype, "classList", {
|
|
88
89
|
/**
|
|
89
90
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
|
|
@@ -94,38 +95,133 @@ var Element = function (_super) {
|
|
|
94
95
|
enumerable: false,
|
|
95
96
|
configurable: true
|
|
96
97
|
});
|
|
98
|
+
Object.defineProperty(Element.prototype, "tagName", {
|
|
99
|
+
get: function get() {
|
|
100
|
+
return this.nodeName;
|
|
101
|
+
},
|
|
102
|
+
enumerable: false,
|
|
103
|
+
configurable: true
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(Element.prototype, "children", {
|
|
106
|
+
get: function get() {
|
|
107
|
+
return this.childNodes;
|
|
108
|
+
},
|
|
109
|
+
enumerable: false,
|
|
110
|
+
configurable: true
|
|
111
|
+
});
|
|
112
|
+
Object.defineProperty(Element.prototype, "childElementCount", {
|
|
113
|
+
get: function get() {
|
|
114
|
+
return this.childNodes.length;
|
|
115
|
+
},
|
|
116
|
+
enumerable: false,
|
|
117
|
+
configurable: true
|
|
118
|
+
});
|
|
119
|
+
Object.defineProperty(Element.prototype, "firstElementChild", {
|
|
120
|
+
get: function get() {
|
|
121
|
+
return this.firstChild;
|
|
122
|
+
},
|
|
123
|
+
enumerable: false,
|
|
124
|
+
configurable: true
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(Element.prototype, "lastElementChild", {
|
|
127
|
+
get: function get() {
|
|
128
|
+
return this.lastChild;
|
|
129
|
+
},
|
|
130
|
+
enumerable: false,
|
|
131
|
+
configurable: true
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(Element.prototype, "parentElement", {
|
|
134
|
+
get: function get() {
|
|
135
|
+
return this.parentNode;
|
|
136
|
+
},
|
|
137
|
+
enumerable: false,
|
|
138
|
+
configurable: true
|
|
139
|
+
});
|
|
140
|
+
Object.defineProperty(Element.prototype, "nextSibling", {
|
|
141
|
+
get: function get() {
|
|
142
|
+
if (this.parentNode) {
|
|
143
|
+
var index = this.parentNode.childNodes.indexOf(this);
|
|
144
|
+
return this.parentNode.childNodes[index + 1] || null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return null;
|
|
148
|
+
},
|
|
149
|
+
enumerable: false,
|
|
150
|
+
configurable: true
|
|
151
|
+
});
|
|
152
|
+
Object.defineProperty(Element.prototype, "previousSibling", {
|
|
153
|
+
get: function get() {
|
|
154
|
+
if (this.parentNode) {
|
|
155
|
+
var index = this.parentNode.childNodes.indexOf(this);
|
|
156
|
+
return this.parentNode.childNodes[index - 1] || null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return null;
|
|
160
|
+
},
|
|
161
|
+
enumerable: false,
|
|
162
|
+
configurable: true
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
Element.prototype.cloneNode = function (deep) {
|
|
166
|
+
throw new Error('Method not implemented.');
|
|
167
|
+
};
|
|
97
168
|
|
|
98
169
|
Element.prototype.appendChild = function (child, index) {
|
|
99
170
|
this.sceneGraphService.attach(child, this, index);
|
|
100
|
-
this.
|
|
101
|
-
|
|
171
|
+
this.emit(ElementEvent.CHILD_INSERTED, {
|
|
172
|
+
child: child
|
|
173
|
+
});
|
|
174
|
+
child.emit(ElementEvent.INSERTED, {
|
|
175
|
+
parent: this
|
|
176
|
+
});
|
|
102
177
|
return child;
|
|
103
178
|
};
|
|
104
179
|
|
|
105
|
-
Element.prototype.insertBefore = function (
|
|
106
|
-
if (!
|
|
107
|
-
this.appendChild(
|
|
180
|
+
Element.prototype.insertBefore = function (newChild, refChild) {
|
|
181
|
+
if (!refChild) {
|
|
182
|
+
this.appendChild(newChild);
|
|
108
183
|
} else {
|
|
109
|
-
var index = this.childNodes.indexOf(
|
|
110
|
-
this.appendChild(
|
|
184
|
+
var index = this.childNodes.indexOf(refChild);
|
|
185
|
+
this.appendChild(newChild, index - 1);
|
|
111
186
|
}
|
|
112
187
|
|
|
113
|
-
return
|
|
188
|
+
return newChild;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
Element.prototype.replaceChild = function (newChild, oldChild, destroy) {
|
|
192
|
+
var index = this.childNodes.indexOf(oldChild);
|
|
193
|
+
this.removeChild(oldChild, destroy);
|
|
194
|
+
this.appendChild(newChild, index);
|
|
195
|
+
return oldChild;
|
|
114
196
|
};
|
|
115
197
|
|
|
116
198
|
Element.prototype.removeChild = function (child, destroy) {
|
|
117
199
|
if (destroy === void 0) {
|
|
118
200
|
destroy = true;
|
|
119
|
-
}
|
|
201
|
+
} // should emit on itself before detach
|
|
202
|
+
|
|
120
203
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
204
|
+
child.emit(ElementEvent.REMOVED, {
|
|
205
|
+
parent: this
|
|
206
|
+
}); // emit destroy event
|
|
124
207
|
|
|
125
208
|
if (destroy) {
|
|
126
|
-
child.
|
|
127
|
-
|
|
128
|
-
|
|
209
|
+
child.emit(ElementEvent.DESTROY, {});
|
|
210
|
+
child.destroyed = true;
|
|
211
|
+
} // emit on parent
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
this.emit(ElementEvent.CHILD_REMOVED, {
|
|
215
|
+
child: child
|
|
216
|
+
}); // remove from scene graph
|
|
217
|
+
|
|
218
|
+
this.sceneGraphService.detach(child); // cannot emit Destroy event now
|
|
219
|
+
|
|
220
|
+
if (destroy) {
|
|
221
|
+
// this.removeChildren();
|
|
222
|
+
child.entity.destroy(); // remove event listeners
|
|
223
|
+
|
|
224
|
+
child.emitter.removeAllListeners();
|
|
129
225
|
}
|
|
130
226
|
|
|
131
227
|
return child;
|
|
@@ -142,41 +238,11 @@ var Element = function (_super) {
|
|
|
142
238
|
_this.removeChild(child, destroy);
|
|
143
239
|
});
|
|
144
240
|
};
|
|
145
|
-
|
|
146
|
-
Object.defineProperty(Element.prototype, "children", {
|
|
147
|
-
get: function get() {
|
|
148
|
-
return this.childNodes;
|
|
149
|
-
},
|
|
150
|
-
enumerable: false,
|
|
151
|
-
configurable: true
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(Element.prototype, "childElementCount", {
|
|
154
|
-
get: function get() {
|
|
155
|
-
return this.childNodes.length;
|
|
156
|
-
},
|
|
157
|
-
enumerable: false,
|
|
158
|
-
configurable: true
|
|
159
|
-
});
|
|
160
|
-
Object.defineProperty(Element.prototype, "firstElementChild", {
|
|
161
|
-
get: function get() {
|
|
162
|
-
// To avoid the issue with node.firstChild returning #text or #comment nodes,
|
|
163
|
-
// ParentNode.firstElementChild can be used to return only the first element node.
|
|
164
|
-
return this.firstChild;
|
|
165
|
-
},
|
|
166
|
-
enumerable: false,
|
|
167
|
-
configurable: true
|
|
168
|
-
});
|
|
169
|
-
Object.defineProperty(Element.prototype, "lastElementChild", {
|
|
170
|
-
get: function get() {
|
|
171
|
-
return this.lastChild;
|
|
172
|
-
},
|
|
173
|
-
enumerable: false,
|
|
174
|
-
configurable: true
|
|
175
|
-
});
|
|
176
241
|
/**
|
|
177
242
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
178
243
|
*/
|
|
179
244
|
|
|
245
|
+
|
|
180
246
|
Element.prototype.matches = function (selector) {
|
|
181
247
|
return this.sceneGraphService.matches(selector, this);
|
|
182
248
|
};
|
|
@@ -197,24 +263,12 @@ var Element = function (_super) {
|
|
|
197
263
|
return this.sceneGraphService.querySelectorAll(tagName, this);
|
|
198
264
|
};
|
|
199
265
|
|
|
200
|
-
Element.prototype.querySelector = function (
|
|
201
|
-
return this.sceneGraphService.querySelector(
|
|
266
|
+
Element.prototype.querySelector = function (selectors) {
|
|
267
|
+
return this.sceneGraphService.querySelector(selectors, this);
|
|
202
268
|
};
|
|
203
269
|
|
|
204
|
-
Element.prototype.querySelectorAll = function (
|
|
205
|
-
return this.sceneGraphService.querySelectorAll(
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* traverse in descendants
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
Element.prototype.forEach = function (callback) {
|
|
213
|
-
if (!callback(this)) {
|
|
214
|
-
this.childNodes.forEach(function (child) {
|
|
215
|
-
child.forEach(callback);
|
|
216
|
-
});
|
|
217
|
-
}
|
|
270
|
+
Element.prototype.querySelectorAll = function (selectors) {
|
|
271
|
+
return this.sceneGraphService.querySelectorAll(selectors, this);
|
|
218
272
|
};
|
|
219
273
|
/**
|
|
220
274
|
* search in scene group, but should not include itself
|
|
@@ -247,47 +301,6 @@ var Element = function (_super) {
|
|
|
247
301
|
});
|
|
248
302
|
return objects;
|
|
249
303
|
};
|
|
250
|
-
/**
|
|
251
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
Element.prototype.getAttribute = function (attributeName) {
|
|
256
|
-
var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
257
|
-
|
|
258
|
-
return isNil(value) ? undefined : value;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* 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.
|
|
262
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
Element.prototype.removeAttribute = function (attributeName) {
|
|
267
|
-
delete this.attributes[attributeName];
|
|
268
|
-
};
|
|
269
|
-
/**
|
|
270
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
275
|
-
if (force === void 0) {
|
|
276
|
-
force = false;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (force || !isEqual(value, this.attributes[attributeName]) || attributeName === 'visibility' // will affect children
|
|
280
|
-
) {
|
|
281
|
-
if (attributeName === 'visibility') {
|
|
282
|
-
// set value cascade
|
|
283
|
-
this.forEach(function (object) {
|
|
284
|
-
object.changeAttribute(attributeName, value);
|
|
285
|
-
});
|
|
286
|
-
} else {
|
|
287
|
-
this.changeAttribute(attributeName, value);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
304
|
/**
|
|
292
305
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
|
|
293
306
|
*/
|
|
@@ -419,67 +432,25 @@ var Element = function (_super) {
|
|
|
419
432
|
|
|
420
433
|
return this;
|
|
421
434
|
};
|
|
422
|
-
/**
|
|
423
|
-
* @override
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
Element.prototype.changeAttribute = function (name, value) {
|
|
428
|
-
throw new Error('Method not implemented.');
|
|
429
|
-
};
|
|
430
435
|
|
|
431
436
|
Element.prototype.destroy = function () {
|
|
432
|
-
//
|
|
433
|
-
this.
|
|
437
|
+
// destroy itself before remove
|
|
438
|
+
this.emit(ElementEvent.DESTROY, {}); // remove from scenegraph first
|
|
434
439
|
|
|
435
|
-
this.
|
|
440
|
+
this.remove(false);
|
|
436
441
|
this.entity.destroy(); // remove event listeners
|
|
437
442
|
|
|
438
|
-
this.emitter.removeAllListeners();
|
|
439
|
-
|
|
440
|
-
this.getAnimations().forEach(function (animation) {
|
|
441
|
-
animation.cancel();
|
|
442
|
-
});
|
|
443
|
+
this.emitter.removeAllListeners();
|
|
443
444
|
this.destroyed = true;
|
|
444
445
|
};
|
|
445
|
-
/**
|
|
446
|
-
* returns an array of all Animation objects affecting this element
|
|
447
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAnimations
|
|
448
|
-
*/
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
Element.prototype.getAnimations = function () {
|
|
452
|
-
return this.activeAnimations;
|
|
453
|
-
};
|
|
454
|
-
/**
|
|
455
|
-
* create an animation with WAAPI
|
|
456
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/animate
|
|
457
|
-
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
Element.prototype.animate = function (keyframes, options) {
|
|
461
|
-
var _a, _b;
|
|
462
|
-
|
|
463
|
-
var timeline = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.timeline; // accounte for clip path, use target's timeline
|
|
464
|
-
|
|
465
|
-
if (this.attributes.clipPathTargets && this.attributes.clipPathTargets.length) {
|
|
466
|
-
var target = this.attributes.clipPathTargets[0];
|
|
467
|
-
timeline = (_b = target.ownerDocument) === null || _b === void 0 ? void 0 : _b.timeline;
|
|
468
|
-
} // clear old parsed transform
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
this.parsedStyle.transform = undefined;
|
|
472
|
-
|
|
473
|
-
if (timeline) {
|
|
474
|
-
return timeline.play(new KeyframeEffect(this, keyframes, options));
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
return null;
|
|
478
|
-
};
|
|
479
446
|
|
|
480
447
|
Element.prototype.getGeometryBounds = function () {
|
|
481
448
|
return this.sceneGraphService.getGeometryBounds(this);
|
|
482
449
|
};
|
|
450
|
+
|
|
451
|
+
Element.prototype.getRenderBounds = function () {
|
|
452
|
+
return this.sceneGraphService.getBounds(this, true);
|
|
453
|
+
};
|
|
483
454
|
/**
|
|
484
455
|
* get bounds in world space, account for children
|
|
485
456
|
*/
|
|
@@ -504,33 +475,46 @@ var Element = function (_super) {
|
|
|
504
475
|
|
|
505
476
|
|
|
506
477
|
Element.prototype.getBoundingClientRect = function () {
|
|
507
|
-
|
|
478
|
+
return this.sceneGraphService.getBoundingClientRect(this);
|
|
479
|
+
};
|
|
480
|
+
/**
|
|
481
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/getClientRects
|
|
482
|
+
*/
|
|
508
483
|
|
|
509
|
-
var bounds = this.sceneGraphService.getGeometryBounds(this);
|
|
510
484
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
485
|
+
Element.prototype.getClientRects = function () {
|
|
486
|
+
return [this.getBoundingClientRect()];
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
490
|
+
*/
|
|
514
491
|
|
|
515
|
-
var _c = __read(bounds.getMin(), 2),
|
|
516
|
-
left = _c[0],
|
|
517
|
-
top = _c[1];
|
|
518
492
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
bottom = _d[1]; // calc context's offset
|
|
493
|
+
Element.prototype.getAttribute = function (attributeName) {
|
|
494
|
+
var value = this.attributes[attributeName]; // if the given attribute does not exist, the value returned will either be null or ""
|
|
522
495
|
|
|
496
|
+
return isNil(value) ? undefined : value;
|
|
497
|
+
};
|
|
498
|
+
/**
|
|
499
|
+
* 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.
|
|
500
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
|
|
501
|
+
*/
|
|
523
502
|
|
|
524
|
-
|
|
525
|
-
|
|
503
|
+
|
|
504
|
+
Element.prototype.removeAttribute = function (attributeName) {
|
|
505
|
+
delete this.attributes[attributeName];
|
|
526
506
|
};
|
|
527
507
|
/**
|
|
528
|
-
* @see https://developer.mozilla.org/
|
|
508
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute
|
|
529
509
|
*/
|
|
530
510
|
|
|
531
511
|
|
|
532
|
-
Element.prototype.
|
|
533
|
-
|
|
512
|
+
Element.prototype.setAttribute = function (attributeName, value, force) {
|
|
513
|
+
if (force === void 0) {
|
|
514
|
+
force = false;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
this.attributes[attributeName] = value;
|
|
534
518
|
};
|
|
535
519
|
|
|
536
520
|
return Element;
|
package/es/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/es/dom/EventTarget.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { isBoolean, isFunction, isObject } from '@antv/util';
|
|
3
3
|
import { EventEmitter } from 'eventemitter3';
|
|
4
|
-
import { world } from '
|
|
4
|
+
import { world } from '..';
|
|
5
|
+
import { CustomEvent } from './CustomEvent';
|
|
5
6
|
import { FederatedEvent } from './FederatedEvent';
|
|
6
|
-
|
|
7
|
-
import { CustomEvent } from '../CustomEvent';
|
|
7
|
+
export var DELEGATION_SPLITTER = ':';
|
|
8
8
|
/**
|
|
9
9
|
* Objects that can receive events and may have listeners for them.
|
|
10
10
|
* eg. Element, Canvas, DisplayObject
|
|
@@ -21,6 +21,10 @@ var EventTarget = function () {
|
|
|
21
21
|
var entity = world.createEntity();
|
|
22
22
|
this.entity = entity;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated
|
|
26
|
+
*/
|
|
27
|
+
|
|
24
28
|
|
|
25
29
|
EventTarget.prototype.getEntity = function () {
|
|
26
30
|
return this.entity;
|
|
@@ -104,6 +108,8 @@ var EventTarget = function () {
|
|
|
104
108
|
// remove all listeners
|
|
105
109
|
this.removeAllEventListeners();
|
|
106
110
|
}
|
|
111
|
+
|
|
112
|
+
return this;
|
|
107
113
|
};
|
|
108
114
|
|
|
109
115
|
EventTarget.prototype.removeAllEventListeners = function () {
|
|
@@ -116,6 +122,7 @@ var EventTarget = function () {
|
|
|
116
122
|
type = capture ? type + "capture" : type;
|
|
117
123
|
listener = isFunction(listener) ? listener : listener.handleEvent;
|
|
118
124
|
this.emitter.off(type, listener, context);
|
|
125
|
+
return this;
|
|
119
126
|
};
|
|
120
127
|
/**
|
|
121
128
|
* @deprecated
|
|
@@ -138,7 +145,8 @@ var EventTarget = function () {
|
|
|
138
145
|
throw new Error('DisplayObject cannot propagate events outside of the Federated Events API');
|
|
139
146
|
}
|
|
140
147
|
|
|
141
|
-
var document =
|
|
148
|
+
var document = // @ts-ignore
|
|
149
|
+
this.ownerDocument || this.document; // assign event manager
|
|
142
150
|
|
|
143
151
|
if (document) {
|
|
144
152
|
e.manager = ((_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.getEventService()) || null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Point } from '../shapes/Point';
|
|
2
2
|
import type { EventService } from '../services';
|
|
3
|
-
import {
|
|
3
|
+
import { IEventTarget } from './interfaces';
|
|
4
4
|
/**
|
|
5
5
|
* An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
|
|
6
6
|
* FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
|
|
@@ -28,7 +28,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
28
28
|
* can be used to implement event delegation
|
|
29
29
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/target
|
|
30
30
|
*/
|
|
31
|
-
target:
|
|
31
|
+
target: IEventTarget | null;
|
|
32
32
|
/**
|
|
33
33
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/bubbles
|
|
34
34
|
*/
|
|
@@ -42,7 +42,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
42
42
|
*/
|
|
43
43
|
readonly cancelable = false;
|
|
44
44
|
/** the event target when listeners binded */
|
|
45
|
-
currentTarget:
|
|
45
|
+
currentTarget: IEventTarget | null;
|
|
46
46
|
/** Flags whether the default response of the user agent was prevent through this event. */
|
|
47
47
|
defaultPrevented: boolean;
|
|
48
48
|
/**
|
|
@@ -89,12 +89,20 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
89
89
|
canvas: Point;
|
|
90
90
|
get x(): number;
|
|
91
91
|
get y(): number;
|
|
92
|
+
get canvasX(): number;
|
|
93
|
+
get canvasY(): number;
|
|
94
|
+
/**
|
|
95
|
+
* relative to Viewport, account for Camera
|
|
96
|
+
*/
|
|
97
|
+
viewport: Point;
|
|
98
|
+
get viewportX(): number;
|
|
99
|
+
get viewportY(): number;
|
|
92
100
|
/**
|
|
93
101
|
* The event boundary which manages this event. Propagation can only occur
|
|
94
102
|
* within the boundary's jurisdiction.
|
|
95
103
|
*/
|
|
96
104
|
constructor(manager: EventService | null);
|
|
97
|
-
path:
|
|
105
|
+
path: IEventTarget[];
|
|
98
106
|
/**
|
|
99
107
|
* The propagation path for this event
|
|
100
108
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/composedPath
|
|
@@ -102,11 +110,11 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
102
110
|
* So composedPath()[0] represents the original target.
|
|
103
111
|
* @see https://polymer-library.polymer-project.org/3.0/docs/devguide/events#retargeting
|
|
104
112
|
*/
|
|
105
|
-
composedPath():
|
|
113
|
+
composedPath(): IEventTarget[];
|
|
106
114
|
/**
|
|
107
115
|
* @deprecated
|
|
108
116
|
*/
|
|
109
|
-
get propagationPath():
|
|
117
|
+
get propagationPath(): IEventTarget[];
|
|
110
118
|
/**
|
|
111
119
|
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/preventDefault
|
|
112
120
|
*/
|
|
@@ -128,7 +136,7 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
|
|
|
128
136
|
view: WindowProxy;
|
|
129
137
|
which: number;
|
|
130
138
|
returnValue: boolean;
|
|
131
|
-
srcElement:
|
|
139
|
+
srcElement: IEventTarget;
|
|
132
140
|
readonly composed = false;
|
|
133
141
|
isTrusted: boolean;
|
|
134
142
|
NONE: number;
|