@antv/g-lite 2.3.0 → 2.3.1

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
@@ -1,8 +1,8 @@
1
1
  /*!
2
2
  * @antv/g-lite
3
3
  * @description A core module for rendering engine implements DOM API.
4
- * @version 2.3.0
5
- * @date 6/27/2025, 8:31:48 AM
4
+ * @version 2.3.1
5
+ * @date 7/18/2025, 7:12:41 AM
6
6
  * @author AntVis
7
7
  * @docs https://g.antv.antgroup.com/
8
8
  */
@@ -10548,6 +10548,7 @@ var RenderingService = /*#__PURE__*/function () {
10548
10548
  }, {
10549
10549
  key: "render",
10550
10550
  value: function render(canvasConfig, frame, rerenderCallback) {
10551
+ var _this2 = this;
10551
10552
  this.stats.total = 0;
10552
10553
  this.stats.rendered = 0;
10553
10554
  this.zIndexCounter = 0;
@@ -10559,16 +10560,22 @@ var RenderingService = /*#__PURE__*/function () {
10559
10560
  renderingContext.dirtyRectangleRenderingDisabled = this.disableDirtyRectangleRendering();
10560
10561
  var onlyCameraChanged = renderingContext.renderReasons.size === 1 && renderingContext.renderReasons.has(RenderReason.CAMERA_CHANGED);
10561
10562
  var shouldTriggerRenderHooks = !canvasConfig.disableRenderHooks || !onlyCameraChanged;
10562
- this.hooks.beginFrame.call(frame);
10563
10563
  if (shouldTriggerRenderHooks) {
10564
10564
  this.renderDisplayObject(renderingContext.root, canvasConfig, renderingContext);
10565
10565
  }
10566
+ this.hooks.beginFrame.call(frame);
10567
+ if (shouldTriggerRenderHooks) {
10568
+ renderingContext.renderListCurrentFrame.forEach(function (object) {
10569
+ _this2.hooks.beforeRender.call(object);
10570
+ _this2.hooks.render.call(object);
10571
+ _this2.hooks.afterRender.call(object);
10572
+ });
10573
+ }
10566
10574
  this.hooks.endFrame.call(frame);
10575
+ renderingContext.renderListCurrentFrame = [];
10567
10576
  renderingContext.renderReasons.clear();
10568
10577
  rerenderCallback();
10569
10578
  }
10570
-
10571
- // console.log('stats', this.stats);
10572
10579
  }
10573
10580
  }, {
10574
10581
  key: "renderDisplayObject",
@@ -10592,6 +10599,7 @@ var RenderingService = /*#__PURE__*/function () {
10592
10599
  objectToRender = enableCulling ? self.hooks.cull.call(objectChanged, self.context.camera) : objectChanged;
10593
10600
  if (objectToRender) {
10594
10601
  self.stats.rendered += 1;
10602
+ renderingContext.renderListCurrentFrame.push(objectToRender);
10595
10603
  }
10596
10604
  }
10597
10605
  object.dirty(false);
@@ -10606,13 +10614,6 @@ var RenderingService = /*#__PURE__*/function () {
10606
10614
  sortable.dirtyChildren = [];
10607
10615
  sortable.dirtyReason = undefined;
10608
10616
  }
10609
-
10610
- // trigger render hooks
10611
- if (objectToRender) {
10612
- self.hooks.beforeRender.call(objectToRender);
10613
- self.hooks.render.call(objectToRender);
10614
- self.hooks.afterRender.call(objectToRender);
10615
- }
10616
10617
  }
10617
10618
  var stack = [displayObject];
10618
10619
  while (stack.length > 0) {
@@ -12105,6 +12106,10 @@ var TextService = /*#__PURE__*/function () {
12105
12106
  key: "wordWrap",
12106
12107
  value: function wordWrap(text, parsedStyle, offscreenCanvas) {
12107
12108
  var _this2 = this;
12109
+ var chars = Array.from(text);
12110
+ if (chars.length === 0) {
12111
+ return '';
12112
+ }
12108
12113
  var self = this;
12109
12114
  var _parsedStyle$wordWrap2 = parsedStyle.wordWrapWidth,
12110
12115
  wordWrapWidth = _parsedStyle$wordWrap2 === void 0 ? 0 : _parsedStyle$wordWrap2,
@@ -12121,8 +12126,7 @@ var TextService = /*#__PURE__*/function () {
12121
12126
  } else if (textOverflow && textOverflow !== 'clip') {
12122
12127
  ellipsis = textOverflow;
12123
12128
  }
12124
- var chars = Array.from(text);
12125
- var lines = [];
12129
+ var lines = [''];
12126
12130
  var currentLineIndex = 0;
12127
12131
  var currentLineWidth = 0;
12128
12132
  // @see https://github.com/antvis/G/issues/1932
@@ -12182,10 +12186,10 @@ var TextService = /*#__PURE__*/function () {
12182
12186
  if (this.isNewline(_char2)) {
12183
12187
  // exceed maxLines, break immediately
12184
12188
  if (currentLineIndex + 1 >= maxLines) {
12185
- parsedStyle.isOverflowing = true;
12186
12189
  if (i < chars.length - 1) {
12187
12190
  appendEllipsis(currentLineIndex, i - 1);
12188
12191
  }
12192
+ parsedStyle.isOverflowing = true;
12189
12193
  break;
12190
12194
  }
12191
12195
  prevLineLastCharIndex = i - 1;
@@ -12195,14 +12199,9 @@ var TextService = /*#__PURE__*/function () {
12195
12199
  continue;
12196
12200
  }
12197
12201
 
12198
- // If current line is empty and char width exceeds max width, no need to continue
12199
- if (currentLineWidth === 0 && charWidth > maxWidth) {
12200
- // Only add ellipsis if it can fit in the line
12201
- if (ellipsis && ellipsisWidth <= maxWidth) {
12202
- lines[currentLineIndex] = ellipsis;
12203
- } else {
12204
- lines[currentLineIndex] = '';
12205
- }
12202
+ // If char width exceeds max width, no need to continue
12203
+ if (charWidth > maxWidth) {
12204
+ appendEllipsis(currentLineIndex, i - 1);
12206
12205
  parsedStyle.isOverflowing = true;
12207
12206
  break;
12208
12207
  }
@@ -12220,8 +12219,8 @@ var TextService = /*#__PURE__*/function () {
12220
12219
  charWidth = calcWidth(_char2);
12221
12220
  }
12222
12221
  if (currentLineIndex + 1 >= maxLines) {
12223
- parsedStyle.isOverflowing = true;
12224
12222
  appendEllipsis(currentLineIndex, i - 1);
12223
+ parsedStyle.isOverflowing = true;
12225
12224
  break;
12226
12225
  }
12227
12226
  prevLineLastCharIndex = i - 1;
@@ -12241,7 +12240,7 @@ var TextService = /*#__PURE__*/function () {
12241
12240
  }
12242
12241
  }
12243
12242
  currentLineWidth += charWidth;
12244
- lines[currentLineIndex] = (lines[currentLineIndex] || '') + _char2;
12243
+ lines[currentLineIndex] += _char2;
12245
12244
  }
12246
12245
  return lines.join('\n');
12247
12246
  }
@@ -16136,6 +16135,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
16136
16135
  */
16137
16136
  root: this.document.documentElement,
16138
16137
  unculledEntities: [],
16138
+ renderListCurrentFrame: [],
16139
16139
  renderReasons: new Set(),
16140
16140
  force: false,
16141
16141
  dirty: false