@antv/g 5.0.16 → 5.0.17

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 (188) hide show
  1. package/es/AbstractRenderer.js +1 -3
  2. package/es/Canvas.js +1 -3
  3. package/es/DisplayObjectPool.js +1 -3
  4. package/es/camera/Camera.js +1 -3
  5. package/es/camera/Landmark.js +1 -3
  6. package/es/components/Cullable.js +1 -3
  7. package/es/components/Geometry.js +1 -3
  8. package/es/components/Renderable.js +1 -3
  9. package/es/components/Sortable.js +1 -3
  10. package/es/components/Transform.js +1 -3
  11. package/es/display-objects/Circle.js +1 -3
  12. package/es/display-objects/CustomElement.js +1 -3
  13. package/es/display-objects/DisplayObject.d.ts +5 -0
  14. package/es/display-objects/DisplayObject.js +23 -6
  15. package/es/display-objects/Ellipse.js +1 -3
  16. package/es/display-objects/Group.js +1 -3
  17. package/es/display-objects/HTML.js +3 -6
  18. package/es/display-objects/Image.js +1 -3
  19. package/es/display-objects/Line.js +1 -3
  20. package/es/display-objects/Path.js +1 -3
  21. package/es/display-objects/Polygon.js +1 -3
  22. package/es/display-objects/Polyline.js +1 -3
  23. package/es/display-objects/Rect.js +1 -3
  24. package/es/display-objects/TSpan.d.ts +1 -0
  25. package/es/display-objects/TSpan.js +0 -0
  26. package/es/display-objects/Text.d.ts +23 -0
  27. package/es/display-objects/Text.js +56 -4
  28. package/es/dom/Animation.js +3 -5
  29. package/es/dom/AnimationEffectTiming.js +1 -3
  30. package/es/dom/AnimationEvent.js +1 -3
  31. package/es/dom/AnimationTimeline.js +1 -3
  32. package/es/dom/CustomElementRegistry.js +1 -3
  33. package/es/dom/CustomEvent.js +1 -3
  34. package/es/dom/Document.d.ts +1 -1
  35. package/es/dom/Document.js +3 -5
  36. package/es/dom/Element.d.ts +22 -0
  37. package/es/dom/Element.js +68 -6
  38. package/es/dom/EventTarget.js +3 -5
  39. package/es/dom/FederatedEvent.d.ts +5 -2
  40. package/es/dom/FederatedEvent.js +1 -3
  41. package/es/dom/FederatedMouseEvent.js +1 -3
  42. package/es/dom/FederatedPointerEvent.js +1 -3
  43. package/es/dom/FederatedWheelEvent.js +1 -3
  44. package/es/dom/KeyframeEffect.js +1 -3
  45. package/es/dom/KeyframeList.js +1 -1
  46. package/es/dom/MutationEvent.js +1 -3
  47. package/es/dom/MutationObserver.js +3 -10
  48. package/es/dom/MutationRecord.js +1 -3
  49. package/es/dom/Node.js +2 -4
  50. package/es/plugins/CullingPlugin.js +1 -3
  51. package/es/plugins/DirtyCheckPlugin.js +1 -3
  52. package/es/plugins/EventPlugin.d.ts +2 -1
  53. package/es/plugins/EventPlugin.js +16 -8
  54. package/es/plugins/FrustumCullingStrategy.js +1 -3
  55. package/es/plugins/PrepareRendererPlugin.js +1 -3
  56. package/es/property-handlers/color.js +2 -2
  57. package/es/property-handlers/dimension.js +1 -1
  58. package/es/property-handlers/path.d.ts +1 -1
  59. package/es/property-handlers/text.js +1 -1
  60. package/es/services/EventService.js +3 -5
  61. package/es/services/RenderingService.js +1 -3
  62. package/es/services/SceneGraphSelector.js +1 -3
  63. package/es/services/SceneGraphService.js +1 -3
  64. package/es/services/aabb/CircleUpdater.js +1 -3
  65. package/es/services/aabb/EllipseUpdater.js +1 -3
  66. package/es/services/aabb/LineUpdater.js +1 -3
  67. package/es/services/aabb/PathUpdater.js +1 -3
  68. package/es/services/aabb/PolylineUpdater.js +1 -3
  69. package/es/services/aabb/RectUpdater.js +1 -3
  70. package/es/services/aabb/TextUpdater.js +1 -3
  71. package/es/services/text/OffscreenCanvasCreator.js +1 -3
  72. package/es/services/text/index.js +3 -5
  73. package/es/shapes/AABB.js +1 -3
  74. package/es/shapes/BoundingSphere.js +1 -3
  75. package/es/shapes/Frustum.js +1 -3
  76. package/es/shapes/Plane.js +1 -3
  77. package/es/shapes/Point.js +1 -3
  78. package/es/shapes/Polygon.js +1 -3
  79. package/es/shapes/Ray.js +1 -3
  80. package/es/shapes/Rect.js +1 -3
  81. package/es/shapes/Rectangle.js +1 -3
  82. package/es/utils/animation.js +1 -1
  83. package/es/utils/custom-easing.js +1 -1
  84. package/es/utils/path.d.ts +1 -1
  85. package/es/utils/path.js +3 -3
  86. package/es/utils/text.js +3 -3
  87. package/lib/AbstractRenderer.js +1 -3
  88. package/lib/Canvas.js +2 -4
  89. package/lib/DisplayObjectPool.js +1 -3
  90. package/lib/camera/Camera.js +2 -4
  91. package/lib/camera/Landmark.js +1 -3
  92. package/lib/components/Cullable.js +2 -4
  93. package/lib/components/Geometry.js +1 -3
  94. package/lib/components/Renderable.js +1 -3
  95. package/lib/components/Sortable.js +1 -3
  96. package/lib/components/Transform.js +1 -3
  97. package/lib/display-objects/Circle.js +1 -3
  98. package/lib/display-objects/CustomElement.js +1 -3
  99. package/lib/display-objects/DisplayObject.d.ts +5 -0
  100. package/lib/display-objects/DisplayObject.js +24 -6
  101. package/lib/display-objects/Ellipse.js +1 -3
  102. package/lib/display-objects/Group.js +1 -3
  103. package/lib/display-objects/HTML.js +4 -6
  104. package/lib/display-objects/Image.js +1 -3
  105. package/lib/display-objects/Line.js +1 -3
  106. package/lib/display-objects/Path.js +1 -3
  107. package/lib/display-objects/Polygon.js +1 -3
  108. package/lib/display-objects/Polyline.js +1 -3
  109. package/lib/display-objects/Rect.js +1 -3
  110. package/lib/display-objects/TSpan.d.ts +1 -0
  111. package/lib/display-objects/TSpan.js +1 -0
  112. package/lib/display-objects/Text.d.ts +23 -0
  113. package/lib/display-objects/Text.js +57 -4
  114. package/lib/dom/Animation.js +3 -5
  115. package/lib/dom/AnimationEffectTiming.js +1 -3
  116. package/lib/dom/AnimationEvent.js +1 -3
  117. package/lib/dom/AnimationTimeline.js +2 -4
  118. package/lib/dom/CustomElementRegistry.js +1 -3
  119. package/lib/dom/CustomEvent.js +1 -3
  120. package/lib/dom/Document.d.ts +1 -1
  121. package/lib/dom/Document.js +4 -6
  122. package/lib/dom/Element.d.ts +22 -0
  123. package/lib/dom/Element.js +68 -6
  124. package/lib/dom/EventTarget.js +3 -5
  125. package/lib/dom/FederatedEvent.d.ts +5 -2
  126. package/lib/dom/FederatedEvent.js +1 -3
  127. package/lib/dom/FederatedMouseEvent.js +1 -3
  128. package/lib/dom/FederatedPointerEvent.js +1 -3
  129. package/lib/dom/FederatedWheelEvent.js +1 -3
  130. package/lib/dom/KeyframeEffect.js +2 -4
  131. package/lib/dom/KeyframeList.js +1 -1
  132. package/lib/dom/MutationEvent.js +1 -3
  133. package/lib/dom/MutationObserver.js +4 -11
  134. package/lib/dom/MutationRecord.js +1 -3
  135. package/lib/dom/Node.js +2 -4
  136. package/lib/global-module.js +2 -3
  137. package/lib/index.js +1 -1
  138. package/lib/plugins/CullingPlugin.js +2 -4
  139. package/lib/plugins/DirtyCheckPlugin.js +1 -3
  140. package/lib/plugins/EventPlugin.d.ts +2 -1
  141. package/lib/plugins/EventPlugin.js +14 -8
  142. package/lib/plugins/FrustumCullingStrategy.js +1 -3
  143. package/lib/plugins/PrepareRendererPlugin.js +1 -3
  144. package/lib/property-handlers/color.js +5 -5
  145. package/lib/property-handlers/dimension.js +5 -6
  146. package/lib/property-handlers/inherit.js +1 -1
  147. package/lib/property-handlers/interfaces.js +1 -1
  148. package/lib/property-handlers/numeric.js +3 -3
  149. package/lib/property-handlers/path.d.ts +1 -1
  150. package/lib/property-handlers/path.js +1 -1
  151. package/lib/property-handlers/text.js +1 -1
  152. package/lib/property-handlers/transform.js +1 -1
  153. package/lib/services/EventService.js +3 -5
  154. package/lib/services/RenderingService.js +1 -3
  155. package/lib/services/SceneGraphSelector.js +2 -4
  156. package/lib/services/SceneGraphService.js +3 -5
  157. package/lib/services/aabb/CircleUpdater.js +1 -3
  158. package/lib/services/aabb/EllipseUpdater.js +1 -3
  159. package/lib/services/aabb/LineUpdater.js +1 -3
  160. package/lib/services/aabb/PathUpdater.js +1 -3
  161. package/lib/services/aabb/PolylineUpdater.js +1 -3
  162. package/lib/services/aabb/RectUpdater.js +1 -3
  163. package/lib/services/aabb/TextUpdater.js +1 -3
  164. package/lib/services/aabb/index.js +10 -10
  165. package/lib/services/aabb/interfaces.js +1 -1
  166. package/lib/services/text/OffscreenCanvasCreator.js +1 -3
  167. package/lib/services/text/index.js +3 -5
  168. package/lib/shapes/AABB.js +1 -3
  169. package/lib/shapes/BoundingSphere.js +1 -3
  170. package/lib/shapes/Frustum.js +2 -4
  171. package/lib/shapes/Plane.js +1 -3
  172. package/lib/shapes/Point.js +1 -3
  173. package/lib/shapes/Polygon.js +1 -3
  174. package/lib/shapes/Ray.js +1 -3
  175. package/lib/shapes/Rect.js +1 -3
  176. package/lib/shapes/Rectangle.js +1 -3
  177. package/lib/types.js +1 -1
  178. package/lib/utils/animation.js +3 -4
  179. package/lib/utils/bezier-easing.js +1 -1
  180. package/lib/utils/custom-easing.js +2 -2
  181. package/lib/utils/event.js +2 -3
  182. package/lib/utils/math.js +5 -5
  183. package/lib/utils/path.d.ts +1 -1
  184. package/lib/utils/path.js +6 -6
  185. package/lib/utils/raf.js +1 -2
  186. package/lib/utils/text.js +3 -3
  187. package/package.json +2 -2
  188. package/dist/index.umd.min.js +0 -31
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() {
@@ -240,15 +238,15 @@ function (_super) {
240
238
  };
241
239
 
242
240
  Element.prototype.getElementById = function (id) {
243
- return this.sceneGraphService.querySelector("#".concat(id), this);
241
+ return this.sceneGraphService.querySelector("#" + id, this);
244
242
  };
245
243
 
246
244
  Element.prototype.getElementsByName = function (name) {
247
- return this.sceneGraphService.querySelectorAll("[name=\"".concat(name, "\"]"), this);
245
+ return this.sceneGraphService.querySelectorAll("[name=\"" + name + "\"]", this);
248
246
  };
249
247
 
250
248
  Element.prototype.getElementsByClassName = function (className) {
251
- return this.sceneGraphService.querySelectorAll(".".concat(className), this);
249
+ return this.sceneGraphService.querySelectorAll("." + className, this);
252
250
  };
253
251
 
254
252
  Element.prototype.getElementsByTagName = function (tagName) {
@@ -479,6 +477,14 @@ function (_super) {
479
477
  Element.prototype.getClientRects = function () {
480
478
  return [this.getBoundingClientRect()];
481
479
  };
480
+ /**
481
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
482
+ */
483
+
484
+
485
+ Element.prototype.getAttributeNames = function () {
486
+ return Object.keys(this.attributes);
487
+ };
482
488
  /**
483
489
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
484
490
  */
@@ -492,6 +498,22 @@ function (_super) {
492
498
 
493
499
  return isNil(value) ? null : value;
494
500
  };
501
+ /**
502
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute
503
+ */
504
+
505
+
506
+ Element.prototype.hasAttribute = function (qualifiedName) {
507
+ return this.getAttributeNames().includes(qualifiedName);
508
+ };
509
+ /**
510
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes
511
+ */
512
+
513
+
514
+ Element.prototype.hasAttributes = function () {
515
+ return !!this.getAttributeNames().length;
516
+ };
495
517
  /**
496
518
  * should use removeAttribute() instead of setting the attribute value to null either directly or using setAttribute(). Many attributes will not behave as expected if you set them to null.
497
519
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute
@@ -515,6 +537,46 @@ function (_super) {
515
537
  this.attributes[attributeName] = value;
516
538
  };
517
539
 
540
+ Element.prototype.getAttributeNS = function (namespace, localName) {
541
+ throw new Error('Method not implemented.');
542
+ };
543
+
544
+ Element.prototype.getAttributeNode = function (qualifiedName) {
545
+ throw new Error('Method not implemented.');
546
+ };
547
+
548
+ Element.prototype.getAttributeNodeNS = function (namespace, localName) {
549
+ throw new Error('Method not implemented.');
550
+ };
551
+
552
+ Element.prototype.hasAttributeNS = function (namespace, localName) {
553
+ throw new Error('Method not implemented.');
554
+ };
555
+
556
+ Element.prototype.removeAttributeNS = function (namespace, localName) {
557
+ throw new Error('Method not implemented.');
558
+ };
559
+
560
+ Element.prototype.removeAttributeNode = function (attr) {
561
+ throw new Error('Method not implemented.');
562
+ };
563
+
564
+ Element.prototype.setAttributeNS = function (namespace, qualifiedName, value) {
565
+ throw new Error('Method not implemented.');
566
+ };
567
+
568
+ Element.prototype.setAttributeNode = function (attr) {
569
+ throw new Error('Method not implemented.');
570
+ };
571
+
572
+ Element.prototype.setAttributeNodeNS = function (attr) {
573
+ throw new Error('Method not implemented.');
574
+ };
575
+
576
+ Element.prototype.toggleAttribute = function (qualifiedName, force) {
577
+ throw new Error('Method not implemented.');
578
+ };
579
+
518
580
  return Element;
519
581
  }(Node);
520
582
 
@@ -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;
@@ -1,6 +1,6 @@
1
1
  import { Point } from '../shapes/Point';
2
2
  import type { EventService } from '../services';
3
- import type { IEventTarget } from './interfaces';
3
+ import type { IEventTarget, ICanvas } from './interfaces';
4
4
  /**
5
5
  * An DOM-compatible synthetic event implementation that is "forwarded" on behalf of an original
6
6
  * FederatedEvent or native {@link https://dom.spec.whatwg.org/#event Event}.
@@ -127,13 +127,16 @@ export declare class FederatedEvent<N extends Event = Event, T = any> {
127
127
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/stopPropagation
128
128
  */
129
129
  stopPropagation(): void;
130
+ /**
131
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
132
+ */
133
+ view: ICanvas;
130
134
  /**
131
135
  * added for compatibility with DOM Event,
132
136
  * deprecated props and methods
133
137
  */
134
138
  initEvent(): void;
135
139
  initUIEvent(): void;
136
- view: WindowProxy;
137
140
  which: number;
138
141
  returnValue: boolean;
139
142
  srcElement: IEventTarget;
@@ -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) {
@@ -5,9 +5,7 @@ import { MutationRecord } from './MutationRecord';
5
5
  var uidCounter = 0;
6
6
  var registrationsTable = new WeakMap();
7
7
 
8
- var Registration =
9
- /** @class */
10
- function () {
8
+ var Registration = function () {
11
9
  function Registration(observer, target, options) {
12
10
  this.observer = observer;
13
11
  this.target = target;
@@ -197,9 +195,7 @@ export { Registration };
197
195
  * @see https://github.com/googlearchive/MutationObservers/blob/master/MutationObserver.js
198
196
  */
199
197
 
200
- var MutationObserver =
201
- /** @class */
202
- function () {
198
+ var MutationObserver = function () {
203
199
  function MutationObserver(callback) {
204
200
  this.callback = callback;
205
201
  this.nodes = [];
@@ -209,10 +205,7 @@ function () {
209
205
 
210
206
  MutationObserver.prototype.observe = function (target, options) {
211
207
  // 1.1
212
- if (!options.childList && !options.attributes && !options.characterData || // 1.2
213
- options.attributeOldValue && !options.attributes || // 1.3
214
- options.attributeFilter && options.attributeFilter.length && !options.attributes || // 1.4
215
- options.characterDataOldValue && !options.characterData) {
208
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
216
209
  throw new SyntaxError();
217
210
  }
218
211
 
@@ -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;
@@ -7,9 +7,7 @@ import { RenderingContext, RenderReason } from '../services/RenderingContext';
7
7
  * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
8
8
  */
9
9
 
10
- var DirtyCheckPlugin =
11
- /** @class */
12
- function () {
10
+ var DirtyCheckPlugin = function () {
13
11
  function DirtyCheckPlugin() {}
14
12
 
15
13
  DirtyCheckPlugin_1 = DirtyCheckPlugin;
@@ -1,4 +1,4 @@
1
- import type { RenderingPlugin } from '../services';
1
+ import { RenderingPlugin } from '../services';
2
2
  import { RenderingService } from '../services';
3
3
  /**
4
4
  * support mouse & touch events
@@ -11,6 +11,7 @@ export declare class EventPlugin implements RenderingPlugin {
11
11
  private canvasConfig;
12
12
  private contextService;
13
13
  private renderingService;
14
+ private renderingContext;
14
15
  private eventService;
15
16
  private autoPreventDefault;
16
17
  private rootPointerEvent;
@@ -2,6 +2,7 @@ import { __awaiter, __decorate, __generator, __metadata, __values } from "tslib"
2
2
  import { inject, singleton } from 'mana-syringe';
3
3
  import { FederatedPointerEvent } from '../dom/FederatedPointerEvent';
4
4
  import { FederatedWheelEvent } from '../dom/FederatedWheelEvent';
5
+ import { RenderingContext } from '../services';
5
6
  import { ContextService, RenderingService, EventService, RenderingPluginContribution } from '../services';
6
7
  import { Point } from '../shapes';
7
8
  import { CanvasConfig } from '../types';
@@ -13,9 +14,7 @@ import { normalizeToPointerEvent, supportsTouchEvents, TOUCH_TO_POINTER } from '
13
14
  * also provide some extra events such as `drag`
14
15
  */
15
16
 
16
- var EventPlugin =
17
- /** @class */
18
- function () {
17
+ var EventPlugin = function () {
19
18
  function EventPlugin() {
20
19
  var _this = this;
21
20
 
@@ -26,6 +25,8 @@ function () {
26
25
  this.onPointerMove = function (nativeEvent) {
27
26
  var e_1, _a;
28
27
 
28
+ var _b, _c;
29
+
29
30
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') return;
30
31
  var normalizedEvents = normalizeToPointerEvent(nativeEvent);
31
32
 
@@ -33,7 +34,7 @@ function () {
33
34
  for (var normalizedEvents_1 = __values(normalizedEvents), normalizedEvents_1_1 = normalizedEvents_1.next(); !normalizedEvents_1_1.done; normalizedEvents_1_1 = normalizedEvents_1.next()) {
34
35
  var normalizedEvent = normalizedEvents_1_1.value;
35
36
 
36
- var event_1 = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent);
37
+ var event_1 = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, (_c = (_b = _this.renderingContext.root) === null || _b === void 0 ? void 0 : _b.ownerDocument) === null || _c === void 0 ? void 0 : _c.defaultView);
37
38
 
38
39
  _this.eventService.mapEvent(event_1);
39
40
  }
@@ -88,6 +89,8 @@ function () {
88
89
  renderingService.hooks.pointerDown.tap(EventPlugin_1.tag, function (nativeEvent) {
89
90
  var e_2, _a;
90
91
 
92
+ var _b, _c;
93
+
91
94
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') {
92
95
  return;
93
96
  }
@@ -106,7 +109,7 @@ function () {
106
109
  for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
107
110
  var event_2 = events_1_1.value;
108
111
 
109
- var federatedEvent = _this.bootstrapEvent(_this.rootPointerEvent, event_2);
112
+ var federatedEvent = _this.bootstrapEvent(_this.rootPointerEvent, event_2, (_c = (_b = _this.renderingContext.root) === null || _b === void 0 ? void 0 : _b.ownerDocument) === null || _c === void 0 ? void 0 : _c.defaultView);
110
113
 
111
114
  _this.eventService.mapEvent(federatedEvent);
112
115
  }
@@ -127,6 +130,8 @@ function () {
127
130
  renderingService.hooks.pointerUp.tap(EventPlugin_1.tag, function (nativeEvent) {
128
131
  var e_3, _a;
129
132
 
133
+ var _b, _c;
134
+
130
135
  if (supportsTouchEvents && nativeEvent.pointerType === 'touch') return; // account for element in SVG
131
136
 
132
137
  var $element = _this.contextService.getDomElement();
@@ -140,7 +145,7 @@ function () {
140
145
  for (var normalizedEvents_2 = __values(normalizedEvents), normalizedEvents_2_1 = normalizedEvents_2.next(); !normalizedEvents_2_1.done; normalizedEvents_2_1 = normalizedEvents_2.next()) {
141
146
  var normalizedEvent = normalizedEvents_2_1.value;
142
147
 
143
- var event_3 = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent);
148
+ var event_3 = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, (_c = (_b = _this.renderingContext.root) === null || _b === void 0 ? void 0 : _b.ownerDocument) === null || _c === void 0 ? void 0 : _c.defaultView);
144
149
 
145
150
  event_3.type += outside;
146
151
 
@@ -165,8 +170,9 @@ function () {
165
170
  renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
166
171
  };
167
172
 
168
- EventPlugin.prototype.bootstrapEvent = function (event, nativeEvent) {
169
- // @ts-ignore
173
+ EventPlugin.prototype.bootstrapEvent = function (event, nativeEvent, view) {
174
+ event.view = view; // @ts-ignore
175
+
170
176
  event._originalEvent = null;
171
177
  event.nativeEvent = nativeEvent;
172
178
  event.pointerId = nativeEvent.pointerId;
@@ -278,6 +284,8 @@ function () {
278
284
 
279
285
  __decorate([inject(RenderingService), __metadata("design:type", RenderingService)], EventPlugin.prototype, "renderingService", void 0);
280
286
 
287
+ __decorate([inject(RenderingContext), __metadata("design:type", Object)], EventPlugin.prototype, "renderingContext", void 0);
288
+
281
289
  __decorate([inject(EventService), __metadata("design:type", EventService)], EventPlugin.prototype, "eventService", void 0);
282
290
 
283
291
  EventPlugin = EventPlugin_1 = __decorate([singleton({
@@ -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) {
@@ -6,9 +6,7 @@ import { INHERIT_PROPERTIES } from '../global-module';
6
6
  import { computeInheritStyleProperty } from '../property-handlers';
7
7
  import { RenderingContext, RenderReason, RenderingPluginContribution, dirtifyToRoot } from '../services';
8
8
 
9
- var PrepareRendererPlugin =
10
- /** @class */
11
- function () {
9
+ var PrepareRendererPlugin = function () {
12
10
  function PrepareRendererPlugin() {}
13
11
 
14
12
  PrepareRendererPlugin_1 = PrepareRendererPlugin;
@@ -84,7 +84,7 @@ export function parseColor(colorStr) {
84
84
  return {
85
85
  type: PARSED_COLOR_TYPE.Constant,
86
86
  value: rgba,
87
- formatted: color && "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(color.opacity, ")") || 'rgba(0,0,0,0)'
87
+ formatted: color && "rgba(" + color.r + "," + color.g + "," + color.b + "," + color.opacity + ")" || 'rgba(0,0,0,0)'
88
88
  };
89
89
  }
90
90
  export function mergeColors(left, right) {
@@ -103,7 +103,7 @@ export function mergeColors(left, right) {
103
103
  }
104
104
 
105
105
  rgba[3] = clamp(rgba[3], 0, 1);
106
- return "rgba(".concat(rgba.join(','), ")");
106
+ return "rgba(" + rgba.join(',') + ")";
107
107
  }];
108
108
  }
109
109
 
@@ -13,7 +13,7 @@ function isAngleUnit(unit) {
13
13
  }
14
14
 
15
15
  export function parseDimension(unitRegExp, string, object, name) {
16
- string = "".concat(string).trim().toLowerCase();
16
+ string = ("" + string).trim().toLowerCase();
17
17
 
18
18
  if (string === 'inherit') {
19
19
  var computed = computeInheritStyleProperty(object, name);
@@ -1,4 +1,4 @@
1
1
  import type { PathCommand } from '../types';
2
2
  import type { ParsedPathStyleProps } from '../display-objects';
3
3
  export declare function parsePath(path: string): ParsedPathStyleProps;
4
- export declare function mergePaths(left: ParsedPathStyleProps, right: ParsedPathStyleProps): ((string[] | ["a" | "A", number, number, number, number, number, number, number] | ["C" | "c", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["q" | "Q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["t" | "T", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[] | ((pathArray: PathCommand[]) => PathCommand[]))[];
4
+ export declare function mergePaths(left: ParsedPathStyleProps, right: ParsedPathStyleProps): ((string[] | ["a" | "A", number, number, number, number, number, number, number] | ["C" | "c", number, number, number, number, number, number] | ["o" | "O", number, number] | ["h" | "H", number] | ["l" | "L", number, number] | ["m" | "M", number, number] | ["r" | "R", number, number, number, number] | ["Q" | "q", number, number, number, number] | ["s" | "S", number, number, number, number, number, number, number] | ["t" | "T", number, number] | ["v" | "V", number] | ["u" | "U", number, number, number])[] | ((pathArray: PathCommand[]) => PathCommand[]))[];
@@ -1,3 +1,3 @@
1
1
  export function updateText(oldValue, newValue, object) {
2
- object.nodeValue = "".concat(newValue) || '';
2
+ object.nodeValue = "" + newValue || '';
3
3
  }
@@ -13,9 +13,7 @@ import { ContextService } from './ContextService';
13
13
  import { mat4, vec3 } from 'gl-matrix';
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() {
@@ -561,7 +559,7 @@ function (_super) {
561
559
  mappers[i].fn(e);
562
560
  }
563
561
  } else {
564
- console.warn("[EventService]: Event mapping not defined for ".concat(e.type));
562
+ console.warn("[EventService]: Event mapping not defined for " + e.type);
565
563
  }
566
564
  };
567
565
 
@@ -851,7 +849,7 @@ function (_super) {
851
849
 
852
850
  EventService.prototype.notifyTarget = function (e, type) {
853
851
  type = type !== null && type !== void 0 ? type : e.type;
854
- var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? "".concat(type, "capture") : type;
852
+ var key = e.eventPhase === e.CAPTURING_PHASE || e.eventPhase === e.AT_TARGET ? type + "capture" : type;
855
853
  this.notifyListeners(e, key);
856
854
 
857
855
  if (e.eventPhase === e.AT_TARGET) {
@@ -15,9 +15,7 @@ export var RenderingPluginContribution = Syringe.defineToken('RenderingPluginCon
15
15
  * * end frame
16
16
  */
17
17
 
18
- var RenderingService =
19
- /** @class */
20
- function () {
18
+ var RenderingService = function () {
21
19
  function RenderingService() {
22
20
  this.inited = false;
23
21
  this.stats = {
@@ -12,9 +12,7 @@ export var SceneGraphSelector = Syringe.defineToken('SceneGraphSelector', {
12
12
  * * getElementsByTag
13
13
  */
14
14
 
15
- var DefaultSceneGraphSelector =
16
- /** @class */
17
- function () {
15
+ var DefaultSceneGraphSelector = function () {
18
16
  function DefaultSceneGraphSelector() {}
19
17
 
20
18
  DefaultSceneGraphSelector.prototype.selectOne = function (query, root) {
@@ -52,9 +52,7 @@ export var SceneGraphService = 'SceneGraphService';
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
  /**
@@ -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) {
@@ -4,9 +4,7 @@ import { isString } from '@antv/util';
4
4
  import { GeometryAABBUpdater } from './interfaces';
5
5
  import { Shape } from '../../types';
6
6
 
7
- var RectUpdater =
8
- /** @class */
9
- function () {
7
+ var RectUpdater = function () {
10
8
  function RectUpdater() {}
11
9
 
12
10
  RectUpdater.prototype.update = function (parsedStyle, object) {