@antv/g 5.0.21 → 5.0.22-alpha.2

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 (265) hide show
  1. package/es/AbstractRenderer.js +1 -3
  2. package/es/Canvas.js +7 -11
  3. package/es/DisplayObjectPool.js +1 -3
  4. package/es/camera/Camera.d.ts +12 -7
  5. package/es/camera/Camera.js +54 -24
  6. package/es/camera/Landmark.d.ts +2 -0
  7. package/es/camera/Landmark.js +10 -6
  8. package/es/components/Cullable.js +1 -3
  9. package/es/components/Geometry.js +1 -3
  10. package/es/components/Renderable.js +1 -3
  11. package/es/components/Sortable.js +1 -3
  12. package/es/components/Transform.js +1 -3
  13. package/es/css/LayoutRegistry.js +1 -3
  14. package/es/css/StyleValueRegistry.js +1 -3
  15. package/es/css/cssom/CSSColorValue.js +1 -3
  16. package/es/css/cssom/CSSGradientValue.js +6 -8
  17. package/es/css/cssom/CSSKeywordValue.js +1 -3
  18. package/es/css/cssom/CSSMathInvert.js +1 -3
  19. package/es/css/cssom/CSSMathMax.js +1 -3
  20. package/es/css/cssom/CSSMathMin.js +1 -3
  21. package/es/css/cssom/CSSMathNegate.js +1 -3
  22. package/es/css/cssom/CSSMathProduct.js +1 -3
  23. package/es/css/cssom/CSSMathSum.js +1 -3
  24. package/es/css/cssom/CSSMathValue.js +1 -3
  25. package/es/css/cssom/CSSMathVariadic.js +1 -3
  26. package/es/css/cssom/CSSNumericValue.js +1 -3
  27. package/es/css/cssom/CSSNumericValueType.d.ts +1 -1
  28. package/es/css/cssom/CSSNumericValueType.js +1 -3
  29. package/es/css/cssom/CSSRGB.js +2 -4
  30. package/es/css/cssom/CSSStyleValue.d.ts +2 -2
  31. package/es/css/cssom/CSSStyleValue.js +2 -4
  32. package/es/css/cssom/CSSTransformComponent.js +1 -3
  33. package/es/css/cssom/CSSTransformValue.js +1 -3
  34. package/es/css/cssom/CSSTranslate.js +1 -3
  35. package/es/css/cssom/CSSUnitValue.js +2 -4
  36. package/es/css/parser/color.js +1 -1
  37. package/es/css/parser/dimension.js +1 -1
  38. package/es/css/parser/transform.d.ts +1 -1
  39. package/es/css/parser/transform.js +2 -2
  40. package/es/css/properties/CSSPropertyAnchor.js +1 -3
  41. package/es/css/properties/CSSPropertyClipPath.js +1 -3
  42. package/es/css/properties/CSSPropertyColor.js +1 -3
  43. package/es/css/properties/CSSPropertyFilter.js +1 -3
  44. package/es/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
  45. package/es/css/properties/CSSPropertyLineDash.js +1 -3
  46. package/es/css/properties/CSSPropertyLocalPosition.js +1 -3
  47. package/es/css/properties/CSSPropertyOffsetDistance.js +1 -3
  48. package/es/css/properties/CSSPropertyOffsetPath.js +1 -3
  49. package/es/css/properties/CSSPropertyOpacity.js +1 -3
  50. package/es/css/properties/CSSPropertyPath.js +1 -3
  51. package/es/css/properties/CSSPropertyPoints.js +1 -3
  52. package/es/css/properties/CSSPropertyShadowBlur.js +1 -3
  53. package/es/css/properties/CSSPropertyText.js +2 -4
  54. package/es/css/properties/CSSPropertyTextTransform.js +1 -3
  55. package/es/css/properties/CSSPropertyTransform.js +1 -3
  56. package/es/css/properties/CSSPropertyTransformOrigin.js +1 -3
  57. package/es/css/properties/CSSPropertyVisibility.js +1 -3
  58. package/es/css/properties/CSSPropertyZIndex.js +1 -3
  59. package/es/display-objects/Circle.js +1 -3
  60. package/es/display-objects/CustomElement.js +1 -3
  61. package/es/display-objects/DisplayObject.js +10 -8
  62. package/es/display-objects/Ellipse.js +1 -3
  63. package/es/display-objects/Group.js +1 -3
  64. package/es/display-objects/HTML.js +3 -6
  65. package/es/display-objects/Image.js +1 -3
  66. package/es/display-objects/Line.js +1 -3
  67. package/es/display-objects/Path.js +1 -3
  68. package/es/display-objects/Polygon.js +1 -3
  69. package/es/display-objects/Polyline.js +1 -3
  70. package/es/display-objects/Rect.js +1 -3
  71. package/es/display-objects/Text.js +3 -6
  72. package/es/dom/Animation.js +2 -4
  73. package/es/dom/AnimationEffectTiming.js +1 -3
  74. package/es/dom/AnimationEvent.js +1 -3
  75. package/es/dom/AnimationTimeline.js +1 -3
  76. package/es/dom/CustomElementRegistry.js +1 -3
  77. package/es/dom/CustomEvent.js +1 -3
  78. package/es/dom/Document.js +1 -3
  79. package/es/dom/Element.js +4 -6
  80. package/es/dom/EventTarget.js +3 -5
  81. package/es/dom/FederatedEvent.js +1 -3
  82. package/es/dom/FederatedMouseEvent.js +1 -3
  83. package/es/dom/FederatedPointerEvent.js +1 -3
  84. package/es/dom/FederatedWheelEvent.js +1 -3
  85. package/es/dom/KeyframeEffect.js +1 -3
  86. package/es/dom/KeyframeList.js +1 -1
  87. package/es/dom/MutationEvent.js +1 -3
  88. package/es/dom/MutationObserver.js +3 -10
  89. package/es/dom/MutationRecord.js +1 -3
  90. package/es/dom/Node.js +2 -4
  91. package/es/plugins/CullingPlugin.js +1 -3
  92. package/es/plugins/DirtyCheckPlugin.js +1 -3
  93. package/es/plugins/EventPlugin.js +5 -4
  94. package/es/plugins/FrustumCullingStrategy.js +1 -3
  95. package/es/plugins/PrepareRendererPlugin.js +1 -3
  96. package/es/services/EventService.js +26 -7
  97. package/es/services/OffscreenCanvasCreator.js +1 -3
  98. package/es/services/RenderingContext.d.ts +2 -1
  99. package/es/services/RenderingContext.js +3 -1
  100. package/es/services/RenderingService.js +1 -3
  101. package/es/services/SceneGraphSelector.js +1 -3
  102. package/es/services/SceneGraphService.d.ts +2 -1
  103. package/es/services/SceneGraphService.js +3 -5
  104. package/es/services/TextService.js +3 -5
  105. package/es/services/aabb/CircleUpdater.js +1 -3
  106. package/es/services/aabb/EllipseUpdater.js +1 -3
  107. package/es/services/aabb/LineUpdater.js +1 -3
  108. package/es/services/aabb/PathUpdater.js +1 -3
  109. package/es/services/aabb/PolylineUpdater.js +1 -3
  110. package/es/services/aabb/RectUpdater.js +1 -3
  111. package/es/services/aabb/TextUpdater.js +1 -3
  112. package/es/services/aabb/interfaces.d.ts +3 -2
  113. package/es/services/aabb/interfaces.js +3 -2
  114. package/es/shapes/AABB.js +1 -3
  115. package/es/shapes/BoundingSphere.js +1 -3
  116. package/es/shapes/Frustum.js +1 -3
  117. package/es/shapes/Plane.js +1 -3
  118. package/es/shapes/Point.js +1 -3
  119. package/es/shapes/Ray.js +1 -3
  120. package/es/shapes/Rectangle.js +1 -3
  121. package/es/types.d.ts +2 -1
  122. package/es/types.js +2 -1
  123. package/es/utils/custom-easing.d.ts +0 -9
  124. package/es/utils/custom-easing.js +38 -54
  125. package/es/utils/path.d.ts +1 -1
  126. package/es/utils/path.js +3 -3
  127. package/es/utils/text.js +3 -3
  128. package/lib/AbstractRenderer.js +1 -3
  129. package/lib/Canvas.js +8 -12
  130. package/lib/DisplayObjectPool.js +1 -3
  131. package/lib/camera/Camera.d.ts +12 -7
  132. package/lib/camera/Camera.js +59 -25
  133. package/lib/camera/Landmark.d.ts +2 -0
  134. package/lib/camera/Landmark.js +10 -6
  135. package/lib/components/Cullable.js +2 -4
  136. package/lib/components/Geometry.js +1 -3
  137. package/lib/components/Renderable.js +1 -3
  138. package/lib/components/Sortable.js +1 -3
  139. package/lib/components/Transform.js +1 -3
  140. package/lib/css/LayoutRegistry.js +1 -3
  141. package/lib/css/StyleValueRegistry.js +1 -3
  142. package/lib/css/cssom/CSSColorValue.js +1 -3
  143. package/lib/css/cssom/CSSGradientValue.js +7 -9
  144. package/lib/css/cssom/CSSKeywordValue.js +1 -3
  145. package/lib/css/cssom/CSSMathInvert.js +1 -3
  146. package/lib/css/cssom/CSSMathMax.js +1 -3
  147. package/lib/css/cssom/CSSMathMin.js +1 -3
  148. package/lib/css/cssom/CSSMathNegate.js +1 -3
  149. package/lib/css/cssom/CSSMathOperator.js +1 -1
  150. package/lib/css/cssom/CSSMathProduct.js +1 -3
  151. package/lib/css/cssom/CSSMathSum.js +1 -3
  152. package/lib/css/cssom/CSSMathValue.js +1 -3
  153. package/lib/css/cssom/CSSMathVariadic.js +2 -4
  154. package/lib/css/cssom/CSSNumericValue.js +1 -3
  155. package/lib/css/cssom/CSSNumericValueType.d.ts +1 -1
  156. package/lib/css/cssom/CSSNumericValueType.js +3 -5
  157. package/lib/css/cssom/CSSRGB.js +2 -4
  158. package/lib/css/cssom/CSSStyleValue.d.ts +2 -2
  159. package/lib/css/cssom/CSSStyleValue.js +108 -110
  160. package/lib/css/cssom/CSSTransformComponent.js +2 -4
  161. package/lib/css/cssom/CSSTransformValue.js +1 -3
  162. package/lib/css/cssom/CSSTranslate.js +1 -3
  163. package/lib/css/cssom/CSSUnitValue.js +2 -4
  164. package/lib/css/cssom/types.js +1 -1
  165. package/lib/css/parser/color.js +3 -3
  166. package/lib/css/parser/dimension.js +6 -7
  167. package/lib/css/parser/numeric.js +3 -3
  168. package/lib/css/parser/path.js +1 -1
  169. package/lib/css/parser/transform.d.ts +1 -1
  170. package/lib/css/parser/transform.js +11 -11
  171. package/lib/css/properties/CSSPropertyAnchor.js +1 -3
  172. package/lib/css/properties/CSSPropertyClipPath.js +1 -3
  173. package/lib/css/properties/CSSPropertyColor.js +1 -3
  174. package/lib/css/properties/CSSPropertyFilter.js +1 -3
  175. package/lib/css/properties/CSSPropertyLengthOrPercentage.js +1 -3
  176. package/lib/css/properties/CSSPropertyLineDash.js +1 -3
  177. package/lib/css/properties/CSSPropertyLocalPosition.js +1 -3
  178. package/lib/css/properties/CSSPropertyOffsetDistance.js +1 -3
  179. package/lib/css/properties/CSSPropertyOffsetPath.js +1 -3
  180. package/lib/css/properties/CSSPropertyOpacity.js +1 -3
  181. package/lib/css/properties/CSSPropertyPath.js +1 -3
  182. package/lib/css/properties/CSSPropertyPoints.js +1 -3
  183. package/lib/css/properties/CSSPropertyShadowBlur.js +1 -3
  184. package/lib/css/properties/CSSPropertyText.js +2 -4
  185. package/lib/css/properties/CSSPropertyTextTransform.js +1 -3
  186. package/lib/css/properties/CSSPropertyTransform.js +1 -3
  187. package/lib/css/properties/CSSPropertyTransformOrigin.js +1 -3
  188. package/lib/css/properties/CSSPropertyVisibility.js +1 -3
  189. package/lib/css/properties/CSSPropertyZIndex.js +1 -3
  190. package/lib/display-objects/Circle.js +1 -3
  191. package/lib/display-objects/CustomElement.js +1 -3
  192. package/lib/display-objects/DisplayObject.js +9 -7
  193. package/lib/display-objects/Ellipse.js +1 -3
  194. package/lib/display-objects/Group.js +1 -3
  195. package/lib/display-objects/HTML.js +4 -6
  196. package/lib/display-objects/Image.js +1 -3
  197. package/lib/display-objects/Line.js +1 -3
  198. package/lib/display-objects/Path.js +1 -3
  199. package/lib/display-objects/Polygon.js +1 -3
  200. package/lib/display-objects/Polyline.js +1 -3
  201. package/lib/display-objects/Rect.js +1 -3
  202. package/lib/display-objects/Text.js +4 -6
  203. package/lib/dom/Animation.js +2 -4
  204. package/lib/dom/AnimationEffectTiming.js +1 -3
  205. package/lib/dom/AnimationEvent.js +1 -3
  206. package/lib/dom/AnimationTimeline.js +2 -4
  207. package/lib/dom/CustomElementRegistry.js +1 -3
  208. package/lib/dom/CustomEvent.js +1 -3
  209. package/lib/dom/Document.js +1 -3
  210. package/lib/dom/Element.js +4 -6
  211. package/lib/dom/EventTarget.js +3 -5
  212. package/lib/dom/FederatedEvent.js +1 -3
  213. package/lib/dom/FederatedMouseEvent.js +1 -3
  214. package/lib/dom/FederatedPointerEvent.js +1 -3
  215. package/lib/dom/FederatedWheelEvent.js +1 -3
  216. package/lib/dom/KeyframeEffect.js +2 -4
  217. package/lib/dom/KeyframeList.js +1 -1
  218. package/lib/dom/MutationEvent.js +1 -3
  219. package/lib/dom/MutationObserver.js +4 -11
  220. package/lib/dom/MutationRecord.js +1 -3
  221. package/lib/dom/Node.js +2 -4
  222. package/lib/index.js +1 -1
  223. package/lib/plugins/CullingPlugin.js +2 -4
  224. package/lib/plugins/DirtyCheckPlugin.js +1 -3
  225. package/lib/plugins/EventPlugin.js +5 -4
  226. package/lib/plugins/FrustumCullingStrategy.js +1 -3
  227. package/lib/plugins/PrepareRendererPlugin.js +1 -3
  228. package/lib/services/EventService.js +26 -7
  229. package/lib/services/OffscreenCanvasCreator.js +1 -3
  230. package/lib/services/RenderingContext.d.ts +2 -1
  231. package/lib/services/RenderingContext.js +4 -1
  232. package/lib/services/RenderingService.js +1 -3
  233. package/lib/services/SceneGraphSelector.js +2 -4
  234. package/lib/services/SceneGraphService.d.ts +2 -1
  235. package/lib/services/SceneGraphService.js +5 -6
  236. package/lib/services/TextService.js +3 -5
  237. package/lib/services/aabb/CircleUpdater.js +1 -3
  238. package/lib/services/aabb/EllipseUpdater.js +1 -3
  239. package/lib/services/aabb/LineUpdater.js +1 -3
  240. package/lib/services/aabb/PathUpdater.js +1 -3
  241. package/lib/services/aabb/PolylineUpdater.js +1 -3
  242. package/lib/services/aabb/RectUpdater.js +1 -3
  243. package/lib/services/aabb/TextUpdater.js +1 -3
  244. package/lib/services/aabb/index.js +10 -10
  245. package/lib/services/aabb/interfaces.d.ts +3 -2
  246. package/lib/services/aabb/interfaces.js +9 -3
  247. package/lib/shapes/AABB.js +1 -3
  248. package/lib/shapes/BoundingSphere.js +1 -3
  249. package/lib/shapes/Frustum.js +2 -4
  250. package/lib/shapes/Plane.js +1 -3
  251. package/lib/shapes/Point.js +1 -3
  252. package/lib/shapes/Ray.js +1 -3
  253. package/lib/shapes/Rectangle.js +1 -3
  254. package/lib/types.d.ts +2 -1
  255. package/lib/types.js +6 -2
  256. package/lib/utils/animation.js +2 -3
  257. package/lib/utils/bezier-easing.js +1 -1
  258. package/lib/utils/custom-easing.d.ts +0 -9
  259. package/lib/utils/custom-easing.js +42 -66
  260. package/lib/utils/math.js +9 -9
  261. package/lib/utils/path.d.ts +1 -1
  262. package/lib/utils/path.js +6 -6
  263. package/lib/utils/text.js +3 -3
  264. package/package.json +3 -3
  265. package/dist/index.umd.min.js +0 -30
package/es/dom/Element.js CHANGED
@@ -15,9 +15,7 @@ var entityCounter = 0;
15
15
  * * Animation
16
16
  */
17
17
 
18
- var Element =
19
- /** @class */
20
- function (_super) {
18
+ var Element = function (_super) {
21
19
  __extends(Element, _super);
22
20
 
23
21
  function Element() {
@@ -250,15 +248,15 @@ function (_super) {
250
248
  };
251
249
 
252
250
  Element.prototype.getElementById = function (id) {
253
- return this.sceneGraphService.querySelector("#".concat(id), this);
251
+ return this.sceneGraphService.querySelector("#" + id, this);
254
252
  };
255
253
 
256
254
  Element.prototype.getElementsByName = function (name) {
257
- return this.sceneGraphService.querySelectorAll("[name=\"".concat(name, "\"]"), this);
255
+ return this.sceneGraphService.querySelectorAll("[name=\"" + name + "\"]", this);
258
256
  };
259
257
 
260
258
  Element.prototype.getElementsByClassName = function (className) {
261
- return this.sceneGraphService.querySelectorAll(".".concat(className), this);
259
+ return this.sceneGraphService.querySelectorAll("." + className, this);
262
260
  };
263
261
 
264
262
  Element.prototype.getElementsByTagName = function (tagName) {
@@ -10,9 +10,7 @@ export var DELEGATION_SPLITTER = ':';
10
10
  * @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
11
11
  */
12
12
 
13
- var EventTarget =
14
- /** @class */
15
- function () {
13
+ var EventTarget = function () {
16
14
  function EventTarget() {
17
15
  /**
18
16
  * event emitter
@@ -54,7 +52,7 @@ function () {
54
52
  useDelegatedName = true;
55
53
  }
56
54
 
57
- type = capture ? "".concat(type, "capture") : type;
55
+ type = capture ? type + "capture" : type;
58
56
  listener = isFunction(listener) ? listener : listener.handleEvent; // compatible with G 3.0
59
57
 
60
58
  if (useDelegatedName) {
@@ -110,7 +108,7 @@ function () {
110
108
  EventTarget.prototype.removeEventListener = function (type, listener, options) {
111
109
  var capture = isBoolean(options) && options || isObject(options) && options.capture;
112
110
  var context = isFunction(listener) ? undefined : listener;
113
- type = capture ? "".concat(type, "capture") : type;
111
+ type = capture ? type + "capture" : type;
114
112
  listener = isFunction(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
115
113
  this.emitter.off(type, listener, context);
116
114
  return this;
@@ -4,9 +4,7 @@ import { Point } from '../shapes/Point';
4
4
  * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
5
5
  */
6
6
 
7
- var FederatedEvent =
8
- /** @class */
9
- function () {
7
+ var FederatedEvent = function () {
10
8
  /**
11
9
  * The event boundary which manages this event. Propagation can only occur
12
10
  * within the boundary's jurisdiction.
@@ -2,9 +2,7 @@ import { __extends } from "tslib";
2
2
  import { FederatedEvent } from './FederatedEvent';
3
3
  import { Point } from '../shapes/Point';
4
4
 
5
- var FederatedMouseEvent =
6
- /** @class */
7
- function (_super) {
5
+ var FederatedMouseEvent = function (_super) {
8
6
  __extends(FederatedMouseEvent, _super);
9
7
 
10
8
  function FederatedMouseEvent() {
@@ -1,9 +1,7 @@
1
1
  import { __extends } from "tslib";
2
2
  import { FederatedMouseEvent } from './FederatedMouseEvent';
3
3
 
4
- var FederatedPointerEvent =
5
- /** @class */
6
- function (_super) {
4
+ var FederatedPointerEvent = function (_super) {
7
5
  __extends(FederatedPointerEvent, _super);
8
6
 
9
7
  function FederatedPointerEvent() {
@@ -1,9 +1,7 @@
1
1
  import { __extends } from "tslib";
2
2
  import { FederatedMouseEvent } from './FederatedMouseEvent';
3
3
 
4
- var FederatedWheelEvent =
5
- /** @class */
6
- function (_super) {
4
+ var FederatedWheelEvent = function (_super) {
7
5
  __extends(FederatedWheelEvent, _super);
8
6
 
9
7
  function FederatedWheelEvent() {
@@ -74,9 +74,7 @@ export function numericTimingToObject(timingInput) {
74
74
  *
75
75
  */
76
76
 
77
- var KeyframeEffect =
78
- /** @class */
79
- function () {
77
+ var KeyframeEffect = function () {
80
78
  function KeyframeEffect(target, effectInput, timingInput) {
81
79
  var _this = this;
82
80
 
@@ -95,7 +95,7 @@ export function normalizeKeyframes(effectInput, timing) {
95
95
  // TODO: Support add & accumulate in KeyframeEffect.composite
96
96
  // @see https://developer.mozilla.org/en-US/docs/Web/API/KeyframeEffect/composite
97
97
  if (['replace', 'add', 'accumulate', 'auto'].indexOf(memberValue) === -1) {
98
- throw new Error("".concat(memberValue, " compositing is not supported"));
98
+ throw new Error(memberValue + " compositing is not supported");
99
99
  }
100
100
  } else if (member === 'easing') {// TODO: Validate animation-timing-function
101
101
  // @see https://developer.mozilla.org/en-US/docs/Web/CSS/animation-timing-function
@@ -1,9 +1,7 @@
1
1
  import { __extends } from "tslib";
2
2
  import { FederatedEvent } from './FederatedEvent';
3
3
 
4
- var MutationEvent =
5
- /** @class */
6
- function (_super) {
4
+ var MutationEvent = function (_super) {
7
5
  __extends(MutationEvent, _super);
8
6
 
9
7
  function MutationEvent(typeArg, relatedNode, prevValue, newValue, attrName, attrChange, prevParsedValue, newParsedValue) {
@@ -4,9 +4,7 @@ import { MutationRecord } from './MutationRecord';
4
4
  var uidCounter = 0;
5
5
  var registrationsTable = new WeakMap();
6
6
 
7
- var Registration =
8
- /** @class */
9
- function () {
7
+ var Registration = function () {
10
8
  function Registration(observer, target, options) {
11
9
  this.observer = observer;
12
10
  this.target = target;
@@ -196,9 +194,7 @@ export { Registration };
196
194
  * @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
197
195
  */
198
196
 
199
- var MutationObserver =
200
- /** @class */
201
- function () {
197
+ var MutationObserver = function () {
202
198
  function MutationObserver(callback) {
203
199
  this.callback = callback;
204
200
  this.nodes = [];
@@ -208,10 +204,7 @@ function () {
208
204
 
209
205
  MutationObserver.prototype.observe = function (target, options) {
210
206
  // 1.1
211
- if (!options.childList && !options.attributes && !options.characterData || // 1.2
212
- options.attributeOldValue && !options.attributes || // 1.3
213
- options.attributeFilter && options.attributeFilter.length && !options.attributes || // 1.4
214
- options.characterDataOldValue && !options.characterData) {
207
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
215
208
  throw new SyntaxError();
216
209
  }
217
210
 
@@ -1,6 +1,4 @@
1
- var MutationRecord =
2
- /** @class */
3
- function () {
1
+ var MutationRecord = function () {
4
2
  function MutationRecord(type, target) {
5
3
  this.type = type;
6
4
  this.target = target;
package/es/dom/Node.js CHANGED
@@ -6,9 +6,7 @@ import { EventTarget } from './EventTarget';
6
6
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node
7
7
  */
8
8
 
9
- var Node =
10
- /** @class */
11
- function (_super) {
9
+ var Node = function (_super) {
12
10
  __extends(Node, _super);
13
11
 
14
12
  function Node() {
@@ -117,7 +115,7 @@ function (_super) {
117
115
 
118
116
  if (this.nodeName === Shape.TEXT) {
119
117
  // @ts-ignore
120
- this.style.text = "".concat(content);
118
+ this.style.text = "" + content;
121
119
  } else {// this.appendChild(
122
120
  // new Text({
123
121
  // style: {
@@ -8,9 +8,7 @@ export var CullingStrategyContribution = Syringe.defineToken('CullingStrategyCon
8
8
  * 2. other custom culling strategies, eg. frustum culling
9
9
  */
10
10
 
11
- var CullingPlugin =
12
- /** @class */
13
- function () {
11
+ var CullingPlugin = function () {
14
12
  function CullingPlugin() {}
15
13
 
16
14
  CullingPlugin_1 = CullingPlugin;
@@ -6,9 +6,7 @@ import { RenderingContext, RenderReason } from '../services/RenderingContext';
6
6
  * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
7
7
  */
8
8
 
9
- var DirtyCheckPlugin =
10
- /** @class */
11
- function () {
9
+ var DirtyCheckPlugin = function () {
12
10
  function DirtyCheckPlugin() {}
13
11
 
14
12
  DirtyCheckPlugin_1 = DirtyCheckPlugin;
@@ -15,9 +15,7 @@ import { MOUSE_POINTER_ID, TOUCH_TO_POINTER } from '../utils/event';
15
15
  * also provide some extra events such as `drag`
16
16
  */
17
17
 
18
- var EventPlugin =
19
- /** @class */
20
- function () {
18
+ var EventPlugin = function () {
21
19
  function EventPlugin() {
22
20
  var _this = this;
23
21
 
@@ -305,7 +303,10 @@ function () {
305
303
  if (isUndefined(touch.twist)) touch.twist = 0;
306
304
  if (isUndefined(touch.tangentialPressure)) touch.tangentialPressure = 0;
307
305
  touch.isNormalized = true;
308
- touch.type = event.type;
306
+ touch.type = event.type; // ref to nativeEvent
307
+ // touch.nativeEvent = event;
308
+ // touch.isLast = event.changedTouches.length - 1 === i;
309
+
309
310
  normalizedEvents.push(touch);
310
311
  }
311
312
  } else if (canvas.isMouseEvent(event)) {
@@ -8,9 +8,7 @@ import { Shape } from '..'; // group is not a 2d shape
8
8
 
9
9
  var shape2D = [Shape.CIRCLE, Shape.ELLIPSE, Shape.IMAGE, Shape.RECT, Shape.LINE, Shape.POLYLINE, Shape.POLYGON, Shape.TEXT, Shape.PATH, Shape.HTML];
10
10
 
11
- var FrustumCullingStrategy =
12
- /** @class */
13
- function () {
11
+ var FrustumCullingStrategy = function () {
14
12
  function FrustumCullingStrategy() {}
15
13
 
16
14
  FrustumCullingStrategy.prototype.isVisible = function (object) {
@@ -4,9 +4,7 @@ import { StyleValueRegistry } from '../css';
4
4
  import { ElementEvent } from '../dom';
5
5
  import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
6
6
 
7
- var PrepareRendererPlugin =
8
- /** @class */
9
- function () {
7
+ var PrepareRendererPlugin = function () {
10
8
  function PrepareRendererPlugin() {}
11
9
 
12
10
  PrepareRendererPlugin_1 = PrepareRendererPlugin;
@@ -13,9 +13,7 @@ import { Point } from '../shapes';
13
13
  import { ContextService } from './ContextService';
14
14
  var PROPAGATION_LIMIT = 2048;
15
15
 
16
- var EventService =
17
- /** @class */
18
- function (_super) {
16
+ var EventService = function (_super) {
19
17
  __extends(EventService, _super);
20
18
 
21
19
  function EventService() {
@@ -49,7 +47,9 @@ function (_super) {
49
47
  this.dispatchEvent(e, 'pointerdown');
50
48
 
51
49
  if (e.pointerType === 'touch') {
52
- this.dispatchEvent(e, 'touchstart');
50
+ // only the
51
+ // if (e.isLast) {
52
+ this.dispatchEvent(e, 'touchstart'); // }
53
53
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
54
54
  isRightButton = e.button === 2;
55
55
  this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
@@ -561,7 +561,7 @@ function (_super) {
561
561
  mappers[i].fn(e);
562
562
  }
563
563
  } else {
564
- console.warn("[EventService]: Event mapping not defined for ".concat(e.type));
564
+ console.warn("[EventService]: Event mapping not defined for " + e.type);
565
565
  }
566
566
  };
567
567
 
@@ -665,8 +665,27 @@ function (_super) {
665
665
  };
666
666
 
667
667
  EventService.prototype.isNativeEventFromCanvas = function (event) {
668
+ var _a;
669
+
668
670
  var $el = this.contextService.getDomElement();
669
- return event.nativeEvent.composedPath().indexOf($el) > -1;
671
+ var target = (_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.target;
672
+
673
+ if (target) {
674
+ if (target === $el) {
675
+ return true;
676
+ }
677
+
678
+ if ($el && $el.contains) {
679
+ return $el.contains(target);
680
+ }
681
+ }
682
+
683
+ if (event.nativeEvent.composedPath) {
684
+ return event.nativeEvent.composedPath().indexOf($el) > -1;
685
+ } // account for Touch
686
+
687
+
688
+ return false;
670
689
  };
671
690
 
672
691
  EventService.prototype.createPointerEvent = function (from, type, target) {
@@ -874,7 +893,7 @@ function (_super) {
874
893
 
875
894
  EventService.prototype.notifyTarget = function (e, type) {
876
895
  type = type !== null && type !== void 0 ? type : e.type;
877
- var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? "".concat(type, "capture") : type;
896
+ var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? type + "capture" : type;
878
897
  this.notifyListeners(e, key);
879
898
 
880
899
  if (e.eventPhase === e.AT_TARGET) {
@@ -7,9 +7,7 @@ import { singleton } from 'mana-syringe';
7
7
  * - g-plugin-webgl-renderer `ctx.createLinearGradient` and generate texture
8
8
  */
9
9
 
10
- var OffscreenCanvasCreator =
11
- /** @class */
12
- function () {
10
+ var OffscreenCanvasCreator = function () {
13
11
  function OffscreenCanvasCreator() {}
14
12
 
15
13
  OffscreenCanvasCreator.prototype.getOrCreateCanvas = function (offscreenCanvas) {
@@ -1,3 +1,4 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { Group } from '../display-objects';
2
3
  /**
3
4
  * why we need re-render
@@ -7,7 +8,7 @@ export declare enum RenderReason {
7
8
  DISPLAY_OBJECT_CHANGED = 1,
8
9
  NONE = 2
9
10
  }
10
- export declare const RenderingContext = "RenderingContext";
11
+ export declare const RenderingContext: Syringe.DefinedToken;
11
12
  export interface RenderingContext {
12
13
  /**
13
14
  * root of scenegraph
@@ -1,6 +1,8 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  /**
2
3
  * why we need re-render
3
4
  */
5
+
4
6
  export var RenderReason;
5
7
 
6
8
  (function (RenderReason) {
@@ -9,4 +11,4 @@ export var RenderReason;
9
11
  RenderReason[RenderReason["NONE"] = 2] = "NONE";
10
12
  })(RenderReason || (RenderReason = {}));
11
13
 
12
- export var RenderingContext = 'RenderingContext';
14
+ export var RenderingContext = Syringe.defineToken('RenderingContext');
@@ -16,9 +16,7 @@ export var RenderingPluginContribution = Syringe.defineToken('RenderingPluginCon
16
16
  * * end frame
17
17
  */
18
18
 
19
- var RenderingService =
20
- /** @class */
21
- function () {
19
+ var RenderingService = function () {
22
20
  function RenderingService() {
23
21
  this.inited = false;
24
22
  this.stats = {
@@ -15,9 +15,7 @@ var NAME_REGEXP = /\[\s*name=(.*)\s*\]/;
15
15
  * * querySelectorAll
16
16
  */
17
17
 
18
- var DefaultSceneGraphSelector =
19
- /** @class */
20
- function () {
18
+ var DefaultSceneGraphSelector = function () {
21
19
  function DefaultSceneGraphSelector() {}
22
20
 
23
21
  DefaultSceneGraphSelector.prototype.selectOne = function (query, root) {
@@ -1,3 +1,4 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { Transform } from '../components';
2
3
  import type { vec2 } from 'gl-matrix';
3
4
  import { mat4, quat, vec3 } from 'gl-matrix';
@@ -5,7 +6,7 @@ import { AABB, Rectangle } from '../shapes';
5
6
  import type { IElement, INode, IParentNode } from '../dom/interfaces';
6
7
  export declare function sortByZIndex(o1: IElement, o2: IElement): number;
7
8
  export declare function dirtifyToRoot(element: INode, affectChildren?: boolean): void;
8
- export declare const SceneGraphService = "SceneGraphService";
9
+ export declare const SceneGraphService: Syringe.DefinedToken;
9
10
  export interface SceneGraphService {
10
11
  matches: <T extends IElement>(query: string, root: T) => boolean;
11
12
  querySelector: <R extends IElement, T extends IElement>(query: string, root: R) => T | null;
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __metadata, __read } from "tslib";
2
- import { inject, singleton } from 'mana-syringe';
2
+ import { inject, singleton, Syringe } from 'mana-syringe';
3
3
  import { isNil } from '@antv/util';
4
4
  import { mat4, quat, vec3 } from 'gl-matrix';
5
5
  import { AABB, Rectangle } from '../shapes';
@@ -45,16 +45,14 @@ export function dirtifyToRoot(element, affectChildren) {
45
45
  affectChildren: affectChildren
46
46
  });
47
47
  }
48
- export var SceneGraphService = 'SceneGraphService';
48
+ export var SceneGraphService = Syringe.defineToken('SceneGraphService');
49
49
  /**
50
50
  * update transform in scene graph
51
51
  *
52
52
  * @see https://community.khronos.org/t/scene-graphs/50542/7
53
53
  */
54
54
 
55
- var DefaultSceneGraphService =
56
- /** @class */
57
- function () {
55
+ var DefaultSceneGraphService = function () {
58
56
  function DefaultSceneGraphService() {
59
57
  var _this = this;
60
58
  /**
@@ -23,12 +23,10 @@ var regexCannotStartJaJp = /[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾー
23
23
  var regexCannotEndJaJp = /[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/;
24
24
  var regexCannotStartKoKr = /[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/;
25
25
  var regexCannotEndKoKr = /[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/;
26
- var regexCannotStart = new RegExp("".concat(regexCannotStartZhCn.source, "|").concat(regexCannotStartZhTw.source, "|").concat(regexCannotStartJaJp.source, "|").concat(regexCannotStartKoKr.source));
27
- var regexCannotEnd = new RegExp("".concat(regexCannotEndZhCn.source, "|").concat(regexCannotEndZhTw.source, "|").concat(regexCannotEndJaJp.source, "|").concat(regexCannotEndKoKr.source));
26
+ var regexCannotStart = new RegExp(regexCannotStartZhCn.source + "|" + regexCannotStartZhTw.source + "|" + regexCannotStartJaJp.source + "|" + regexCannotStartKoKr.source);
27
+ var regexCannotEnd = new RegExp(regexCannotEndZhCn.source + "|" + regexCannotEndZhTw.source + "|" + regexCannotEndJaJp.source + "|" + regexCannotEndKoKr.source);
28
28
 
29
- var TextService =
30
- /** @class */
31
- function () {
29
+ var TextService = function () {
32
30
  function TextService() {
33
31
  var _this = this;
34
32
 
@@ -3,9 +3,7 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var CircleUpdater =
7
- /** @class */
8
- function () {
6
+ var CircleUpdater = function () {
9
7
  function CircleUpdater() {}
10
8
 
11
9
  CircleUpdater.prototype.update = function (parsedStyle, object) {
@@ -3,9 +3,7 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var EllipseUpdater =
7
- /** @class */
8
- function () {
6
+ var EllipseUpdater = function () {
9
7
  function EllipseUpdater() {}
10
8
 
11
9
  EllipseUpdater.prototype.update = function (parsedStyle, object) {
@@ -3,9 +3,7 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var LineUpdater =
7
- /** @class */
8
- function () {
6
+ var LineUpdater = function () {
9
7
  function LineUpdater() {}
10
8
 
11
9
  LineUpdater.prototype.update = function (parsedStyle) {
@@ -3,9 +3,7 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var PathUpdater =
7
- /** @class */
8
- function () {
6
+ var PathUpdater = function () {
9
7
  function PathUpdater() {}
10
8
 
11
9
  PathUpdater.prototype.update = function (parsedStyle) {
@@ -3,9 +3,7 @@ import { singleton } from 'mana-syringe';
3
3
  import { GeometryAABBUpdater } from './interfaces';
4
4
  import { Shape } from '../../types';
5
5
 
6
- var PolylineUpdater =
7
- /** @class */
8
- function () {
6
+ var PolylineUpdater = function () {
9
7
  function PolylineUpdater() {}
10
8
 
11
9
  PolylineUpdater.prototype.update = function (parsedStyle) {
@@ -5,9 +5,7 @@ import { GeometryAABBUpdater } from './interfaces';
5
5
  import { Shape } from '../../types';
6
6
  import { CSSUnitValue, UnitType } from '../../css';
7
7
 
8
- var RectUpdater =
9
- /** @class */
10
- function () {
8
+ var RectUpdater = function () {
11
9
  function RectUpdater() {}
12
10
 
13
11
  RectUpdater.prototype.update = function (parsedStyle, object) {
@@ -6,9 +6,7 @@ import { TextService } from '../TextService';
6
6
  import { Shape } from '../../types';
7
7
  import { CSSUnitValue } from '../../css';
8
8
 
9
- var TextUpdater =
10
- /** @class */
11
- function () {
9
+ var TextUpdater = function () {
12
10
  function TextUpdater() {}
13
11
 
14
12
  TextUpdater.prototype.isReadyToMeasure = function (parsedStyle, object) {
@@ -1,7 +1,8 @@
1
+ import { Syringe } from 'mana-syringe';
1
2
  import type { DisplayObject } from '../../display-objects/DisplayObject';
2
3
  import type { ParsedBaseStyleProps } from '../../types';
3
- export declare const GeometryUpdaterFactory = "GeometryUpdaterFactory";
4
- export declare const GeometryAABBUpdater = "GeometryAABBUpdater";
4
+ export declare const GeometryUpdaterFactory: Syringe.DefinedToken;
5
+ export declare const GeometryAABBUpdater: Syringe.DefinedToken;
5
6
  export interface GeometryAABBUpdater<T extends ParsedBaseStyleProps = any> {
6
7
  update: (parsedStyle: T, object: DisplayObject) => {
7
8
  width: number;
@@ -1,2 +1,3 @@
1
- export var GeometryUpdaterFactory = 'GeometryUpdaterFactory';
2
- export var GeometryAABBUpdater = 'GeometryAABBUpdater';
1
+ import { Syringe } from 'mana-syringe';
2
+ export var GeometryUpdaterFactory = Syringe.defineToken('GeometryUpdaterFactory');
3
+ export var GeometryAABBUpdater = Syringe.defineToken('GeometryAABBUpdater');
package/es/shapes/AABB.js CHANGED
@@ -5,9 +5,7 @@ import { vec3 } from 'gl-matrix';
5
5
  * @see https://github.com/antvis/GWebGPUEngine/issues/3
6
6
  */
7
7
 
8
- var AABB =
9
- /** @class */
10
- function () {
8
+ var AABB = function () {
11
9
  function AABB(center, halfExtents) {
12
10
  this.min = vec3.create();
13
11
  this.max = vec3.create();
@@ -1,9 +1,7 @@
1
1
  import { vec3 } from 'gl-matrix';
2
2
  var tmpVecA = vec3.create();
3
3
 
4
- var BoundingSphere =
5
- /** @class */
6
- function () {
4
+ var BoundingSphere = function () {
7
5
  function BoundingSphere(center, radius) {
8
6
  this.center = center || vec3.create();
9
7
  this.radius = radius || 0.5;
@@ -9,9 +9,7 @@ export var Mask;
9
9
  Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
10
10
  })(Mask || (Mask = {}));
11
11
 
12
- var Frustum =
13
- /** @class */
14
- function () {
12
+ var Frustum = function () {
15
13
  function Frustum(planes) {
16
14
  this.planes = [];
17
15
 
@@ -1,8 +1,6 @@
1
1
  import { vec3 } from 'gl-matrix';
2
2
 
3
- var Plane =
4
- /** @class */
5
- function () {
3
+ var Plane = function () {
6
4
  function Plane(distance, normal) {
7
5
  this.distance = distance || 0;
8
6
  this.normal = normal || vec3.fromValues(0, 1, 0);
@@ -1,6 +1,4 @@
1
- var Point =
2
- /** @class */
3
- function () {
1
+ var Point = function () {
4
2
  function Point(x, y) {
5
3
  if (x === void 0) {
6
4
  x = 0;
package/es/shapes/Ray.js CHANGED
@@ -11,9 +11,7 @@ var tmpVecE = vec3.create();
11
11
  * @see https://github.com/mrdoob/three.js/blob/dev/src/math/Ray.js
12
12
  */
13
13
 
14
- var Ray =
15
- /** @class */
16
- function () {
14
+ var Ray = function () {
17
15
  function Ray(origin, direction) {
18
16
  this.origin = origin || vec3.create();
19
17
  this.direction = direction || vec3.fromValues(0, 0, -1);