@antv/g-lite 2.0.0 → 2.0.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.
package/dist/Canvas.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="webxr" />
1
2
  import type { IRenderer } from './AbstractRenderer';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import type { CanvasContext, IChildNode } from './dom';
@@ -124,7 +125,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
124
125
  * But the canvas remains running which means display objects can be appended later.
125
126
  */
126
127
  destroyChildren(): void;
127
- render(): void;
128
+ render(frame?: XRFrame): void;
128
129
  private run;
129
130
  private initRenderer;
130
131
  private initRenderingService;
@@ -169,6 +169,10 @@ export declare class Camera implements ICamera {
169
169
  * 设置相机矩阵
170
170
  */
171
171
  setMatrix(matrix: mat4): this;
172
+ /**
173
+ * Set projection matrix manually.
174
+ */
175
+ setProjectionMatrix(matrix: mat4): void;
172
176
  setFov(fov: number): this;
173
177
  setAspect(aspect: number): this;
174
178
  setNear(near: number): this;
package/dist/index.esm.js CHANGED
@@ -1699,6 +1699,12 @@ var Camera = /** @class */ (function () {
1699
1699
  this._update();
1700
1700
  return this;
1701
1701
  };
1702
+ /**
1703
+ * Set projection matrix manually.
1704
+ */
1705
+ Camera.prototype.setProjectionMatrix = function (matrix) {
1706
+ this.projectionMatrix = matrix;
1707
+ };
1702
1708
  Camera.prototype.setFov = function (fov) {
1703
1709
  this.setPerspective(this.near, this.far, fov, this.aspect);
1704
1710
  return this;
@@ -10078,7 +10084,7 @@ var RenderingService = /** @class */ (function () {
10078
10084
  return (!enableDirtyRectangleRendering ||
10079
10085
  this.context.renderingContext.renderReasons.has(RenderReason.CAMERA_CHANGED));
10080
10086
  };
10081
- RenderingService.prototype.render = function (canvasConfig, rerenderCallback) {
10087
+ RenderingService.prototype.render = function (canvasConfig, frame, rerenderCallback) {
10082
10088
  var _this = this;
10083
10089
  this.stats.total = 0;
10084
10090
  this.stats.rendered = 0;
@@ -10097,7 +10103,7 @@ var RenderingService = /** @class */ (function () {
10097
10103
  if (shouldTriggerRenderHooks) {
10098
10104
  this.renderDisplayObject(renderingContext.root, canvasConfig, renderingContext);
10099
10105
  }
10100
- this.hooks.beginFrame.call();
10106
+ this.hooks.beginFrame.call(frame);
10101
10107
  if (shouldTriggerRenderHooks) {
10102
10108
  renderingContext.renderListCurrentFrame.forEach(function (object) {
10103
10109
  _this.hooks.beforeRender.call(object);
@@ -10105,7 +10111,7 @@ var RenderingService = /** @class */ (function () {
10105
10111
  _this.hooks.afterRender.call(object);
10106
10112
  });
10107
10113
  }
10108
- this.hooks.endFrame.call();
10114
+ this.hooks.endFrame.call(frame);
10109
10115
  renderingContext.renderListCurrentFrame = [];
10110
10116
  renderingContext.renderReasons.clear();
10111
10117
  rerenderCallback();
@@ -13731,6 +13737,7 @@ var Text = /** @class */ (function (_super) {
13731
13737
  */
13732
13738
  Text.prototype.getComputedTextLength = function () {
13733
13739
  var _a;
13740
+ this.getGeometryBounds();
13734
13741
  return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.maxLineWidth) || 0;
13735
13742
  };
13736
13743
  // getEndPositionOfChar(charnum: number): DOMPoint {
@@ -13756,9 +13763,11 @@ var Text = /** @class */ (function (_super) {
13756
13763
  // }
13757
13764
  Text.prototype.getLineBoundingRects = function () {
13758
13765
  var _a;
13766
+ this.getGeometryBounds();
13759
13767
  return ((_a = this.parsedStyle.metrics) === null || _a === void 0 ? void 0 : _a.lineMetrics) || [];
13760
13768
  };
13761
13769
  Text.prototype.isOverflowing = function () {
13770
+ this.getGeometryBounds();
13762
13771
  return !!this.parsedStyle.isOverflowing;
13763
13772
  };
13764
13773
  return Text;
@@ -15172,11 +15181,11 @@ var Canvas = /** @class */ (function (_super) {
15172
15181
  Canvas.prototype.destroyChildren = function () {
15173
15182
  this.document.documentElement.destroyChildren();
15174
15183
  };
15175
- Canvas.prototype.render = function () {
15184
+ Canvas.prototype.render = function (frame) {
15176
15185
  var _this = this;
15177
15186
  this.dispatchEvent(beforeRenderEvent);
15178
15187
  var renderingService = this.getRenderingService();
15179
- renderingService.render(this.getConfig(), function () {
15188
+ renderingService.render(this.getConfig(), frame, function () {
15180
15189
  // trigger actual rerender event
15181
15190
  // @see https://github.com/antvis/G/issues/1268
15182
15191
  _this.dispatchEvent(rerenderEvent);
@@ -15185,8 +15194,8 @@ var Canvas = /** @class */ (function (_super) {
15185
15194
  };
15186
15195
  Canvas.prototype.run = function () {
15187
15196
  var _this = this;
15188
- var tick = function () {
15189
- _this.render();
15197
+ var tick = function (time, frame) {
15198
+ _this.render(frame);
15190
15199
  _this.frameId = _this.requestAnimationFrame(tick);
15191
15200
  };
15192
15201
  tick();