@antv/g-lite 2.0.5 → 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.js CHANGED
@@ -1700,6 +1700,7 @@ var Camera = /** @class */ (function () {
1700
1700
  * 计算 MV 矩阵,为相机矩阵的逆矩阵
1701
1701
  */
1702
1702
  Camera.prototype.getViewTransform = function () {
1703
+ // mat4.scale(this.matrix, this.matrix, vec3.fromValues(1, -1, 1));
1703
1704
  return glMatrix.mat4.invert(glMatrix.mat4.create(), this.matrix);
1704
1705
  };
1705
1706
  Camera.prototype.getWorldTransform = function () {
@@ -1827,7 +1828,10 @@ var Camera = /** @class */ (function () {
1827
1828
  var dvec = glMatrix.vec3.fromValues(cx - ox, cy - oy, 0);
1828
1829
  var dx = glMatrix.vec3.dot(dvec, this.right) / glMatrix.vec3.length(this.right);
1829
1830
  var dy = glMatrix.vec3.dot(dvec, this.up) / glMatrix.vec3.length(this.up);
1830
- this.pan(-dx, -dy);
1831
+ var _c = tslib.__read(this.getPosition(), 2), px = _c[0], py = _c[1];
1832
+ var _d = tslib.__read(this.getFocalPoint(), 2), fx = _d[0], fy = _d[1];
1833
+ this.setPosition(px - dx, py - dy);
1834
+ this.setFocalPoint(fx - dx, fy - dy);
1831
1835
  return this;
1832
1836
  };
1833
1837
  Camera.prototype.setPerspective = function (near, far, fov, aspect) {
@@ -1849,9 +1853,7 @@ var Camera = /** @class */ (function () {
1849
1853
  width *= this.view.width / fullWidth;
1850
1854
  height *= this.view.height / fullHeight;
1851
1855
  }
1852
- makePerspective(this.projectionMatrix, left, left + width, top, top - height, near, this.far, this.clipSpaceNearZ === exports.ClipSpaceNearZ.ZERO);
1853
- // flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
1854
- glMatrix.mat4.scale(this.projectionMatrix, this.projectionMatrix, glMatrix.vec3.fromValues(1, -1, 1));
1856
+ makePerspective(this.projectionMatrix, left, left + width, top - height, top, near, this.far, this.clipSpaceNearZ === exports.ClipSpaceNearZ.ZERO);
1855
1857
  glMatrix.mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
1856
1858
  this.triggerUpdate();
1857
1859
  return this;
@@ -1882,13 +1884,13 @@ var Camera = /** @class */ (function () {
1882
1884
  bottom = top - scaleH * this.view.height;
1883
1885
  }
1884
1886
  if (this.clipSpaceNearZ === exports.ClipSpaceNearZ.NEGATIVE_ONE) {
1885
- glMatrix.mat4.ortho(this.projectionMatrix, left, right, bottom, top, near, far);
1887
+ // FlipY with switching bottom & top.
1888
+ // @see https://stackoverflow.com/a/4886656
1889
+ glMatrix.mat4.ortho(this.projectionMatrix, left, right, top, bottom, near, far);
1886
1890
  }
1887
1891
  else {
1888
- glMatrix.mat4.orthoZO(this.projectionMatrix, left, right, bottom, top, near, far);
1892
+ glMatrix.mat4.orthoZO(this.projectionMatrix, left, right, top, bottom, near, far);
1889
1893
  }
1890
- // flipY since the origin of OpenGL/WebGL is bottom-left compared with top-left in Canvas2D
1891
- glMatrix.mat4.scale(this.projectionMatrix, this.projectionMatrix, glMatrix.vec3.fromValues(1, -1, 1));
1892
1894
  glMatrix.mat4.invert(this.projectionMatrixInverse, this.projectionMatrix);
1893
1895
  this._getOrthoMatrix();
1894
1896
  this.triggerUpdate();
@@ -15212,6 +15214,10 @@ var Canvas = /** @class */ (function (_super) {
15212
15214
  };
15213
15215
  Canvas.prototype.render = function (frame) {
15214
15216
  var _this = this;
15217
+ if (frame) {
15218
+ beforeRenderEvent.detail = frame;
15219
+ afterRenderEvent.detail = frame;
15220
+ }
15215
15221
  this.dispatchEvent(beforeRenderEvent);
15216
15222
  var renderingService = this.getRenderingService();
15217
15223
  renderingService.render(this.getConfig(), frame, function () {