@antv/g 5.0.22 → 5.0.23-alpha.11
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/index.umd.min.js +3 -3
- package/es/AbstractRenderer.js +5 -0
- package/es/camera/Camera.js +2 -2
- package/es/css/StyleValueRegistry.d.ts +2 -0
- package/es/css/StyleValueRegistry.js +7 -3
- package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
- package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
- package/es/css/cssom/CSSNumericValue.d.ts +141 -4
- package/es/css/cssom/CSSNumericValue.js +1166 -5
- package/es/css/cssom/CSSTransformValue.d.ts +1 -1
- package/es/css/cssom/index.d.ts +0 -10
- package/es/css/cssom/index.js +1 -11
- package/es/css/parser/color.js +1 -1
- package/es/css/parser/dimension.js +1 -2
- package/es/css/parser/numeric.d.ts +1 -1
- package/es/css/parser/numeric.js +2 -2
- package/es/css/parser/path.d.ts +2 -2
- package/es/css/parser/path.js +1 -1
- package/es/css/parser/points.js +1 -1
- package/es/css/parser/transform-origin.d.ts +1 -1
- package/es/css/parser/transform-origin.js +2 -2
- package/es/css/parser/transform.d.ts +1 -3
- package/es/css/parser/transform.js +9 -8
- package/es/css/properties/CSSPropertyPath.d.ts +14 -2
- package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/es/css/properties/CSSPropertyTransform.js +3 -4
- package/es/display-objects/DisplayObject.js +4 -5
- package/es/display-objects/Path.d.ts +15 -15
- package/es/display-objects/Path.js +1 -1
- package/es/display-objects/Polygon.d.ts +8 -1
- package/es/display-objects/Polyline.d.ts +7 -5
- package/es/dom/Document.js +2 -2
- package/es/dom/Element.js +1 -2
- package/es/dom/EventTarget.js +1 -1
- package/es/dom/FederatedTouchEvent.d.ts +5 -3
- package/es/plugins/CullingPlugin.d.ts +0 -1
- package/es/plugins/CullingPlugin.js +3 -8
- package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/es/plugins/DirtyCheckPlugin.js +9 -8
- package/es/plugins/EventPlugin.d.ts +1 -1
- package/es/plugins/EventPlugin.js +163 -148
- package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/es/plugins/PrepareRendererPlugin.js +17 -18
- package/es/services/EventService.d.ts +8 -0
- package/es/services/EventService.js +274 -20
- package/es/services/RenderingService.d.ts +17 -16
- package/es/services/RenderingService.js +20 -19
- package/es/services/SceneGraphService.js +1 -1
- package/es/services/aabb/PathUpdater.d.ts +3 -3
- package/es/services/aabb/PolylineUpdater.d.ts +3 -3
- package/es/services/aabb/RectUpdater.js +1 -1
- package/es/types.d.ts +5 -3
- package/es/utils/assert.d.ts +6 -0
- package/es/utils/assert.js +18 -0
- package/es/utils/event.d.ts +18 -16
- package/es/utils/hooks.d.ts +280 -0
- package/es/utils/hooks.js +753 -0
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +2 -1
- package/es/utils/math.d.ts +1 -0
- package/es/utils/math.js +13 -2
- package/es/utils/string.d.ts +1 -0
- package/es/utils/string.js +8 -0
- package/es/utils/text.js +2 -1
- package/lib/AbstractRenderer.js +5 -0
- package/lib/camera/Camera.js +4 -4
- package/lib/css/StyleValueRegistry.d.ts +2 -0
- package/lib/css/StyleValueRegistry.js +13 -5
- package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
- package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
- package/lib/css/cssom/CSSNumericValue.d.ts +141 -4
- package/lib/css/cssom/CSSNumericValue.js +1226 -52
- package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
- package/lib/css/cssom/index.d.ts +0 -10
- package/lib/css/cssom/index.js +0 -130
- package/lib/css/parser/color.js +5 -5
- package/lib/css/parser/dimension.js +1 -3
- package/lib/css/parser/numeric.d.ts +1 -1
- package/lib/css/parser/numeric.js +7 -7
- package/lib/css/parser/path.d.ts +2 -2
- package/lib/css/parser/path.js +4 -4
- package/lib/css/parser/points.js +2 -2
- package/lib/css/parser/transform-origin.d.ts +1 -1
- package/lib/css/parser/transform-origin.js +4 -4
- package/lib/css/parser/transform.d.ts +1 -3
- package/lib/css/parser/transform.js +25 -24
- package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
- package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
- package/lib/css/properties/CSSPropertyTransform.js +18 -20
- package/lib/display-objects/DisplayObject.js +7 -9
- package/lib/display-objects/Path.d.ts +15 -15
- package/lib/display-objects/Path.js +3 -3
- package/lib/display-objects/Polygon.d.ts +8 -1
- package/lib/display-objects/Polyline.d.ts +7 -5
- package/lib/dom/Document.js +2 -2
- package/lib/dom/Element.js +1 -3
- package/lib/dom/EventTarget.js +9 -9
- package/lib/dom/FederatedTouchEvent.d.ts +5 -3
- package/lib/plugins/CullingPlugin.d.ts +0 -1
- package/lib/plugins/CullingPlugin.js +3 -7
- package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
- package/lib/plugins/DirtyCheckPlugin.js +10 -8
- package/lib/plugins/EventPlugin.d.ts +1 -1
- package/lib/plugins/EventPlugin.js +172 -156
- package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
- package/lib/plugins/PrepareRendererPlugin.js +16 -16
- package/lib/services/EventService.d.ts +8 -0
- package/lib/services/EventService.js +274 -19
- package/lib/services/RenderingService.d.ts +17 -16
- package/lib/services/RenderingService.js +21 -20
- package/lib/services/SceneGraphService.js +3 -3
- package/lib/services/aabb/PathUpdater.d.ts +3 -3
- package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
- package/lib/services/aabb/RectUpdater.js +3 -3
- package/lib/types.d.ts +5 -3
- package/lib/utils/assert.d.ts +6 -0
- package/lib/utils/assert.js +30 -0
- package/lib/utils/event.d.ts +18 -16
- package/lib/utils/hooks.d.ts +280 -0
- package/lib/utils/hooks.js +759 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +13 -0
- package/lib/utils/math.d.ts +1 -0
- package/lib/utils/math.js +17 -4
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/text.js +5 -3
- package/package.json +4 -7
- package/es/css/cssom/CSSMathInvert.d.ts +0 -14
- package/es/css/cssom/CSSMathInvert.js +0 -84
- package/es/css/cssom/CSSMathMax.d.ts +0 -17
- package/es/css/cssom/CSSMathMax.js +0 -118
- package/es/css/cssom/CSSMathMin.d.ts +0 -17
- package/es/css/cssom/CSSMathMin.js +0 -119
- package/es/css/cssom/CSSMathNegate.d.ts +0 -14
- package/es/css/cssom/CSSMathNegate.js +0 -80
- package/es/css/cssom/CSSMathProduct.d.ts +0 -16
- package/es/css/cssom/CSSMathProduct.js +0 -109
- package/es/css/cssom/CSSMathSum.d.ts +0 -17
- package/es/css/cssom/CSSMathSum.js +0 -117
- package/es/css/cssom/CSSMathValue.d.ts +0 -11
- package/es/css/cssom/CSSMathValue.js +0 -27
- package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
- package/es/css/cssom/CSSMathVariadic.js +0 -44
- package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/es/css/cssom/CSSNumericValueType.js +0 -259
- package/es/css/cssom/CSSUnitValue.d.ts +0 -33
- package/es/css/cssom/CSSUnitValue.js +0 -252
- package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
- package/lib/css/cssom/CSSMathInvert.js +0 -94
- package/lib/css/cssom/CSSMathMax.d.ts +0 -17
- package/lib/css/cssom/CSSMathMax.js +0 -128
- package/lib/css/cssom/CSSMathMin.d.ts +0 -17
- package/lib/css/cssom/CSSMathMin.js +0 -128
- package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
- package/lib/css/cssom/CSSMathNegate.js +0 -89
- package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
- package/lib/css/cssom/CSSMathProduct.js +0 -119
- package/lib/css/cssom/CSSMathSum.d.ts +0 -17
- package/lib/css/cssom/CSSMathSum.js +0 -129
- package/lib/css/cssom/CSSMathValue.d.ts +0 -11
- package/lib/css/cssom/CSSMathValue.js +0 -35
- package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
- package/lib/css/cssom/CSSMathVariadic.js +0 -55
- package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
- package/lib/css/cssom/CSSNumericValueType.js +0 -272
- package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
- package/lib/css/cssom/CSSUnitValue.js +0 -267
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __awaiter, __decorate, __extends, __generator, __metadata } from "tslib";
|
|
1
|
+
import { __awaiter, __decorate, __extends, __generator, __metadata, __values } from "tslib";
|
|
2
2
|
import { mat4, vec3 } from 'gl-matrix';
|
|
3
3
|
import { inject, singleton, postConstruct } from 'mana-syringe';
|
|
4
4
|
import { EventEmitter } from 'eventemitter3';
|
|
@@ -8,6 +8,7 @@ import { Node } from '../dom/Node';
|
|
|
8
8
|
import { FederatedMouseEvent } from '../dom/FederatedMouseEvent';
|
|
9
9
|
import { FederatedPointerEvent } from '../dom/FederatedPointerEvent';
|
|
10
10
|
import { FederatedWheelEvent } from '../dom/FederatedWheelEvent';
|
|
11
|
+
import { FederatedTouchEvent } from '../dom/FederatedTouchEvent';
|
|
11
12
|
import { RenderingContext } from './RenderingContext';
|
|
12
13
|
import { Point } from '../shapes';
|
|
13
14
|
import { ContextService } from './ContextService';
|
|
@@ -28,6 +29,148 @@ function (_super) {
|
|
|
28
29
|
};
|
|
29
30
|
_this.eventPool = new Map();
|
|
30
31
|
|
|
32
|
+
_this.handleTouchEvent = function (from, name) {
|
|
33
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
34
|
+
var e, uniqTargets, _a, _b, touch, _loop_1, this_1, uniqTargets_1, uniqTargets_1_1, target;
|
|
35
|
+
|
|
36
|
+
var e_1, _c, e_2, _d;
|
|
37
|
+
|
|
38
|
+
return __generator(this, function (_e) {
|
|
39
|
+
switch (_e.label) {
|
|
40
|
+
case 0:
|
|
41
|
+
return [4
|
|
42
|
+
/*yield*/
|
|
43
|
+
, this.createTouchEvent(from)];
|
|
44
|
+
|
|
45
|
+
case 1:
|
|
46
|
+
e = _e.sent();
|
|
47
|
+
uniqTargets = [];
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
for (_a = __values(e.changedTouches), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
51
|
+
touch = _b.value;
|
|
52
|
+
|
|
53
|
+
if (uniqTargets.indexOf(touch.target) === -1) {
|
|
54
|
+
uniqTargets.push(touch.target);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (e_1_1) {
|
|
58
|
+
e_1 = {
|
|
59
|
+
error: e_1_1
|
|
60
|
+
};
|
|
61
|
+
} finally {
|
|
62
|
+
try {
|
|
63
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
64
|
+
} finally {
|
|
65
|
+
if (e_1) throw e_1.error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_loop_1 = function _loop_1(target) {
|
|
70
|
+
e.target = target;
|
|
71
|
+
e.targetTouches = e.touches.filter(function (t) {
|
|
72
|
+
return t.target === target;
|
|
73
|
+
});
|
|
74
|
+
this_1.dispatchEvent(e, name);
|
|
75
|
+
this_1.freeEvent(e);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
this_1 = this;
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
for (uniqTargets_1 = __values(uniqTargets), uniqTargets_1_1 = uniqTargets_1.next(); !uniqTargets_1_1.done; uniqTargets_1_1 = uniqTargets_1.next()) {
|
|
82
|
+
target = uniqTargets_1_1.value;
|
|
83
|
+
|
|
84
|
+
_loop_1(target);
|
|
85
|
+
}
|
|
86
|
+
} catch (e_2_1) {
|
|
87
|
+
e_2 = {
|
|
88
|
+
error: e_2_1
|
|
89
|
+
};
|
|
90
|
+
} finally {
|
|
91
|
+
try {
|
|
92
|
+
if (uniqTargets_1_1 && !uniqTargets_1_1.done && (_d = uniqTargets_1.return)) _d.call(uniqTargets_1);
|
|
93
|
+
} finally {
|
|
94
|
+
if (e_2) throw e_2.error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return [2
|
|
99
|
+
/*return*/
|
|
100
|
+
];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
_this.onTouchStart = function (from) {
|
|
107
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
if (!(from instanceof FederatedPointerEvent)) {
|
|
110
|
+
return [2
|
|
111
|
+
/*return*/
|
|
112
|
+
];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
this.handleTouchEvent(from, 'touchstart');
|
|
116
|
+
return [2
|
|
117
|
+
/*return*/
|
|
118
|
+
];
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
_this.onTouchMove = function (from) {
|
|
124
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
125
|
+
return __generator(this, function (_a) {
|
|
126
|
+
if (!(from instanceof FederatedPointerEvent)) {
|
|
127
|
+
return [2
|
|
128
|
+
/*return*/
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
this.handleTouchEvent(from, 'touchmove');
|
|
133
|
+
return [2
|
|
134
|
+
/*return*/
|
|
135
|
+
];
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
_this.onTouchEnd = function (from) {
|
|
141
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
if (!(from instanceof FederatedPointerEvent)) {
|
|
144
|
+
return [2
|
|
145
|
+
/*return*/
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
this.handleTouchEvent(from, 'touchend');
|
|
150
|
+
return [2
|
|
151
|
+
/*return*/
|
|
152
|
+
];
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
_this.onTouchCancel = function (from) {
|
|
158
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
159
|
+
return __generator(this, function (_a) {
|
|
160
|
+
if (!(from instanceof FederatedPointerEvent)) {
|
|
161
|
+
return [2
|
|
162
|
+
/*return*/
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
this.handleTouchEvent(from, 'touchcancel');
|
|
167
|
+
return [2
|
|
168
|
+
/*return*/
|
|
169
|
+
];
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
31
174
|
_this.onPointerDown = function (from) {
|
|
32
175
|
return __awaiter(_this, void 0, void 0, function () {
|
|
33
176
|
var e, isRightButton, trackingData;
|
|
@@ -49,9 +192,7 @@ function (_super) {
|
|
|
49
192
|
this.dispatchEvent(e, 'pointerdown');
|
|
50
193
|
|
|
51
194
|
if (e.pointerType === 'touch') {
|
|
52
|
-
|
|
53
|
-
// if (e.isLast) {
|
|
54
|
-
this.dispatchEvent(e, 'touchstart'); // }
|
|
195
|
+
this.dispatchEvent(e, 'touchstart');
|
|
55
196
|
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
56
197
|
isRightButton = e.button === 2;
|
|
57
198
|
this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
|
|
@@ -489,6 +630,10 @@ function (_super) {
|
|
|
489
630
|
this.addEventMapping('pointerover', this.onPointerOver);
|
|
490
631
|
this.addEventMapping('pointerupoutside', this.onPointerUpOutside);
|
|
491
632
|
this.addEventMapping('wheel', this.onWheel);
|
|
633
|
+
this.addEventMapping('touchstart', this.onTouchStart);
|
|
634
|
+
this.addEventMapping('touchmove', this.onTouchMove);
|
|
635
|
+
this.addEventMapping('touchend', this.onTouchEnd);
|
|
636
|
+
this.addEventMapping('touchcancel', this.onTouchCancel);
|
|
492
637
|
};
|
|
493
638
|
|
|
494
639
|
EventService.prototype.client2Viewport = function (client) {
|
|
@@ -690,6 +835,23 @@ function (_super) {
|
|
|
690
835
|
return false;
|
|
691
836
|
};
|
|
692
837
|
|
|
838
|
+
EventService.prototype.pickTarget = function (event) {
|
|
839
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
840
|
+
return __generator(this, function (_a) {
|
|
841
|
+
return [2
|
|
842
|
+
/*return*/
|
|
843
|
+
, this.hitTest({
|
|
844
|
+
clientX: event.clientX,
|
|
845
|
+
clientY: event.clientY,
|
|
846
|
+
viewportX: event.viewportX,
|
|
847
|
+
viewportY: event.viewportY,
|
|
848
|
+
x: event.canvasX,
|
|
849
|
+
y: event.canvasY
|
|
850
|
+
})];
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
};
|
|
854
|
+
|
|
693
855
|
EventService.prototype.createPointerEvent = function (from, type, target) {
|
|
694
856
|
return __awaiter(this, void 0, void 0, function () {
|
|
695
857
|
var event, isFromCanvas, _a, _b, _c;
|
|
@@ -720,14 +882,7 @@ function (_super) {
|
|
|
720
882
|
, 3];
|
|
721
883
|
return [4
|
|
722
884
|
/*yield*/
|
|
723
|
-
, this.
|
|
724
|
-
clientX: event.clientX,
|
|
725
|
-
clientY: event.clientY,
|
|
726
|
-
viewportX: event.viewportX,
|
|
727
|
-
viewportY: event.viewportY,
|
|
728
|
-
x: event.global.x,
|
|
729
|
-
y: event.global.y
|
|
730
|
-
})];
|
|
885
|
+
, this.pickTarget(event)];
|
|
731
886
|
|
|
732
887
|
case 2:
|
|
733
888
|
_c = _d.sent();
|
|
@@ -752,6 +907,97 @@ function (_super) {
|
|
|
752
907
|
});
|
|
753
908
|
};
|
|
754
909
|
|
|
910
|
+
EventService.prototype.createTouchEvent = function (from) {
|
|
911
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
912
|
+
var event, i, touch, isFromCanvas, _a, _b, i, touch, isFromCanvas, _c, _d;
|
|
913
|
+
|
|
914
|
+
return __generator(this, function (_e) {
|
|
915
|
+
switch (_e.label) {
|
|
916
|
+
case 0:
|
|
917
|
+
event = this.allocateEvent(FederatedTouchEvent);
|
|
918
|
+
event.isTrusted = from.isTrusted;
|
|
919
|
+
event.timeStamp = performance.now();
|
|
920
|
+
event.type = from.type;
|
|
921
|
+
event.detail = from.detail;
|
|
922
|
+
event.nativeEvent = from.nativeEvent;
|
|
923
|
+
event.originalEvent = from;
|
|
924
|
+
this.copyTouchData(from, event);
|
|
925
|
+
i = 0;
|
|
926
|
+
_e.label = 1;
|
|
927
|
+
|
|
928
|
+
case 1:
|
|
929
|
+
if (!(i < from.changedTouches.length)) return [3
|
|
930
|
+
/*break*/
|
|
931
|
+
, 5];
|
|
932
|
+
touch = from.changedTouches[i];
|
|
933
|
+
isFromCanvas = this.isNativeEventFromCanvas(from);
|
|
934
|
+
_a = touch;
|
|
935
|
+
_b = isFromCanvas;
|
|
936
|
+
if (!_b) return [3
|
|
937
|
+
/*break*/
|
|
938
|
+
, 3];
|
|
939
|
+
return [4
|
|
940
|
+
/*yield*/
|
|
941
|
+
, this.pickTarget(touch)];
|
|
942
|
+
|
|
943
|
+
case 2:
|
|
944
|
+
_b = _e.sent();
|
|
945
|
+
_e.label = 3;
|
|
946
|
+
|
|
947
|
+
case 3:
|
|
948
|
+
_a.target = _b;
|
|
949
|
+
_e.label = 4;
|
|
950
|
+
|
|
951
|
+
case 4:
|
|
952
|
+
i++;
|
|
953
|
+
return [3
|
|
954
|
+
/*break*/
|
|
955
|
+
, 1];
|
|
956
|
+
|
|
957
|
+
case 5:
|
|
958
|
+
i = 0;
|
|
959
|
+
_e.label = 6;
|
|
960
|
+
|
|
961
|
+
case 6:
|
|
962
|
+
if (!(i < from.touches.length)) return [3
|
|
963
|
+
/*break*/
|
|
964
|
+
, 10];
|
|
965
|
+
touch = from.touches[i];
|
|
966
|
+
isFromCanvas = this.isNativeEventFromCanvas(from);
|
|
967
|
+
_c = touch;
|
|
968
|
+
_d = isFromCanvas;
|
|
969
|
+
if (!_d) return [3
|
|
970
|
+
/*break*/
|
|
971
|
+
, 8];
|
|
972
|
+
return [4
|
|
973
|
+
/*yield*/
|
|
974
|
+
, this.pickTarget(touch)];
|
|
975
|
+
|
|
976
|
+
case 7:
|
|
977
|
+
_d = _e.sent();
|
|
978
|
+
_e.label = 8;
|
|
979
|
+
|
|
980
|
+
case 8:
|
|
981
|
+
_c.target = _d;
|
|
982
|
+
_e.label = 9;
|
|
983
|
+
|
|
984
|
+
case 9:
|
|
985
|
+
i++;
|
|
986
|
+
return [3
|
|
987
|
+
/*break*/
|
|
988
|
+
, 6];
|
|
989
|
+
|
|
990
|
+
case 10:
|
|
991
|
+
event.touches = from.touches;
|
|
992
|
+
event.changedTouches = from.changedTouches;
|
|
993
|
+
return [2
|
|
994
|
+
/*return*/
|
|
995
|
+
, event];
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
|
|
755
1001
|
EventService.prototype.createWheelEvent = function (from) {
|
|
756
1002
|
return __awaiter(this, void 0, void 0, function () {
|
|
757
1003
|
var event, isFromCanvas, _a, _b;
|
|
@@ -773,14 +1019,7 @@ function (_super) {
|
|
|
773
1019
|
, 2];
|
|
774
1020
|
return [4
|
|
775
1021
|
/*yield*/
|
|
776
|
-
, this.
|
|
777
|
-
clientX: event.clientX,
|
|
778
|
-
clientY: event.clientY,
|
|
779
|
-
viewportX: event.viewportX,
|
|
780
|
-
viewportY: event.viewportY,
|
|
781
|
-
x: event.global.x,
|
|
782
|
-
y: event.global.y
|
|
783
|
-
})];
|
|
1022
|
+
, this.pickTarget(event)];
|
|
784
1023
|
|
|
785
1024
|
case 1:
|
|
786
1025
|
_b = _c.sent();
|
|
@@ -842,6 +1081,7 @@ function (_super) {
|
|
|
842
1081
|
to.buttons = from.buttons;
|
|
843
1082
|
to.ctrlKey = from.ctrlKey;
|
|
844
1083
|
to.metaKey = from.metaKey;
|
|
1084
|
+
to.shiftKey = from.shiftKey;
|
|
845
1085
|
to.client.copyFrom(from.client);
|
|
846
1086
|
to.movement.copyFrom(from.movement);
|
|
847
1087
|
to.canvas.copyFrom(from.canvas);
|
|
@@ -850,6 +1090,20 @@ function (_super) {
|
|
|
850
1090
|
to.offset.copyFrom(from.offset);
|
|
851
1091
|
};
|
|
852
1092
|
|
|
1093
|
+
EventService.prototype.copyTouchData = function (from, to) {
|
|
1094
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1095
|
+
return __generator(this, function (_a) {
|
|
1096
|
+
to.altKey = from.altKey;
|
|
1097
|
+
to.ctrlKey = from.ctrlKey;
|
|
1098
|
+
to.metaKey = from.metaKey;
|
|
1099
|
+
to.shiftKey = from.shiftKey;
|
|
1100
|
+
return [2
|
|
1101
|
+
/*return*/
|
|
1102
|
+
];
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
1105
|
+
};
|
|
1106
|
+
|
|
853
1107
|
EventService.prototype.copyWheelData = function (from, to) {
|
|
854
1108
|
to.deltaMode = from.deltaMode;
|
|
855
1109
|
to.deltaX = from.deltaX;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Syringe } from 'mana-syringe';
|
|
2
|
-
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '
|
|
2
|
+
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
3
3
|
import type { DisplayObject } from '../display-objects';
|
|
4
4
|
import type { CanvasConfig, EventPosition, InteractivePointerEvent } from '../types';
|
|
5
5
|
export interface RenderingPlugin {
|
|
@@ -38,33 +38,33 @@ export declare class RenderingService {
|
|
|
38
38
|
/**
|
|
39
39
|
* called before any frame rendered
|
|
40
40
|
*/
|
|
41
|
-
init: AsyncParallelHook<[],
|
|
41
|
+
init: AsyncParallelHook<[], void>;
|
|
42
42
|
/**
|
|
43
43
|
* only dirty object which has sth changed will be rendered
|
|
44
44
|
*/
|
|
45
|
-
dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>],
|
|
45
|
+
dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>], DisplayObject<any, any>>;
|
|
46
46
|
/**
|
|
47
47
|
* do culling
|
|
48
48
|
*/
|
|
49
|
-
cull: SyncWaterfallHook<[DisplayObject<any, any>],
|
|
49
|
+
cull: SyncWaterfallHook<[DisplayObject<any, any>], DisplayObject<any, any>>;
|
|
50
50
|
/**
|
|
51
51
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
52
52
|
*/
|
|
53
|
-
beginFrame: SyncHook<[], void
|
|
53
|
+
beginFrame: SyncHook<[], void>;
|
|
54
54
|
/**
|
|
55
55
|
* called before every dirty object get rendered
|
|
56
56
|
*/
|
|
57
|
-
beforeRender: SyncHook<[DisplayObject<any, any>], void
|
|
57
|
+
beforeRender: SyncHook<[DisplayObject<any, any>], void>;
|
|
58
58
|
/**
|
|
59
59
|
* called when every dirty object rendering even it's culled
|
|
60
60
|
*/
|
|
61
|
-
render: SyncHook<[DisplayObject<any, any>], void
|
|
61
|
+
render: SyncHook<[DisplayObject<any, any>], void>;
|
|
62
62
|
/**
|
|
63
63
|
* called after every dirty object get rendered
|
|
64
64
|
*/
|
|
65
|
-
afterRender: SyncHook<[DisplayObject<any, any>], void
|
|
66
|
-
endFrame: SyncHook<[], void
|
|
67
|
-
destroy: SyncHook<[], void
|
|
65
|
+
afterRender: SyncHook<[DisplayObject<any, any>], void>;
|
|
66
|
+
endFrame: SyncHook<[], void>;
|
|
67
|
+
destroy: SyncHook<[], void>;
|
|
68
68
|
/**
|
|
69
69
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
70
70
|
*/
|
|
@@ -72,12 +72,13 @@ export declare class RenderingService {
|
|
|
72
72
|
/**
|
|
73
73
|
* used in event system
|
|
74
74
|
*/
|
|
75
|
-
pointerDown: SyncHook<[InteractivePointerEvent], void
|
|
76
|
-
pointerUp: SyncHook<[InteractivePointerEvent], void
|
|
77
|
-
pointerMove: SyncHook<[InteractivePointerEvent], void
|
|
78
|
-
pointerOut: SyncHook<[InteractivePointerEvent], void
|
|
79
|
-
pointerOver: SyncHook<[InteractivePointerEvent], void
|
|
80
|
-
|
|
75
|
+
pointerDown: SyncHook<[InteractivePointerEvent], void>;
|
|
76
|
+
pointerUp: SyncHook<[InteractivePointerEvent], void>;
|
|
77
|
+
pointerMove: SyncHook<[InteractivePointerEvent], void>;
|
|
78
|
+
pointerOut: SyncHook<[InteractivePointerEvent], void>;
|
|
79
|
+
pointerOver: SyncHook<[InteractivePointerEvent], void>;
|
|
80
|
+
pointerCancel: SyncHook<[InteractivePointerEvent], void>;
|
|
81
|
+
pointerWheel: SyncHook<[InteractivePointerEvent], void>;
|
|
81
82
|
};
|
|
82
83
|
init(): Promise<void>;
|
|
83
84
|
getStats(): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __decorate, __generator, __metadata } from "tslib";
|
|
2
2
|
import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe';
|
|
3
|
-
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '
|
|
4
|
-
import {
|
|
3
|
+
import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
|
|
4
|
+
import { StyleValueRegistryContribution } from '../css/StyleValueRegistry';
|
|
5
5
|
import { ElementEvent } from '../dom';
|
|
6
6
|
import { RenderingContext, RenderReason } from './RenderingContext';
|
|
7
7
|
import { SceneGraphService, sortByZIndex } from './SceneGraphService';
|
|
@@ -47,49 +47,50 @@ function () {
|
|
|
47
47
|
/**
|
|
48
48
|
* only dirty object which has sth changed will be rendered
|
|
49
49
|
*/
|
|
50
|
-
dirtycheck: new SyncWaterfallHook(
|
|
50
|
+
dirtycheck: new SyncWaterfallHook(),
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* do culling
|
|
54
54
|
*/
|
|
55
|
-
cull: new SyncWaterfallHook(
|
|
55
|
+
cull: new SyncWaterfallHook(),
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* called at beginning of each frame, won't get called if nothing to re-render
|
|
59
59
|
*/
|
|
60
|
-
beginFrame: new SyncHook(
|
|
60
|
+
beginFrame: new SyncHook(),
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* called before every dirty object get rendered
|
|
64
64
|
*/
|
|
65
|
-
beforeRender: new SyncHook(
|
|
65
|
+
beforeRender: new SyncHook(),
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* called when every dirty object rendering even it's culled
|
|
69
69
|
*/
|
|
70
|
-
render: new SyncHook(
|
|
70
|
+
render: new SyncHook(),
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* called after every dirty object get rendered
|
|
74
74
|
*/
|
|
75
|
-
afterRender: new SyncHook(
|
|
76
|
-
endFrame: new SyncHook(
|
|
77
|
-
destroy: new SyncHook(
|
|
75
|
+
afterRender: new SyncHook(),
|
|
76
|
+
endFrame: new SyncHook(),
|
|
77
|
+
destroy: new SyncHook(),
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
|
|
81
81
|
*/
|
|
82
|
-
pick: new AsyncSeriesWaterfallHook(
|
|
82
|
+
pick: new AsyncSeriesWaterfallHook(),
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* used in event system
|
|
86
86
|
*/
|
|
87
|
-
pointerDown: new SyncHook(
|
|
88
|
-
pointerUp: new SyncHook(
|
|
89
|
-
pointerMove: new SyncHook(
|
|
90
|
-
pointerOut: new SyncHook(
|
|
91
|
-
pointerOver: new SyncHook(
|
|
92
|
-
|
|
87
|
+
pointerDown: new SyncHook(),
|
|
88
|
+
pointerUp: new SyncHook(),
|
|
89
|
+
pointerMove: new SyncHook(),
|
|
90
|
+
pointerOut: new SyncHook(),
|
|
91
|
+
pointerOver: new SyncHook(),
|
|
92
|
+
pointerCancel: new SyncHook(),
|
|
93
|
+
pointerWheel: new SyncHook()
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -108,7 +109,7 @@ function () {
|
|
|
108
109
|
});
|
|
109
110
|
return [4
|
|
110
111
|
/*yield*/
|
|
111
|
-
, this.hooks.init.
|
|
112
|
+
, this.hooks.init.callPromise()];
|
|
112
113
|
|
|
113
114
|
case 1:
|
|
114
115
|
_a.sent();
|
|
@@ -218,7 +219,7 @@ function () {
|
|
|
218
219
|
|
|
219
220
|
__decorate([inject(SceneGraphService), __metadata("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
|
|
220
221
|
|
|
221
|
-
__decorate([inject(
|
|
222
|
+
__decorate([inject(StyleValueRegistryContribution), __metadata("design:type", Function)], RenderingService.prototype, "styleValueRegistry", void 0);
|
|
222
223
|
|
|
223
224
|
RenderingService = __decorate([singleton()], RenderingService);
|
|
224
225
|
return RenderingService;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate, __metadata, __read } from "tslib";
|
|
2
2
|
import { inject, singleton, Syringe } from 'mana-syringe';
|
|
3
|
-
import { isNil } from 'lodash-es';
|
|
4
3
|
import { mat4, quat, vec3 } from 'gl-matrix';
|
|
5
4
|
import { AABB, Rectangle } from '../shapes';
|
|
6
5
|
import { SceneGraphSelectorFactory } from './SceneGraphSelector';
|
|
7
6
|
import { ElementEvent } from '../dom/interfaces';
|
|
8
7
|
import { MutationEvent } from '../dom/MutationEvent';
|
|
8
|
+
import { isNil } from '../utils';
|
|
9
9
|
export function sortByZIndex(o1, o2) {
|
|
10
10
|
var zIndex1 = Number(o1.style.zIndex);
|
|
11
11
|
var zIndex2 = Number(o2.style.zIndex);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeometryAABBUpdater } from './interfaces';
|
|
2
|
-
import type {
|
|
3
|
-
export declare class PathUpdater implements GeometryAABBUpdater<
|
|
4
|
-
update(parsedStyle:
|
|
2
|
+
import type { ParsedPathStyleProps } from '../../display-objects';
|
|
3
|
+
export declare class PathUpdater implements GeometryAABBUpdater<ParsedPathStyleProps> {
|
|
4
|
+
update(parsedStyle: ParsedPathStyleProps): {
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
x: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeometryAABBUpdater } from './interfaces';
|
|
2
|
-
import type {
|
|
3
|
-
export declare class PolylineUpdater implements GeometryAABBUpdater<
|
|
4
|
-
update(parsedStyle:
|
|
2
|
+
import type { ParsedPolylineStyleProps } from '../../display-objects';
|
|
3
|
+
export declare class PolylineUpdater implements GeometryAABBUpdater<ParsedPolylineStyleProps> {
|
|
4
|
+
update(parsedStyle: ParsedPolylineStyleProps): {
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
x: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { singleton } from 'mana-syringe';
|
|
3
|
-
import { isString } from 'lodash-es';
|
|
4
3
|
import { GeometryAABBUpdater } from './interfaces';
|
|
5
4
|
import { Shape } from '../../types';
|
|
6
5
|
import { CSSUnitValue, UnitType } from '../../css';
|
|
6
|
+
import { isString } from '../../utils';
|
|
7
7
|
|
|
8
8
|
var RectUpdater =
|
|
9
9
|
/** @class */
|
package/es/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="offscreencanvas" />
|
|
2
2
|
import type { vec2, vec3 } from 'gl-matrix';
|
|
3
|
-
import type { DisplayObject
|
|
3
|
+
import type { DisplayObject } from './display-objects';
|
|
4
4
|
import type { IRenderer } from './AbstractRenderer';
|
|
5
5
|
import type { CSSGlobalKeywords, CSSGradientValue, CSSKeywordValue, CSSRGB, CSSUnitValue } from './css';
|
|
6
6
|
import { Syringe } from 'mana-syringe';
|
|
@@ -171,8 +171,6 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
|
|
|
171
171
|
lineCap?: CSSKeywordValue;
|
|
172
172
|
lineJoin?: CSSKeywordValue;
|
|
173
173
|
lineDashOffset?: CSSUnitValue;
|
|
174
|
-
path?: ParsedPathStyleProps;
|
|
175
|
-
points?: ParsedPolylineStyleProps;
|
|
176
174
|
anchor?: [CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
177
175
|
transformOrigin?: [CSSUnitValue, CSSUnitValue, CSSUnitValue];
|
|
178
176
|
x?: CSSUnitValue;
|
|
@@ -199,6 +197,10 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
|
|
|
199
197
|
}
|
|
200
198
|
export declare type Cursor = 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'all-scroll' | 'col-resize' | 'row-resize' | 'n-resize' | 'e-resize' | 's-resize' | 'w-resize' | 'ne-resize' | 'nw-resize' | 'se-resize' | 'sw-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'zoom-in' | 'zoom-out';
|
|
201
199
|
export interface RendererConfig {
|
|
200
|
+
/**
|
|
201
|
+
* enable dirty check for displayobject
|
|
202
|
+
*/
|
|
203
|
+
enableDirtyCheck: boolean;
|
|
202
204
|
/**
|
|
203
205
|
* enable dirty rectangle rendering
|
|
204
206
|
*/
|
package/es/utils/assert.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare function DCHECK(bool: boolean): void;
|
|
2
2
|
export declare function DCHECK_EQ(a: any, b: any): void;
|
|
3
3
|
export declare function DCHECK_NE(a: any, b: any): void;
|
|
4
|
+
export declare function isUndefined(a: any): boolean;
|
|
5
|
+
export declare function isNil(a: any): boolean;
|
|
6
|
+
export declare function isNumber(value: any): value is number;
|
|
7
|
+
export declare function isFunction(value: any): value is Function;
|
|
8
|
+
export declare function isBoolean(value: any): value is boolean;
|
|
9
|
+
export declare function isObject(value: any): value is object;
|
package/es/utils/assert.js
CHANGED
|
@@ -12,4 +12,22 @@ export function DCHECK_NE(a, b) {
|
|
|
12
12
|
if (a === b) {
|
|
13
13
|
throw new Error();
|
|
14
14
|
}
|
|
15
|
+
}
|
|
16
|
+
export function isUndefined(a) {
|
|
17
|
+
return typeof a === 'undefined';
|
|
18
|
+
}
|
|
19
|
+
export function isNil(a) {
|
|
20
|
+
return a == null;
|
|
21
|
+
}
|
|
22
|
+
export function isNumber(value) {
|
|
23
|
+
return typeof value === 'number';
|
|
24
|
+
}
|
|
25
|
+
export function isFunction(value) {
|
|
26
|
+
return typeof value === 'function';
|
|
27
|
+
}
|
|
28
|
+
export function isBoolean(value) {
|
|
29
|
+
return typeof value === 'boolean';
|
|
30
|
+
}
|
|
31
|
+
export function isObject(value) {
|
|
32
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
15
33
|
}
|