@antv/g-webgpu 1.7.27 → 1.7.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -6744,6 +6744,33 @@
6744
6744
  out[15] = m33;
6745
6745
  return out;
6746
6746
  }
6747
+ /**
6748
+ * Set a mat4 to the identity matrix
6749
+ *
6750
+ * @param {mat4} out the receiving matrix
6751
+ * @returns {mat4} out
6752
+ */
6753
+
6754
+
6755
+ function identity(out) {
6756
+ out[0] = 1;
6757
+ out[1] = 0;
6758
+ out[2] = 0;
6759
+ out[3] = 0;
6760
+ out[4] = 0;
6761
+ out[5] = 1;
6762
+ out[6] = 0;
6763
+ out[7] = 0;
6764
+ out[8] = 0;
6765
+ out[9] = 0;
6766
+ out[10] = 1;
6767
+ out[11] = 0;
6768
+ out[12] = 0;
6769
+ out[13] = 0;
6770
+ out[14] = 0;
6771
+ out[15] = 1;
6772
+ return out;
6773
+ }
6747
6774
  /**
6748
6775
  * Multiplies two mat4s
6749
6776
  *
@@ -11966,7 +11993,7 @@
11966
11993
  var path;
11967
11994
 
11968
11995
  if (object.nodeName !== gLite.Shape.PATH) {
11969
- path = gLite.parsePath(gLite.convertToPath(object, false), object);
11996
+ path = gLite.parsePath(gLite.convertToPath(object, identity(create())), object);
11970
11997
  defX = path.rect.x;
11971
11998
  defY = path.rect.y; // support negative width/height of Rect
11972
11999
 
@@ -13539,14 +13566,10 @@
13539
13566
  var eps = 0.01; // only contains M & L commands
13540
13567
 
13541
13568
  if (curve.length === 2 && curve[0][0] === 'M' && curve[1][0] === 'C') {
13542
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13543
13569
  var _curve$ = curve[0],
13544
- _1 = _curve$[0],
13545
13570
  p1x = _curve$[1],
13546
- p1y = _curve$[2]; // eslint-disable-next-line @typescript-eslint/no-unused-vars
13547
-
13571
+ p1y = _curve$[2];
13548
13572
  var _curve$2 = curve[1],
13549
- _2 = _curve$2[0],
13550
13573
  cpx1 = _curve$2[1],
13551
13574
  cpy1 = _curve$2[2],
13552
13575
  cpx2 = _curve$2[3],
@@ -15560,7 +15583,8 @@
15560
15583
 
15561
15584
  var camera = context.camera,
15562
15585
  renderingContext = context.renderingContext,
15563
- renderingService = context.renderingService;
15586
+ renderingService = context.renderingService,
15587
+ displayObjectPool = context.displayObjectPool;
15564
15588
  this.context = context;
15565
15589
  var canvas = renderingContext.root.ownerDocument.defaultView;
15566
15590
 
@@ -15572,7 +15596,11 @@
15572
15596
  var object = e.target;
15573
15597
 
15574
15598
  if (object.nodeName === gLite.Shape.HTML) {
15575
- // create DOM element
15599
+ if (!_this.$camera) {
15600
+ _this.$camera = _this.createCamera(camera);
15601
+ } // create DOM element
15602
+
15603
+
15576
15604
  var $el = _this.getOrCreateEl(object);
15577
15605
 
15578
15606
  _this.$camera.appendChild($el); // apply documentElement's style
@@ -15627,11 +15655,13 @@
15627
15655
  };
15628
15656
 
15629
15657
  var handleCanvasResize = function handleCanvasResize() {
15630
- var _this$context$config = _this.context.config,
15631
- width = _this$context$config.width,
15632
- height = _this$context$config.height;
15633
- _this.$camera.style.width = (width || 0) + "px";
15634
- _this.$camera.style.height = (height || 0) + "px";
15658
+ if (_this.$camera) {
15659
+ var _this$context$config = _this.context.config,
15660
+ width = _this$context$config.width,
15661
+ height = _this$context$config.height;
15662
+ _this.$camera.style.width = (width || 0) + "px";
15663
+ _this.$camera.style.height = (height || 0) + "px";
15664
+ }
15635
15665
  };
15636
15666
 
15637
15667
  renderingService.hooks.init.tapPromise(HTMLRenderingPlugin.tag, /*#__PURE__*/_asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee() {
@@ -15639,8 +15669,11 @@
15639
15669
  while (1) {
15640
15670
  switch (_context.prev = _context.next) {
15641
15671
  case 0:
15642
- // append camera
15643
- _this.$camera = _this.createCamera(camera);
15672
+ if (displayObjectPool.getHTMLs().length) {
15673
+ // append camera
15674
+ _this.$camera = _this.createCamera(camera);
15675
+ }
15676
+
15644
15677
  canvas.addEventListener(gLite.CanvasEvent.RESIZE, handleCanvasResize);
15645
15678
  canvas.addEventListener(gLite.ElementEvent.MOUNTED, handleMounted);
15646
15679
  canvas.addEventListener(gLite.ElementEvent.UNMOUNTED, handleUnmounted);