@antv/g 5.0.22-alpha.6 → 5.0.23-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/index.umd.min.js +3 -3
  2. package/es/AbstractRenderer.js +5 -0
  3. package/es/camera/Camera.js +2 -2
  4. package/es/css/cssom/CSSKeywordValue.d.ts +1 -1
  5. package/es/css/cssom/CSSNumericSumValue.d.ts +1 -1
  6. package/es/css/cssom/CSSNumericValue.d.ts +141 -4
  7. package/es/css/cssom/CSSNumericValue.js +1166 -5
  8. package/es/css/cssom/CSSTransformValue.d.ts +1 -1
  9. package/es/css/cssom/index.d.ts +0 -10
  10. package/es/css/cssom/index.js +1 -11
  11. package/es/css/parser/color.js +1 -1
  12. package/es/css/parser/dimension.js +1 -2
  13. package/es/css/parser/numeric.d.ts +1 -1
  14. package/es/css/parser/numeric.js +2 -2
  15. package/es/css/parser/path.d.ts +2 -2
  16. package/es/css/parser/path.js +1 -1
  17. package/es/css/parser/points.js +1 -1
  18. package/es/css/parser/transform-origin.d.ts +1 -1
  19. package/es/css/parser/transform-origin.js +2 -2
  20. package/es/css/parser/transform.d.ts +1 -3
  21. package/es/css/parser/transform.js +9 -8
  22. package/es/css/properties/CSSPropertyPath.d.ts +14 -2
  23. package/es/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  24. package/es/css/properties/CSSPropertyTransform.js +3 -4
  25. package/es/display-objects/DisplayObject.js +4 -5
  26. package/es/display-objects/Path.d.ts +15 -15
  27. package/es/display-objects/Path.js +1 -1
  28. package/es/display-objects/Polygon.d.ts +8 -1
  29. package/es/display-objects/Polyline.d.ts +7 -5
  30. package/es/dom/Document.js +2 -2
  31. package/es/dom/Element.js +1 -2
  32. package/es/dom/EventTarget.js +1 -1
  33. package/es/dom/FederatedTouchEvent.d.ts +5 -3
  34. package/es/plugins/CullingPlugin.d.ts +0 -1
  35. package/es/plugins/CullingPlugin.js +3 -8
  36. package/es/plugins/DirtyCheckPlugin.d.ts +1 -1
  37. package/es/plugins/DirtyCheckPlugin.js +9 -8
  38. package/es/plugins/EventPlugin.d.ts +1 -1
  39. package/es/plugins/EventPlugin.js +163 -148
  40. package/es/plugins/PrepareRendererPlugin.d.ts +0 -1
  41. package/es/plugins/PrepareRendererPlugin.js +16 -17
  42. package/es/services/EventService.d.ts +8 -0
  43. package/es/services/EventService.js +274 -20
  44. package/es/services/RenderingService.d.ts +17 -16
  45. package/es/services/RenderingService.js +19 -18
  46. package/es/services/SceneGraphService.js +1 -1
  47. package/es/services/aabb/PathUpdater.d.ts +3 -3
  48. package/es/services/aabb/PolylineUpdater.d.ts +3 -3
  49. package/es/services/aabb/RectUpdater.js +1 -1
  50. package/es/types.d.ts +5 -3
  51. package/es/utils/assert.d.ts +6 -0
  52. package/es/utils/assert.js +18 -0
  53. package/es/utils/event.d.ts +18 -16
  54. package/es/utils/hooks.d.ts +280 -0
  55. package/es/utils/hooks.js +753 -0
  56. package/es/utils/index.d.ts +1 -0
  57. package/es/utils/index.js +2 -1
  58. package/es/utils/math.d.ts +1 -0
  59. package/es/utils/math.js +13 -2
  60. package/es/utils/string.d.ts +1 -0
  61. package/es/utils/string.js +8 -0
  62. package/es/utils/text.js +2 -1
  63. package/lib/AbstractRenderer.js +5 -0
  64. package/lib/camera/Camera.js +4 -4
  65. package/lib/css/cssom/CSSKeywordValue.d.ts +1 -1
  66. package/lib/css/cssom/CSSNumericSumValue.d.ts +1 -1
  67. package/lib/css/cssom/CSSNumericValue.d.ts +141 -4
  68. package/lib/css/cssom/CSSNumericValue.js +1226 -52
  69. package/lib/css/cssom/CSSTransformValue.d.ts +1 -1
  70. package/lib/css/cssom/index.d.ts +0 -10
  71. package/lib/css/cssom/index.js +0 -130
  72. package/lib/css/parser/color.js +5 -5
  73. package/lib/css/parser/dimension.js +1 -3
  74. package/lib/css/parser/numeric.d.ts +1 -1
  75. package/lib/css/parser/numeric.js +7 -7
  76. package/lib/css/parser/path.d.ts +2 -2
  77. package/lib/css/parser/path.js +4 -4
  78. package/lib/css/parser/points.js +2 -2
  79. package/lib/css/parser/transform-origin.d.ts +1 -1
  80. package/lib/css/parser/transform-origin.js +4 -4
  81. package/lib/css/parser/transform.d.ts +1 -3
  82. package/lib/css/parser/transform.js +25 -24
  83. package/lib/css/properties/CSSPropertyPath.d.ts +14 -2
  84. package/lib/css/properties/CSSPropertyTextTransform.d.ts +2 -2
  85. package/lib/css/properties/CSSPropertyTransform.js +18 -20
  86. package/lib/display-objects/DisplayObject.js +7 -9
  87. package/lib/display-objects/Path.d.ts +15 -15
  88. package/lib/display-objects/Path.js +3 -3
  89. package/lib/display-objects/Polygon.d.ts +8 -1
  90. package/lib/display-objects/Polyline.d.ts +7 -5
  91. package/lib/dom/Document.js +2 -2
  92. package/lib/dom/Element.js +1 -3
  93. package/lib/dom/EventTarget.js +9 -9
  94. package/lib/dom/FederatedTouchEvent.d.ts +5 -3
  95. package/lib/plugins/CullingPlugin.d.ts +0 -1
  96. package/lib/plugins/CullingPlugin.js +3 -7
  97. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -1
  98. package/lib/plugins/DirtyCheckPlugin.js +10 -8
  99. package/lib/plugins/EventPlugin.d.ts +1 -1
  100. package/lib/plugins/EventPlugin.js +172 -156
  101. package/lib/plugins/PrepareRendererPlugin.d.ts +0 -1
  102. package/lib/plugins/PrepareRendererPlugin.js +16 -16
  103. package/lib/services/EventService.d.ts +8 -0
  104. package/lib/services/EventService.js +274 -19
  105. package/lib/services/RenderingService.d.ts +17 -16
  106. package/lib/services/RenderingService.js +21 -20
  107. package/lib/services/SceneGraphService.js +3 -3
  108. package/lib/services/aabb/PathUpdater.d.ts +3 -3
  109. package/lib/services/aabb/PolylineUpdater.d.ts +3 -3
  110. package/lib/services/aabb/RectUpdater.js +3 -3
  111. package/lib/types.d.ts +5 -3
  112. package/lib/utils/assert.d.ts +6 -0
  113. package/lib/utils/assert.js +30 -0
  114. package/lib/utils/event.d.ts +18 -16
  115. package/lib/utils/hooks.d.ts +280 -0
  116. package/lib/utils/hooks.js +759 -0
  117. package/lib/utils/index.d.ts +1 -0
  118. package/lib/utils/index.js +13 -0
  119. package/lib/utils/math.d.ts +1 -0
  120. package/lib/utils/math.js +17 -4
  121. package/lib/utils/string.d.ts +1 -0
  122. package/lib/utils/string.js +11 -0
  123. package/lib/utils/text.js +5 -3
  124. package/package.json +4 -7
  125. package/es/css/cssom/CSSMathInvert.d.ts +0 -14
  126. package/es/css/cssom/CSSMathInvert.js +0 -84
  127. package/es/css/cssom/CSSMathMax.d.ts +0 -17
  128. package/es/css/cssom/CSSMathMax.js +0 -118
  129. package/es/css/cssom/CSSMathMin.d.ts +0 -17
  130. package/es/css/cssom/CSSMathMin.js +0 -119
  131. package/es/css/cssom/CSSMathNegate.d.ts +0 -14
  132. package/es/css/cssom/CSSMathNegate.js +0 -80
  133. package/es/css/cssom/CSSMathProduct.d.ts +0 -16
  134. package/es/css/cssom/CSSMathProduct.js +0 -109
  135. package/es/css/cssom/CSSMathSum.d.ts +0 -17
  136. package/es/css/cssom/CSSMathSum.js +0 -117
  137. package/es/css/cssom/CSSMathValue.d.ts +0 -11
  138. package/es/css/cssom/CSSMathValue.js +0 -27
  139. package/es/css/cssom/CSSMathVariadic.d.ts +0 -9
  140. package/es/css/cssom/CSSMathVariadic.js +0 -44
  141. package/es/css/cssom/CSSNumericValueType.d.ts +0 -33
  142. package/es/css/cssom/CSSNumericValueType.js +0 -259
  143. package/es/css/cssom/CSSUnitValue.d.ts +0 -33
  144. package/es/css/cssom/CSSUnitValue.js +0 -252
  145. package/lib/css/cssom/CSSMathInvert.d.ts +0 -14
  146. package/lib/css/cssom/CSSMathInvert.js +0 -94
  147. package/lib/css/cssom/CSSMathMax.d.ts +0 -17
  148. package/lib/css/cssom/CSSMathMax.js +0 -128
  149. package/lib/css/cssom/CSSMathMin.d.ts +0 -17
  150. package/lib/css/cssom/CSSMathMin.js +0 -128
  151. package/lib/css/cssom/CSSMathNegate.d.ts +0 -14
  152. package/lib/css/cssom/CSSMathNegate.js +0 -89
  153. package/lib/css/cssom/CSSMathProduct.d.ts +0 -16
  154. package/lib/css/cssom/CSSMathProduct.js +0 -119
  155. package/lib/css/cssom/CSSMathSum.d.ts +0 -17
  156. package/lib/css/cssom/CSSMathSum.js +0 -129
  157. package/lib/css/cssom/CSSMathValue.d.ts +0 -11
  158. package/lib/css/cssom/CSSMathValue.js +0 -35
  159. package/lib/css/cssom/CSSMathVariadic.d.ts +0 -9
  160. package/lib/css/cssom/CSSMathVariadic.js +0 -55
  161. package/lib/css/cssom/CSSNumericValueType.d.ts +0 -33
  162. package/lib/css/cssom/CSSNumericValueType.js +0 -272
  163. package/lib/css/cssom/CSSUnitValue.d.ts +0 -33
  164. package/lib/css/cssom/CSSUnitValue.js +0 -267
@@ -25,6 +25,8 @@ var _FederatedPointerEvent = require("../dom/FederatedPointerEvent");
25
25
 
26
26
  var _FederatedWheelEvent = require("../dom/FederatedWheelEvent");
27
27
 
28
+ var _FederatedTouchEvent = require("../dom/FederatedTouchEvent");
29
+
28
30
  var _RenderingContext = require("./RenderingContext");
29
31
 
30
32
  var _shapes = require("../shapes");
@@ -48,6 +50,148 @@ function (_super) {
48
50
  };
49
51
  _this.eventPool = new Map();
50
52
 
53
+ _this.handleTouchEvent = function (from, name) {
54
+ return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
55
+ var e, uniqTargets, _a, _b, touch, _loop_1, this_1, uniqTargets_1, uniqTargets_1_1, target;
56
+
57
+ var e_1, _c, e_2, _d;
58
+
59
+ return (0, _tslib.__generator)(this, function (_e) {
60
+ switch (_e.label) {
61
+ case 0:
62
+ return [4
63
+ /*yield*/
64
+ , this.createTouchEvent(from)];
65
+
66
+ case 1:
67
+ e = _e.sent();
68
+ uniqTargets = [];
69
+
70
+ try {
71
+ for (_a = (0, _tslib.__values)(e.changedTouches), _b = _a.next(); !_b.done; _b = _a.next()) {
72
+ touch = _b.value;
73
+
74
+ if (uniqTargets.indexOf(touch.target) === -1) {
75
+ uniqTargets.push(touch.target);
76
+ }
77
+ }
78
+ } catch (e_1_1) {
79
+ e_1 = {
80
+ error: e_1_1
81
+ };
82
+ } finally {
83
+ try {
84
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
85
+ } finally {
86
+ if (e_1) throw e_1.error;
87
+ }
88
+ }
89
+
90
+ _loop_1 = function _loop_1(target) {
91
+ e.target = target;
92
+ e.targetTouches = e.touches.filter(function (t) {
93
+ return t.target === target;
94
+ });
95
+ this_1.dispatchEvent(e, name);
96
+ this_1.freeEvent(e);
97
+ };
98
+
99
+ this_1 = this;
100
+
101
+ try {
102
+ for (uniqTargets_1 = (0, _tslib.__values)(uniqTargets), uniqTargets_1_1 = uniqTargets_1.next(); !uniqTargets_1_1.done; uniqTargets_1_1 = uniqTargets_1.next()) {
103
+ target = uniqTargets_1_1.value;
104
+
105
+ _loop_1(target);
106
+ }
107
+ } catch (e_2_1) {
108
+ e_2 = {
109
+ error: e_2_1
110
+ };
111
+ } finally {
112
+ try {
113
+ if (uniqTargets_1_1 && !uniqTargets_1_1.done && (_d = uniqTargets_1.return)) _d.call(uniqTargets_1);
114
+ } finally {
115
+ if (e_2) throw e_2.error;
116
+ }
117
+ }
118
+
119
+ return [2
120
+ /*return*/
121
+ ];
122
+ }
123
+ });
124
+ });
125
+ };
126
+
127
+ _this.onTouchStart = function (from) {
128
+ return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
129
+ return (0, _tslib.__generator)(this, function (_a) {
130
+ if (!(from instanceof _FederatedPointerEvent.FederatedPointerEvent)) {
131
+ return [2
132
+ /*return*/
133
+ ];
134
+ }
135
+
136
+ this.handleTouchEvent(from, 'touchstart');
137
+ return [2
138
+ /*return*/
139
+ ];
140
+ });
141
+ });
142
+ };
143
+
144
+ _this.onTouchMove = function (from) {
145
+ return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
146
+ return (0, _tslib.__generator)(this, function (_a) {
147
+ if (!(from instanceof _FederatedPointerEvent.FederatedPointerEvent)) {
148
+ return [2
149
+ /*return*/
150
+ ];
151
+ }
152
+
153
+ this.handleTouchEvent(from, 'touchmove');
154
+ return [2
155
+ /*return*/
156
+ ];
157
+ });
158
+ });
159
+ };
160
+
161
+ _this.onTouchEnd = function (from) {
162
+ return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
163
+ return (0, _tslib.__generator)(this, function (_a) {
164
+ if (!(from instanceof _FederatedPointerEvent.FederatedPointerEvent)) {
165
+ return [2
166
+ /*return*/
167
+ ];
168
+ }
169
+
170
+ this.handleTouchEvent(from, 'touchend');
171
+ return [2
172
+ /*return*/
173
+ ];
174
+ });
175
+ });
176
+ };
177
+
178
+ _this.onTouchCancel = function (from) {
179
+ return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
180
+ return (0, _tslib.__generator)(this, function (_a) {
181
+ if (!(from instanceof _FederatedPointerEvent.FederatedPointerEvent)) {
182
+ return [2
183
+ /*return*/
184
+ ];
185
+ }
186
+
187
+ this.handleTouchEvent(from, 'touchcancel');
188
+ return [2
189
+ /*return*/
190
+ ];
191
+ });
192
+ });
193
+ };
194
+
51
195
  _this.onPointerDown = function (from) {
52
196
  return (0, _tslib.__awaiter)(_this, void 0, void 0, function () {
53
197
  var e, isRightButton, trackingData;
@@ -69,9 +213,7 @@ function (_super) {
69
213
  this.dispatchEvent(e, 'pointerdown');
70
214
 
71
215
  if (e.pointerType === 'touch') {
72
- // only the
73
- // if (e.isLast) {
74
- this.dispatchEvent(e, 'touchstart'); // }
216
+ this.dispatchEvent(e, 'touchstart');
75
217
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
76
218
  isRightButton = e.button === 2;
77
219
  this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
@@ -509,6 +651,10 @@ function (_super) {
509
651
  this.addEventMapping('pointerover', this.onPointerOver);
510
652
  this.addEventMapping('pointerupoutside', this.onPointerUpOutside);
511
653
  this.addEventMapping('wheel', this.onWheel);
654
+ this.addEventMapping('touchstart', this.onTouchStart);
655
+ this.addEventMapping('touchmove', this.onTouchMove);
656
+ this.addEventMapping('touchend', this.onTouchEnd);
657
+ this.addEventMapping('touchcancel', this.onTouchCancel);
512
658
  };
513
659
 
514
660
  EventService.prototype.client2Viewport = function (client) {
@@ -718,6 +864,23 @@ function (_super) {
718
864
  return false;
719
865
  };
720
866
 
867
+ EventService.prototype.pickTarget = function (event) {
868
+ return (0, _tslib.__awaiter)(this, void 0, void 0, function () {
869
+ return (0, _tslib.__generator)(this, function (_a) {
870
+ return [2
871
+ /*return*/
872
+ , this.hitTest({
873
+ clientX: event.clientX,
874
+ clientY: event.clientY,
875
+ viewportX: event.viewportX,
876
+ viewportY: event.viewportY,
877
+ x: event.canvasX,
878
+ y: event.canvasY
879
+ })];
880
+ });
881
+ });
882
+ };
883
+
721
884
  EventService.prototype.createPointerEvent = function (from, type, target) {
722
885
  return (0, _tslib.__awaiter)(this, void 0, void 0, function () {
723
886
  var event, isFromCanvas, _a, _b, _c;
@@ -748,14 +911,7 @@ function (_super) {
748
911
  , 3];
749
912
  return [4
750
913
  /*yield*/
751
- , this.hitTest({
752
- clientX: event.clientX,
753
- clientY: event.clientY,
754
- viewportX: event.viewportX,
755
- viewportY: event.viewportY,
756
- x: event.global.x,
757
- y: event.global.y
758
- })];
914
+ , this.pickTarget(event)];
759
915
 
760
916
  case 2:
761
917
  _c = _d.sent();
@@ -780,6 +936,97 @@ function (_super) {
780
936
  });
781
937
  };
782
938
 
939
+ EventService.prototype.createTouchEvent = function (from) {
940
+ return (0, _tslib.__awaiter)(this, void 0, void 0, function () {
941
+ var event, i, touch, isFromCanvas, _a, _b, i, touch, isFromCanvas, _c, _d;
942
+
943
+ return (0, _tslib.__generator)(this, function (_e) {
944
+ switch (_e.label) {
945
+ case 0:
946
+ event = this.allocateEvent(_FederatedTouchEvent.FederatedTouchEvent);
947
+ event.isTrusted = from.isTrusted;
948
+ event.timeStamp = performance.now();
949
+ event.type = from.type;
950
+ event.detail = from.detail;
951
+ event.nativeEvent = from.nativeEvent;
952
+ event.originalEvent = from;
953
+ this.copyTouchData(from, event);
954
+ i = 0;
955
+ _e.label = 1;
956
+
957
+ case 1:
958
+ if (!(i < from.changedTouches.length)) return [3
959
+ /*break*/
960
+ , 5];
961
+ touch = from.changedTouches[i];
962
+ isFromCanvas = this.isNativeEventFromCanvas(from);
963
+ _a = touch;
964
+ _b = isFromCanvas;
965
+ if (!_b) return [3
966
+ /*break*/
967
+ , 3];
968
+ return [4
969
+ /*yield*/
970
+ , this.pickTarget(touch)];
971
+
972
+ case 2:
973
+ _b = _e.sent();
974
+ _e.label = 3;
975
+
976
+ case 3:
977
+ _a.target = _b;
978
+ _e.label = 4;
979
+
980
+ case 4:
981
+ i++;
982
+ return [3
983
+ /*break*/
984
+ , 1];
985
+
986
+ case 5:
987
+ i = 0;
988
+ _e.label = 6;
989
+
990
+ case 6:
991
+ if (!(i < from.touches.length)) return [3
992
+ /*break*/
993
+ , 10];
994
+ touch = from.touches[i];
995
+ isFromCanvas = this.isNativeEventFromCanvas(from);
996
+ _c = touch;
997
+ _d = isFromCanvas;
998
+ if (!_d) return [3
999
+ /*break*/
1000
+ , 8];
1001
+ return [4
1002
+ /*yield*/
1003
+ , this.pickTarget(touch)];
1004
+
1005
+ case 7:
1006
+ _d = _e.sent();
1007
+ _e.label = 8;
1008
+
1009
+ case 8:
1010
+ _c.target = _d;
1011
+ _e.label = 9;
1012
+
1013
+ case 9:
1014
+ i++;
1015
+ return [3
1016
+ /*break*/
1017
+ , 6];
1018
+
1019
+ case 10:
1020
+ event.touches = from.touches;
1021
+ event.changedTouches = from.changedTouches;
1022
+ return [2
1023
+ /*return*/
1024
+ , event];
1025
+ }
1026
+ });
1027
+ });
1028
+ };
1029
+
783
1030
  EventService.prototype.createWheelEvent = function (from) {
784
1031
  return (0, _tslib.__awaiter)(this, void 0, void 0, function () {
785
1032
  var event, isFromCanvas, _a, _b;
@@ -801,14 +1048,7 @@ function (_super) {
801
1048
  , 2];
802
1049
  return [4
803
1050
  /*yield*/
804
- , this.hitTest({
805
- clientX: event.clientX,
806
- clientY: event.clientY,
807
- viewportX: event.viewportX,
808
- viewportY: event.viewportY,
809
- x: event.global.x,
810
- y: event.global.y
811
- })];
1051
+ , this.pickTarget(event)];
812
1052
 
813
1053
  case 1:
814
1054
  _b = _c.sent();
@@ -870,6 +1110,7 @@ function (_super) {
870
1110
  to.buttons = from.buttons;
871
1111
  to.ctrlKey = from.ctrlKey;
872
1112
  to.metaKey = from.metaKey;
1113
+ to.shiftKey = from.shiftKey;
873
1114
  to.client.copyFrom(from.client);
874
1115
  to.movement.copyFrom(from.movement);
875
1116
  to.canvas.copyFrom(from.canvas);
@@ -878,6 +1119,20 @@ function (_super) {
878
1119
  to.offset.copyFrom(from.offset);
879
1120
  };
880
1121
 
1122
+ EventService.prototype.copyTouchData = function (from, to) {
1123
+ return (0, _tslib.__awaiter)(this, void 0, void 0, function () {
1124
+ return (0, _tslib.__generator)(this, function (_a) {
1125
+ to.altKey = from.altKey;
1126
+ to.ctrlKey = from.ctrlKey;
1127
+ to.metaKey = from.metaKey;
1128
+ to.shiftKey = from.shiftKey;
1129
+ return [2
1130
+ /*return*/
1131
+ ];
1132
+ });
1133
+ });
1134
+ };
1135
+
881
1136
  EventService.prototype.copyWheelData = function (from, to) {
882
1137
  to.deltaMode = from.deltaMode;
883
1138
  to.deltaX = from.deltaX;
@@ -1,5 +1,5 @@
1
1
  import { Syringe } from 'mana-syringe';
2
- import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
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<[], import("tapable").UnsetAdditionalOptions>;
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>], import("tapable").UnsetAdditionalOptions>;
45
+ dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>], DisplayObject<any, any>>;
46
46
  /**
47
47
  * do culling
48
48
  */
49
- cull: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
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, import("tapable").UnsetAdditionalOptions>;
53
+ beginFrame: SyncHook<[], void>;
54
54
  /**
55
55
  * called before every dirty object get rendered
56
56
  */
57
- beforeRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
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, import("tapable").UnsetAdditionalOptions>;
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, import("tapable").UnsetAdditionalOptions>;
66
- endFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
67
- destroy: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
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, import("tapable").UnsetAdditionalOptions>;
76
- pointerUp: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
77
- pointerMove: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
78
- pointerOut: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
79
- pointerOver: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
80
- pointerWheel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
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(): {
@@ -9,9 +9,9 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _manaSyringe = require("mana-syringe");
11
11
 
12
- var _tapable = require("tapable");
12
+ var _utils = require("../utils");
13
13
 
14
- var _css = require("../css");
14
+ var _StyleValueRegistry = require("../css/StyleValueRegistry");
15
15
 
16
16
  var _dom = require("../dom");
17
17
 
@@ -59,54 +59,55 @@ function () {
59
59
  /**
60
60
  * called before any frame rendered
61
61
  */
62
- init: new _tapable.AsyncParallelHook(),
62
+ init: new _utils.AsyncParallelHook(),
63
63
 
64
64
  /**
65
65
  * only dirty object which has sth changed will be rendered
66
66
  */
67
- dirtycheck: new _tapable.SyncWaterfallHook(['object']),
67
+ dirtycheck: new _utils.SyncWaterfallHook(),
68
68
 
69
69
  /**
70
70
  * do culling
71
71
  */
72
- cull: new _tapable.SyncWaterfallHook(['object']),
72
+ cull: new _utils.SyncWaterfallHook(),
73
73
 
74
74
  /**
75
75
  * called at beginning of each frame, won't get called if nothing to re-render
76
76
  */
77
- beginFrame: new _tapable.SyncHook([]),
77
+ beginFrame: new _utils.SyncHook(),
78
78
 
79
79
  /**
80
80
  * called before every dirty object get rendered
81
81
  */
82
- beforeRender: new _tapable.SyncHook(['objectToRender']),
82
+ beforeRender: new _utils.SyncHook(),
83
83
 
84
84
  /**
85
85
  * called when every dirty object rendering even it's culled
86
86
  */
87
- render: new _tapable.SyncHook(['objectToRender']),
87
+ render: new _utils.SyncHook(),
88
88
 
89
89
  /**
90
90
  * called after every dirty object get rendered
91
91
  */
92
- afterRender: new _tapable.SyncHook(['objectToRender']),
93
- endFrame: new _tapable.SyncHook([]),
94
- destroy: new _tapable.SyncHook([]),
92
+ afterRender: new _utils.SyncHook(),
93
+ endFrame: new _utils.SyncHook(),
94
+ destroy: new _utils.SyncHook(),
95
95
 
96
96
  /**
97
97
  * use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
98
98
  */
99
- pick: new _tapable.AsyncSeriesWaterfallHook(['result']),
99
+ pick: new _utils.AsyncSeriesWaterfallHook(),
100
100
 
101
101
  /**
102
102
  * used in event system
103
103
  */
104
- pointerDown: new _tapable.SyncHook(['event']),
105
- pointerUp: new _tapable.SyncHook(['event']),
106
- pointerMove: new _tapable.SyncHook(['event']),
107
- pointerOut: new _tapable.SyncHook(['event']),
108
- pointerOver: new _tapable.SyncHook(['event']),
109
- pointerWheel: new _tapable.SyncHook(['event'])
104
+ pointerDown: new _utils.SyncHook(),
105
+ pointerUp: new _utils.SyncHook(),
106
+ pointerMove: new _utils.SyncHook(),
107
+ pointerOut: new _utils.SyncHook(),
108
+ pointerOver: new _utils.SyncHook(),
109
+ pointerCancel: new _utils.SyncHook(),
110
+ pointerWheel: new _utils.SyncHook()
110
111
  };
111
112
  }
112
113
 
@@ -125,7 +126,7 @@ function () {
125
126
  });
126
127
  return [4
127
128
  /*yield*/
128
- , this.hooks.init.promise()];
129
+ , this.hooks.init.callPromise()];
129
130
 
130
131
  case 1:
131
132
  _a.sent();
@@ -232,7 +233,7 @@ function () {
232
233
  (0, _tslib.__decorate)([(0, _manaSyringe.contrib)(RenderingPluginContribution), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingPluginProvider", void 0);
233
234
  (0, _tslib.__decorate)([(0, _manaSyringe.inject)(_RenderingContext.RenderingContext), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "renderingContext", void 0);
234
235
  (0, _tslib.__decorate)([(0, _manaSyringe.inject)(_SceneGraphService.SceneGraphService), (0, _tslib.__metadata)("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
235
- (0, _tslib.__decorate)([(0, _manaSyringe.inject)(_css.StyleValueRegistry), (0, _tslib.__metadata)("design:type", _css.StyleValueRegistry)], RenderingService.prototype, "styleValueRegistry", void 0);
236
+ (0, _tslib.__decorate)([(0, _manaSyringe.inject)(_StyleValueRegistry.StyleValueRegistry), (0, _tslib.__metadata)("design:type", _StyleValueRegistry.StyleValueRegistry)], RenderingService.prototype, "styleValueRegistry", void 0);
236
237
  RenderingService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], RenderingService);
237
238
  return RenderingService;
238
239
  }();
@@ -11,8 +11,6 @@ var _tslib = require("tslib");
11
11
 
12
12
  var _manaSyringe = require("mana-syringe");
13
13
 
14
- var _lodashEs = require("lodash-es");
15
-
16
14
  var _glMatrix = require("gl-matrix");
17
15
 
18
16
  var _shapes = require("../shapes");
@@ -23,6 +21,8 @@ var _interfaces = require("../dom/interfaces");
23
21
 
24
22
  var _MutationEvent = require("../dom/MutationEvent");
25
23
 
24
+ var _utils = require("../utils");
25
+
26
26
  function sortByZIndex(o1, o2) {
27
27
  var zIndex1 = Number(o1.style.zIndex);
28
28
  var zIndex2 = Number(o2.style.zIndex);
@@ -358,7 +358,7 @@ function () {
358
358
 
359
359
  child.parentNode = parent;
360
360
 
361
- if (!(0, _lodashEs.isNil)(index)) {
361
+ if (!(0, _utils.isNil)(index)) {
362
362
  child.parentNode.childNodes.splice(index, 0, child);
363
363
  } else {
364
364
  child.parentNode.childNodes.push(child);
@@ -1,7 +1,7 @@
1
1
  import { GeometryAABBUpdater } from './interfaces';
2
- import type { ParsedBaseStyleProps } from '../../types';
3
- export declare class PathUpdater implements GeometryAABBUpdater<ParsedBaseStyleProps> {
4
- update(parsedStyle: ParsedBaseStyleProps): {
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 { ParsedBaseStyleProps } from '../../types';
3
- export declare class PolylineUpdater implements GeometryAABBUpdater<ParsedBaseStyleProps> {
4
- update(parsedStyle: ParsedBaseStyleProps): {
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;
@@ -9,14 +9,14 @@ var _tslib = require("tslib");
9
9
 
10
10
  var _manaSyringe = require("mana-syringe");
11
11
 
12
- var _lodashEs = require("lodash-es");
13
-
14
12
  var _interfaces = require("./interfaces");
15
13
 
16
14
  var _types = require("../../types");
17
15
 
18
16
  var _css = require("../../css");
19
17
 
18
+ var _utils = require("../../utils");
19
+
20
20
  var RectUpdater =
21
21
  /** @class */
22
22
  function () {
@@ -44,7 +44,7 @@ function () {
44
44
  } // resize with HTMLImageElement's size
45
45
 
46
46
 
47
- if (img && !(0, _lodashEs.isString)(img)) {
47
+ if (img && !(0, _utils.isString)(img)) {
48
48
  if (!contentWidth) {
49
49
  contentWidth = img.width;
50
50
  }
package/lib/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, ParsedPathStyleProps, ParsedPolylineStyleProps } from './display-objects';
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
  */
@@ -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;