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