@visactor/vrender-core 0.17.0-alpha.3 → 0.17.0-alpha.5

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.
Files changed (77) hide show
  1. package/cjs/core/global.d.ts +0 -1
  2. package/cjs/core/global.js +1 -1
  3. package/cjs/core/global.js.map +1 -1
  4. package/cjs/core/stage.d.ts +3 -2
  5. package/cjs/core/stage.js +12 -9
  6. package/cjs/core/stage.js.map +1 -1
  7. package/cjs/graphic/builtin-symbol/index.js +0 -1
  8. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  9. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  10. package/cjs/graphic/builtin-symbol/rect.js +11 -6
  11. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  12. package/cjs/graphic/graphic.js +3 -2
  13. package/cjs/graphic/graphic.js.map +1 -1
  14. package/cjs/graphic/richtext.js +1 -1
  15. package/cjs/graphic/richtext.js.map +1 -1
  16. package/cjs/interface/global.d.ts +0 -1
  17. package/cjs/interface/global.js.map +1 -1
  18. package/cjs/interface/stage.d.ts +1 -0
  19. package/cjs/interface/stage.js.map +1 -1
  20. package/cjs/render/contributions/render/base-render.js +9 -7
  21. package/cjs/render/contributions/render/base-render.js.map +1 -1
  22. package/cjs/render/contributions/render/draw-contribution.d.ts +2 -2
  23. package/cjs/render/contributions/render/draw-contribution.js +2 -2
  24. package/cjs/render/contributions/render/draw-contribution.js.map +1 -1
  25. package/cjs/render/contributions/render/draw-interceptor.d.ts +9 -1
  26. package/cjs/render/contributions/render/draw-interceptor.js +30 -18
  27. package/cjs/render/contributions/render/draw-interceptor.js.map +1 -1
  28. package/cjs/render/contributions/render/module.js +0 -6
  29. package/cjs/render/contributions/render/module.js.map +1 -1
  30. package/cjs/render/contributions/render/path-render.d.ts +2 -1
  31. package/cjs/render/contributions/render/path-render.js +6 -4
  32. package/cjs/render/contributions/render/path-render.js.map +1 -1
  33. package/cjs/render/contributions/render/rect-render.d.ts +2 -1
  34. package/cjs/render/contributions/render/rect-render.js +5 -2
  35. package/cjs/render/contributions/render/rect-render.js.map +1 -1
  36. package/cjs/render/render-service.js +1 -1
  37. package/cjs/render/render-service.js.map +1 -1
  38. package/dist/index.js +128 -84
  39. package/dist/index.min.js +1 -1
  40. package/es/core/global.d.ts +0 -1
  41. package/es/core/global.js +1 -1
  42. package/es/core/global.js.map +1 -1
  43. package/es/core/stage.d.ts +3 -2
  44. package/es/core/stage.js +13 -10
  45. package/es/core/stage.js.map +1 -1
  46. package/es/graphic/builtin-symbol/index.js +0 -1
  47. package/es/graphic/builtin-symbol/index.js.map +1 -1
  48. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  49. package/es/graphic/builtin-symbol/rect.js +9 -4
  50. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  51. package/es/graphic/graphic.js +3 -2
  52. package/es/graphic/graphic.js.map +1 -1
  53. package/es/graphic/richtext.js +1 -1
  54. package/es/graphic/richtext.js.map +1 -1
  55. package/es/interface/global.d.ts +0 -1
  56. package/es/interface/global.js.map +1 -1
  57. package/es/interface/stage.d.ts +1 -0
  58. package/es/interface/stage.js.map +1 -1
  59. package/es/render/contributions/render/base-render.js +10 -6
  60. package/es/render/contributions/render/base-render.js.map +1 -1
  61. package/es/render/contributions/render/draw-contribution.d.ts +2 -2
  62. package/es/render/contributions/render/draw-contribution.js +2 -2
  63. package/es/render/contributions/render/draw-contribution.js.map +1 -1
  64. package/es/render/contributions/render/draw-interceptor.d.ts +9 -1
  65. package/es/render/contributions/render/draw-interceptor.js +27 -26
  66. package/es/render/contributions/render/draw-interceptor.js.map +1 -1
  67. package/es/render/contributions/render/module.js +1 -4
  68. package/es/render/contributions/render/module.js.map +1 -1
  69. package/es/render/contributions/render/path-render.d.ts +2 -1
  70. package/es/render/contributions/render/path-render.js +5 -4
  71. package/es/render/contributions/render/path-render.js.map +1 -1
  72. package/es/render/contributions/render/rect-render.d.ts +2 -1
  73. package/es/render/contributions/render/rect-render.js +4 -2
  74. package/es/render/contributions/render/rect-render.js.map +1 -1
  75. package/es/render/render-service.js +1 -1
  76. package/es/render/render-service.js.map +1 -1
  77. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1214,7 +1214,6 @@
1214
1214
  };
1215
1215
  this.measureTextMethod = 'native';
1216
1216
  this.optimizeVisible = false;
1217
- this.optmizeSkipCheckBoundariesThreshold = 0;
1218
1217
  }
1219
1218
  bindContribution(params) {
1220
1219
  const promiseArr = [];
@@ -10336,12 +10335,12 @@
10336
10335
  this.in3dMode = false;
10337
10336
  }
10338
10337
  getOffsetXY(attr, includeScroll = false) {
10338
+ var _a, _b;
10339
10339
  const { dx = attr.dx, dy = attr.dy } = this.attribute;
10340
10340
  if (includeScroll && this.parent) {
10341
- const groupTheme = getTheme(this.parent).group;
10342
- const { scrollX = groupTheme.scrollX, scrollY = groupTheme.scrollY } = this.parent.attribute;
10343
- point.x = dx + scrollX;
10344
- point.y = dy + scrollY;
10341
+ const attribute = this.parent.attribute;
10342
+ point.x = dx + ((_a = attribute.scrollX) !== null && _a !== void 0 ? _a : 0);
10343
+ point.y = dy + ((_b = attribute.scrollY) !== null && _b !== void 0 ? _b : 0);
10345
10344
  }
10346
10345
  else {
10347
10346
  point.x = dx;
@@ -14451,28 +14450,36 @@
14451
14450
  }
14452
14451
  var close$1 = new CloseSymbol();
14453
14452
 
14454
- function rect(ctx, size, x, y) {
14453
+ function rectSizeArray(ctx, size, x, y) {
14455
14454
  ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);
14456
14455
  return false;
14457
14456
  }
14457
+ function rectSize(ctx, size, x, y) {
14458
+ const w = size;
14459
+ const h = size / 2;
14460
+ ctx.rect(x - w / 2, y - h / 2, w, h);
14461
+ return false;
14462
+ }
14458
14463
  class RectSymbol extends BaseSymbol {
14459
14464
  constructor() {
14460
14465
  super(...arguments);
14461
14466
  this.type = 'rect';
14462
- this.pathStr = 'M-0.5,-0.5h1v1h-1Z';
14467
+ this.pathStr = 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z';
14463
14468
  }
14464
14469
  draw(ctx, size, x, y) {
14465
- const rectSize = vutils.isNumber(size) ? [size, size] : size;
14466
- return rect(ctx, rectSize, x, y);
14470
+ if (vutils.isNumber(size)) {
14471
+ return rectSize(ctx, size, x, y);
14472
+ }
14473
+ return rectSizeArray(ctx, size, x, y);
14467
14474
  }
14468
14475
  drawOffset(ctx, size, x, y, offset) {
14469
- const rectSize = vutils.isNumber(size)
14470
- ? [size + 2 * offset, size + 2 * offset]
14471
- : [size[0] + 2 * offset, size[1] + 2 * offset];
14472
- return rect(ctx, rectSize, x, y);
14476
+ if (vutils.isNumber(size)) {
14477
+ return rectSize(ctx, size + 2 * offset, x, y);
14478
+ }
14479
+ return rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
14473
14480
  }
14474
14481
  }
14475
- var rect$1 = new RectSymbol();
14482
+ var rect = new RectSymbol();
14476
14483
 
14477
14484
  const tempBounds = new vutils.AABBBounds();
14478
14485
  class CustomSymbolClass {
@@ -14562,7 +14569,7 @@
14562
14569
  arrow2Right$1,
14563
14570
  arrow2Up$1,
14564
14571
  arrow2Down$1,
14565
- rect$1,
14572
+ rect,
14566
14573
  lineV$1,
14567
14574
  lineH$1,
14568
14575
  close$1
@@ -14574,7 +14581,6 @@
14574
14581
  const builtInSymbolStrMap = {
14575
14582
  arrowLeft: 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5',
14576
14583
  arrowRight: 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5',
14577
- rect: 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z',
14578
14584
  rectRound: 'M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z',
14579
14585
  roundLine: 'M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z'
14580
14586
  };
@@ -16132,7 +16138,7 @@
16132
16138
  }
16133
16139
  doUpdateFrameCache() {
16134
16140
  var _a;
16135
- const { textConfig, maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine } = this.attribute;
16141
+ const { textConfig = [], maxWidth, maxHeight, width, height, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection, singleLine } = this.attribute;
16136
16142
  const paragraphs = [];
16137
16143
  for (let i = 0; i < textConfig.length; i++) {
16138
16144
  if ('image' in textConfig[i]) {
@@ -18032,6 +18038,7 @@
18032
18038
  return richText.AABBBounds;
18033
18039
  }
18034
18040
 
18041
+ const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
18035
18042
  class BaseRender {
18036
18043
  init(contributions) {
18037
18044
  if (contributions) {
@@ -18082,13 +18089,17 @@
18082
18089
  };
18083
18090
  }
18084
18091
  transform(graphic, graphicAttribute, context, use3dMatrixIn3dMode = false) {
18085
- const transMatrix = graphic.transMatrix;
18086
18092
  const { x = graphicAttribute.x, y = graphicAttribute.y, z = graphicAttribute.z, scaleX = graphicAttribute.scaleX, scaleY = graphicAttribute.scaleY, angle = graphicAttribute.angle, postMatrix } = graphic.attribute;
18087
- const onlyTranslate = transMatrix.onlyTranslate() && !postMatrix;
18088
18093
  const lastModelMatrix = context.modelMatrix;
18089
18094
  const camera = context.camera;
18090
- const result = { x, y, z, lastModelMatrix };
18095
+ result.x = x;
18096
+ result.y = y;
18097
+ result.z = z;
18098
+ result.lastModelMatrix = lastModelMatrix;
18091
18099
  const shouldTransform3d = camera && (use3dMatrixIn3dMode || shouldUseMat4(graphic));
18100
+ const onlyTranslate = shouldTransform3d
18101
+ ? graphic.transMatrix.onlyTranslate() && !postMatrix
18102
+ : scaleX === 1 && scaleY === 1 && angle === 0 && !postMatrix;
18092
18103
  if (shouldTransform3d) {
18093
18104
  const nextModelMatrix = mat4Allocate.allocate();
18094
18105
  const modelMatrix = mat4Allocate.allocate();
@@ -20536,10 +20547,10 @@
20536
20547
  this.init(pathRenderContribitions);
20537
20548
  }
20538
20549
  drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
20539
- var _a, _b;
20540
- const pathAttribute = getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
20550
+ var _a, _b, _c;
20551
+ const pathAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
20541
20552
  const { x: originX = pathAttribute.x, y: originY = pathAttribute.y } = path.attribute;
20542
- const z = (_a = this.z) !== null && _a !== void 0 ? _a : 0;
20553
+ const z = (_b = this.z) !== null && _b !== void 0 ? _b : 0;
20543
20554
  const data = this.valid(path, pathAttribute, fillCb, strokeCb);
20544
20555
  if (!data) {
20545
20556
  return;
@@ -20550,7 +20561,7 @@
20550
20561
  renderCommandList(path.pathShape.commandList, context, x, y, 1, 1, z);
20551
20562
  }
20552
20563
  else {
20553
- const path2D = (_b = path.attribute.path) !== null && _b !== void 0 ? _b : pathAttribute.path;
20564
+ const path2D = (_c = path.attribute.path) !== null && _c !== void 0 ? _c : pathAttribute.path;
20554
20565
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
20555
20566
  }
20556
20567
  context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute);
@@ -20577,7 +20588,9 @@
20577
20588
  }
20578
20589
  draw(path, renderService, drawContext, params) {
20579
20590
  const pathAttribute = getTheme(path, params === null || params === void 0 ? void 0 : params.theme).path;
20591
+ this.tempTheme = pathAttribute;
20580
20592
  this._draw(path, pathAttribute, false, drawContext, params);
20593
+ this.tempTheme = null;
20581
20594
  }
20582
20595
  };
20583
20596
  exports.DefaultCanvasPathRender = __decorate([
@@ -20603,7 +20616,8 @@
20603
20616
  this.init(rectRenderContribitions);
20604
20617
  }
20605
20618
  drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
20606
- const rectAttribute = getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
20619
+ var _a;
20620
+ const rectAttribute = (_a = this.tempTheme) !== null && _a !== void 0 ? _a : getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
20607
20621
  const { fill = rectAttribute.fill, background, stroke = rectAttribute.stroke, width = rectAttribute.width, height = rectAttribute.height, cornerRadius = rectAttribute.cornerRadius, opacity = rectAttribute.opacity, fillOpacity = rectAttribute.fillOpacity, lineWidth = rectAttribute.lineWidth, strokeOpacity = rectAttribute.strokeOpacity, visible = rectAttribute.visible, x: originX = rectAttribute.x, y: originY = rectAttribute.y } = rect.attribute;
20608
20622
  const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill);
20609
20623
  const sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height);
@@ -20654,7 +20668,9 @@
20654
20668
  }
20655
20669
  draw(rect, renderService, drawContext, params) {
20656
20670
  const rectAttribute = getTheme(rect, params === null || params === void 0 ? void 0 : params.theme).rect;
20671
+ this.tempTheme = rectAttribute;
20657
20672
  this._draw(rect, rectAttribute, false, drawContext, params);
20673
+ this.tempTheme = null;
20658
20674
  }
20659
20675
  };
20660
20676
  exports.DefaultCanvasRectRender = __decorate([
@@ -21304,6 +21320,9 @@
21304
21320
  this.drawContribution = drawContribution;
21305
21321
  }
21306
21322
  prepare(updateBounds) {
21323
+ if (!updateBounds) {
21324
+ return;
21325
+ }
21307
21326
  this.renderTreeRoots.forEach(g => {
21308
21327
  this._prepare(g, updateBounds);
21309
21328
  });
@@ -22001,7 +22020,7 @@
22001
22020
 
22002
22021
  const DrawItemInterceptor = Symbol.for('DrawItemInterceptor');
22003
22022
  const tempDirtyBounds = new vutils.AABBBounds();
22004
- let ShadowRootDrawItemInterceptorContribution = class ShadowRootDrawItemInterceptorContribution {
22023
+ class ShadowRootDrawItemInterceptorContribution {
22005
22024
  constructor() {
22006
22025
  this.order = 1;
22007
22026
  }
@@ -22036,22 +22055,18 @@
22036
22055
  }
22037
22056
  return true;
22038
22057
  }
22039
- };
22040
- ShadowRootDrawItemInterceptorContribution = __decorate([
22041
- injectable()
22042
- ], ShadowRootDrawItemInterceptorContribution);
22043
- let CommonDrawItemInterceptorContribution = class CommonDrawItemInterceptorContribution {
22058
+ }
22059
+ class DebugDrawItemInterceptorContribution {
22044
22060
  constructor() {
22045
22061
  this.order = 1;
22062
+ this.interceptors = [
22063
+ new ShadowRootDrawItemInterceptorContribution(),
22064
+ new Canvas3DDrawItemInterceptor(),
22065
+ new InteractiveDrawItemInterceptorContribution()
22066
+ ];
22046
22067
  }
22047
22068
  afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22048
- if (graphic.attribute.shadowRootIdx > 0 || !graphic.attribute.shadowRootIdx) {
22049
- this.drawItem(graphic, renderService, drawContext, drawContribution, params);
22050
- }
22051
- return false;
22052
- }
22053
- beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22054
- if (graphic.attribute.shadowRootIdx < 0) {
22069
+ if (graphic.attribute._debug_bounds) {
22055
22070
  this.drawItem(graphic, renderService, drawContext, drawContribution, params);
22056
22071
  }
22057
22072
  return false;
@@ -22074,11 +22089,46 @@
22074
22089
  context.highPerformanceRestore();
22075
22090
  return true;
22076
22091
  }
22092
+ }
22093
+ let CommonDrawItemInterceptorContribution = class CommonDrawItemInterceptorContribution {
22094
+ constructor() {
22095
+ this.order = 1;
22096
+ this.interceptors = [
22097
+ new ShadowRootDrawItemInterceptorContribution(),
22098
+ new Canvas3DDrawItemInterceptor(),
22099
+ new InteractiveDrawItemInterceptorContribution(),
22100
+ new DebugDrawItemInterceptorContribution()
22101
+ ];
22102
+ }
22103
+ afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22104
+ for (let i = 0; i < this.interceptors.length; i++) {
22105
+ if (this.interceptors[i].afterDrawItem &&
22106
+ this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
22107
+ return true;
22108
+ }
22109
+ }
22110
+ return false;
22111
+ }
22112
+ beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
22113
+ if ((!graphic.in3dMode || drawContext.in3dInterceptor) &&
22114
+ !graphic.shadowRoot &&
22115
+ !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) {
22116
+ return false;
22117
+ }
22118
+ for (let i = 0; i < this.interceptors.length; i++) {
22119
+ if (this.interceptors[i].beforeDrawItem &&
22120
+ this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) {
22121
+ return true;
22122
+ }
22123
+ }
22124
+ return false;
22125
+ }
22077
22126
  };
22078
22127
  CommonDrawItemInterceptorContribution = __decorate([
22079
- injectable()
22128
+ injectable(),
22129
+ __metadata("design:paramtypes", [])
22080
22130
  ], CommonDrawItemInterceptorContribution);
22081
- let InteractiveDrawItemInterceptorContribution = class InteractiveDrawItemInterceptorContribution {
22131
+ class InteractiveDrawItemInterceptorContribution {
22082
22132
  constructor() {
22083
22133
  this.order = 1;
22084
22134
  }
@@ -22149,11 +22199,8 @@
22149
22199
  }
22150
22200
  return (_a = group.shadowRoot) !== null && _a !== void 0 ? _a : group.attachShadow();
22151
22201
  }
22152
- };
22153
- InteractiveDrawItemInterceptorContribution = __decorate([
22154
- injectable()
22155
- ], InteractiveDrawItemInterceptorContribution);
22156
- let Canvas3DDrawItemInterceptor = class Canvas3DDrawItemInterceptor {
22202
+ }
22203
+ class Canvas3DDrawItemInterceptor {
22157
22204
  constructor() {
22158
22205
  this.order = 1;
22159
22206
  }
@@ -22293,10 +22340,7 @@
22293
22340
  initCanvasCtx(context) {
22294
22341
  context.setTransformForCurrent();
22295
22342
  }
22296
- };
22297
- Canvas3DDrawItemInterceptor = __decorate([
22298
- injectable()
22299
- ], Canvas3DDrawItemInterceptor);
22343
+ }
22300
22344
 
22301
22345
  class DefaultBoundsAllocate {
22302
22346
  constructor() {
@@ -22368,12 +22412,11 @@
22368
22412
  .sort((a, b) => a.order - b.order);
22369
22413
  }
22370
22414
  prepareForDraw(renderService, drawContext) {
22371
- const count = renderService.renderTreeRoots.reduce((a, b) => a + b.count, 0);
22372
- if (count < this.global.optmizeSkipCheckBoundariesThreshold) {
22373
- this.useDirtyBounds = false;
22415
+ if (drawContext.updateBounds) {
22416
+ this.useDirtyBounds = true;
22374
22417
  }
22375
22418
  else {
22376
- this.useDirtyBounds = true;
22419
+ this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;
22377
22420
  }
22378
22421
  }
22379
22422
  draw(renderService, drawContext) {
@@ -22453,7 +22496,7 @@
22453
22496
  if (this.useDirtyBounds && !vutils.isRectIntersect(group.AABBBounds, this.dirtyBounds, false)) {
22454
22497
  return;
22455
22498
  }
22456
- let nextM;
22499
+ let nextM = parentMatrix;
22457
22500
  let tempBounds;
22458
22501
  if (this.useDirtyBounds) {
22459
22502
  tempBounds = boundsAllocate.allocateByObj(this.dirtyBounds);
@@ -22546,10 +22589,9 @@
22546
22589
  if (this.InterceptorContributions.length) {
22547
22590
  for (let i = 0; i < this.InterceptorContributions.length; i++) {
22548
22591
  const drawContribution = this.InterceptorContributions[i];
22549
- if (drawContribution.beforeDrawItem) {
22550
- if (drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)) {
22551
- return;
22552
- }
22592
+ if (drawContribution.beforeDrawItem &&
22593
+ drawContribution.beforeDrawItem(graphic, this.currentRenderService, drawContext, this, params)) {
22594
+ return;
22553
22595
  }
22554
22596
  }
22555
22597
  }
@@ -23732,14 +23774,8 @@
23732
23774
  bind(PolygonRenderContribution).toService(exports.DefaultBaseInteractiveRenderContribution);
23733
23775
  bindContributionProvider(bind, InteractiveSubRenderContribution);
23734
23776
  bindContributionProvider(bind, GraphicRender);
23735
- bind(ShadowRootDrawItemInterceptorContribution).toSelf().inSingletonScope();
23736
- bind(DrawItemInterceptor).toService(ShadowRootDrawItemInterceptorContribution);
23737
23777
  bind(CommonDrawItemInterceptorContribution).toSelf().inSingletonScope();
23738
23778
  bind(DrawItemInterceptor).toService(CommonDrawItemInterceptorContribution);
23739
- bind(Canvas3DDrawItemInterceptor).toSelf().inSingletonScope();
23740
- bind(DrawItemInterceptor).toService(Canvas3DDrawItemInterceptor);
23741
- bind(InteractiveDrawItemInterceptorContribution).toSelf().inSingletonScope();
23742
- bind(DrawItemInterceptor).toService(InteractiveDrawItemInterceptorContribution);
23743
23779
  bindContributionProvider(bind, DrawItemInterceptor);
23744
23780
  });
23745
23781
 
@@ -24810,9 +24846,26 @@
24810
24846
  this.tryInitEventSystem();
24811
24847
  return this._eventSystem;
24812
24848
  }
24813
- constructor(params) {
24849
+ constructor(params = {}) {
24814
24850
  var _a;
24815
24851
  super({});
24852
+ this._onVisibleChange = (visible) => {
24853
+ if (this._skipRender < 0) {
24854
+ return;
24855
+ }
24856
+ if (visible) {
24857
+ if (this.dirtyBounds) {
24858
+ this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
24859
+ }
24860
+ if (this._skipRender > 1) {
24861
+ this.renderNextFrame();
24862
+ }
24863
+ this._skipRender = 0;
24864
+ }
24865
+ else {
24866
+ this._skipRender = 1;
24867
+ }
24868
+ };
24816
24869
  this.beforeRender = (stage) => {
24817
24870
  this._beforeRender && this._beforeRender(stage);
24818
24871
  };
@@ -24881,7 +24934,13 @@
24881
24934
  this.timeline = new DefaultTimeline();
24882
24935
  this.ticker.addTimeline(this.timeline);
24883
24936
  this.timeline.pause();
24937
+ if (!params.optimize) {
24938
+ params.optimize = {};
24939
+ }
24884
24940
  this.optmize(params.optimize);
24941
+ if (params.background && vutils.isString(this._background) && this._background.includes('/')) {
24942
+ this.setAttributes({ background: this._background });
24943
+ }
24885
24944
  }
24886
24945
  tryInitEventSystem() {
24887
24946
  if (this.global.supportEvent && !this._eventSystem) {
@@ -24913,7 +24972,7 @@
24913
24972
  this._skipRender = -Infinity;
24914
24973
  }
24915
24974
  else {
24916
- if (this.params && this.params.optimize && this.params.optimize.skipRenderWithOutRange !== false) {
24975
+ if (this.params.optimize.skipRenderWithOutRange !== false) {
24917
24976
  this._skipRender = this.window.isVisible() ? 0 : 1;
24918
24977
  }
24919
24978
  else {
@@ -24922,30 +24981,15 @@
24922
24981
  }
24923
24982
  }
24924
24983
  optmize(params) {
24925
- this.optmizeRender(params === null || params === void 0 ? void 0 : params.skipRenderWithOutRange);
24984
+ this.optmizeRender(params.skipRenderWithOutRange);
24985
+ this.params.optimize = params;
24926
24986
  }
24927
24987
  optmizeRender(skipRenderWithOutRange = false) {
24928
24988
  if (!skipRenderWithOutRange) {
24929
24989
  return;
24930
24990
  }
24931
24991
  this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;
24932
- this.window.onVisibleChange(visible => {
24933
- if (this._skipRender < 0) {
24934
- return;
24935
- }
24936
- if (visible) {
24937
- if (this.dirtyBounds) {
24938
- this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
24939
- }
24940
- if (this._skipRender > 1) {
24941
- this.renderNextFrame();
24942
- }
24943
- this._skipRender = 0;
24944
- }
24945
- else {
24946
- this._skipRender = 1;
24947
- }
24948
- });
24992
+ this.window.onVisibleChange(this._onVisibleChange);
24949
24993
  }
24950
24994
  getTimeline() {
24951
24995
  return this.timeline;