@antv/g-lite 2.0.4 → 2.0.6

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.esm.js CHANGED
@@ -1679,6 +1679,7 @@ var Camera = /** @class */ (function () {
1679
1679
  * 计算 MV 矩阵,为相机矩阵的逆矩阵
1680
1680
  */
1681
1681
  Camera.prototype.getViewTransform = function () {
1682
+ // mat4.scale(this.matrix, this.matrix, vec3.fromValues(1, -1, 1));
1682
1683
  return mat4.invert(mat4.create(), this.matrix);
1683
1684
  };
1684
1685
  Camera.prototype.getWorldTransform = function () {
@@ -1806,7 +1807,10 @@ var Camera = /** @class */ (function () {
1806
1807
  var dvec = vec3.fromValues(cx - ox, cy - oy, 0);
1807
1808
  var dx = vec3.dot(dvec, this.right) / vec3.length(this.right);
1808
1809
  var dy = vec3.dot(dvec, this.up) / vec3.length(this.up);
1809
- this.pan(-dx, -dy);
1810
+ var _c = __read(this.getPosition(), 2), px = _c[0], py = _c[1];
1811
+ var _d = __read(this.getFocalPoint(), 2), fx = _d[0], fy = _d[1];
1812
+ this.setPosition(px - dx, py - dy);
1813
+ this.setFocalPoint(fx - dx, fy - dy);
1810
1814
  return this;
1811
1815
  };
1812
1816
  Camera.prototype.setPerspective = function (near, far, fov, aspect) {
@@ -1828,9 +1832,7 @@ var Camera = /** @class */ (function () {
1828
1832
  width *= this.view.width / fullWidth;
1829
1833
  height *= this.view.height / fullHeight;
1830
1834
  }
1831
- makePerspective(this.projectionMatrix, left, left + width, top, top - height, near, this.far, this.clipSpaceNearZ === ClipSpaceNearZ.ZERO);
1832
- // flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
1833
- mat4.scale(this.projectionMatrix, this.projectionMatrix, vec3.fromValues(1, -1, 1));
1835
+ makePerspective(this.projectionMatrix, left, left + width, top - height, top, near, this.far, this.clipSpaceNearZ === ClipSpaceNearZ.ZERO);
1834
1836
  mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
1835
1837
  this.triggerUpdate();
1836
1838
  return this;
@@ -1861,13 +1863,13 @@ var Camera = /** @class */ (function () {
1861
1863
  bottom = top - scaleH * this.view.height;
1862
1864
  }
1863
1865
  if (this.clipSpaceNearZ === ClipSpaceNearZ.NEGATIVE_ONE) {
1864
- mat4.ortho(this.projectionMatrix, left, right, bottom, top, near, far);
1866
+ // FlipY with switching bottom & top.
1867
+ // @see https://stackoverflow.com/a/4886656
1868
+ mat4.ortho(this.projectionMatrix, left, right, top, bottom, near, far);
1865
1869
  }
1866
1870
  else {
1867
- mat4.orthoZO(this.projectionMatrix, left, right, bottom, top, near, far);
1871
+ mat4.orthoZO(this.projectionMatrix, left, right, top, bottom, near, far);
1868
1872
  }
1869
- // flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
1870
- mat4.scale(this.projectionMatrix, this.projectionMatrix, vec3.fromValues(1, -1, 1));
1871
1873
  mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
1872
1874
  this._getOrthoMatrix();
1873
1875
  this.triggerUpdate();
@@ -15191,6 +15193,10 @@ var Canvas = /** @class */ (function (_super) {
15191
15193
  };
15192
15194
  Canvas.prototype.render = function (frame) {
15193
15195
  var _this = this;
15196
+ if (frame) {
15197
+ beforeRenderEvent.detail = frame;
15198
+ afterRenderEvent.detail = frame;
15199
+ }
15194
15200
  this.dispatchEvent(beforeRenderEvent);
15195
15201
  var renderingService = this.getRenderingService();
15196
15202
  renderingService.render(this.getConfig(), frame, function () {