@visactor/vrender-core 0.16.15 → 0.16.17-alpha.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.
Files changed (109) hide show
  1. package/cjs/common/Reflect-metadata.js +1 -1
  2. package/cjs/common/bezier-utils.js +1 -2
  3. package/cjs/common/bounds-context.js +1 -1
  4. package/cjs/common/canvas-utils.js +1 -1
  5. package/cjs/common/contribution-provider.js +1 -1
  6. package/cjs/common/custom-path2d.js +1 -1
  7. package/cjs/common/enums.js +1 -1
  8. package/cjs/common/generator.js +1 -1
  9. package/cjs/common/matrix.js +1 -1
  10. package/cjs/common/morphing-utils.js +1 -1
  11. package/cjs/common/path-svg.js +1 -1
  12. package/cjs/common/polygon.js +2 -2
  13. package/cjs/common/render-area.js +1 -1
  14. package/cjs/common/render-command-list.js +1 -1
  15. package/cjs/common/render-curve.js +2 -2
  16. package/cjs/common/seg-context.js +1 -1
  17. package/cjs/common/sort.js +1 -1
  18. package/cjs/common/split-path.js +1 -2
  19. package/cjs/common/store.js +1 -1
  20. package/cjs/common/text.js +1 -1
  21. package/cjs/common/utils.js +1 -1
  22. package/cjs/core/camera.js +2 -1
  23. package/cjs/core/global-module.js +2 -0
  24. package/cjs/core/global.js +1 -1
  25. package/cjs/core/graphic-utils.js +1 -1
  26. package/cjs/core/index.js +1 -1
  27. package/cjs/core/layer-service.js +1 -1
  28. package/cjs/core/layer.js +1 -1
  29. package/cjs/core/light.js +1 -1
  30. package/cjs/core/stage.js +1 -1
  31. package/cjs/core/window.js +1 -1
  32. package/cjs/event/constant.js +1 -1
  33. package/cjs/event/event-manager.js +1 -1
  34. package/cjs/event/event-system.js +1 -1
  35. package/cjs/event/event-target.js +1 -1
  36. package/cjs/event/index.js +2 -1
  37. package/cjs/event/util.js +1 -1
  38. package/cjs/graphic/builtin-symbol/index.js +0 -1
  39. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  40. package/cjs/graphic/builtin-symbol/rect.d.ts +2 -1
  41. package/cjs/graphic/builtin-symbol/rect.js +11 -6
  42. package/cjs/graphic/builtin-symbol/rect.js.map +1 -1
  43. package/cjs/graphic/graphic-service/graphic-service.d.ts +3 -2
  44. package/cjs/graphic/graphic-service/graphic-service.js +19 -2
  45. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  46. package/cjs/graphic/graphic.js +1 -1
  47. package/cjs/graphic/graphic.js.map +1 -1
  48. package/cjs/interface/allocator.js +1 -1
  49. package/cjs/interface/animate.js +1 -1
  50. package/cjs/interface/camera.js +1 -1
  51. package/cjs/interface/canvas.js +1 -1
  52. package/cjs/interface/color.js +1 -1
  53. package/cjs/interface/common.js +1 -1
  54. package/dist/index.js +71 -15
  55. package/dist/index.min.js +1 -1
  56. package/es/common/Reflect-metadata.js +1 -1
  57. package/es/common/bezier-utils.js +1 -2
  58. package/es/common/bounds-context.js +1 -1
  59. package/es/common/canvas-utils.js +1 -1
  60. package/es/common/contribution-provider.js +1 -1
  61. package/es/common/custom-path2d.js +1 -1
  62. package/es/common/enums.js +1 -1
  63. package/es/common/generator.js +1 -1
  64. package/es/common/matrix.js +1 -1
  65. package/es/common/morphing-utils.js +1 -1
  66. package/es/common/path-svg.js +1 -1
  67. package/es/common/polygon.js +1 -1
  68. package/es/common/render-area.js +1 -1
  69. package/es/common/render-command-list.js +1 -1
  70. package/es/common/render-curve.js +1 -1
  71. package/es/common/seg-context.js +1 -1
  72. package/es/common/sort.js +1 -1
  73. package/es/common/split-path.js +1 -2
  74. package/es/common/store.js +1 -1
  75. package/es/common/text.js +1 -1
  76. package/es/common/utils.js +1 -1
  77. package/es/core/camera.js +2 -1
  78. package/es/core/global-module.js +2 -0
  79. package/es/core/global.js +1 -1
  80. package/es/core/graphic-utils.js +1 -1
  81. package/es/core/index.js +1 -1
  82. package/es/core/layer-service.js +1 -1
  83. package/es/core/layer.js +1 -1
  84. package/es/core/light.js +1 -1
  85. package/es/core/stage.js +1 -1
  86. package/es/core/window.js +1 -1
  87. package/es/event/constant.js +1 -1
  88. package/es/event/event-manager.js +1 -1
  89. package/es/event/event-system.js +1 -1
  90. package/es/event/event-target.js +1 -1
  91. package/es/event/index.js +2 -1
  92. package/es/event/util.js +1 -1
  93. package/es/graphic/builtin-symbol/index.js +0 -1
  94. package/es/graphic/builtin-symbol/index.js.map +1 -1
  95. package/es/graphic/builtin-symbol/rect.d.ts +2 -1
  96. package/es/graphic/builtin-symbol/rect.js +9 -4
  97. package/es/graphic/builtin-symbol/rect.js.map +1 -1
  98. package/es/graphic/graphic-service/graphic-service.d.ts +3 -2
  99. package/es/graphic/graphic-service/graphic-service.js +19 -2
  100. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  101. package/es/graphic/graphic.js +1 -1
  102. package/es/graphic/graphic.js.map +1 -1
  103. package/es/interface/allocator.js +1 -1
  104. package/es/interface/animate.js +1 -1
  105. package/es/interface/camera.js +1 -1
  106. package/es/interface/canvas.js +1 -1
  107. package/es/interface/color.js +1 -1
  108. package/es/interface/common.js +1 -1
  109. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -11366,13 +11366,11 @@
11366
11366
  ];
11367
11367
  const GRAPHIC_UPDATE_TAG_KEY = [
11368
11368
  'lineWidth',
11369
- 'lineCap',
11370
- 'lineJoin',
11371
- 'miterLimit',
11372
11369
  'scaleX',
11373
11370
  'scaleY',
11374
11371
  'angle',
11375
- 'anchor'
11372
+ 'anchor',
11373
+ 'visible'
11376
11374
  ];
11377
11375
  const tempConstantXYKey = ['x', 'y'];
11378
11376
  const tempConstantScaleXYKey = ['scaleX', 'scaleY'];
@@ -15569,28 +15567,36 @@
15569
15567
  }
15570
15568
  var close$1 = new CloseSymbol();
15571
15569
 
15572
- function rect(ctx, size, x, y) {
15570
+ function rectSizeArray(ctx, size, x, y) {
15573
15571
  ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]);
15574
15572
  return false;
15575
15573
  }
15574
+ function rectSize(ctx, size, x, y) {
15575
+ const w = size;
15576
+ const h = size / 2;
15577
+ ctx.rect(x - w / 2, y - h / 2, w, h);
15578
+ return false;
15579
+ }
15576
15580
  class RectSymbol extends BaseSymbol {
15577
15581
  constructor() {
15578
15582
  super(...arguments);
15579
15583
  this.type = 'rect';
15580
- this.pathStr = 'M-0.5,-0.5h1v1h-1Z';
15584
+ this.pathStr = 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z';
15581
15585
  }
15582
15586
  draw(ctx, size, x, y) {
15583
- const rectSize = vutils.isNumber(size) ? [size, size] : size;
15584
- return rect(ctx, rectSize, x, y);
15587
+ if (vutils.isNumber(size)) {
15588
+ return rectSize(ctx, size, x, y);
15589
+ }
15590
+ return rectSizeArray(ctx, size, x, y);
15585
15591
  }
15586
15592
  drawOffset(ctx, size, x, y, offset) {
15587
- const rectSize = vutils.isNumber(size)
15588
- ? [size + 2 * offset, size + 2 * offset]
15589
- : [size[0] + 2 * offset, size[1] + 2 * offset];
15590
- return rect(ctx, rectSize, x, y);
15593
+ if (vutils.isNumber(size)) {
15594
+ return rectSize(ctx, size + 2 * offset, x, y);
15595
+ }
15596
+ return rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
15591
15597
  }
15592
15598
  }
15593
- var rect$1 = new RectSymbol();
15599
+ var rect = new RectSymbol();
15594
15600
 
15595
15601
  const tempBounds = new vutils.AABBBounds();
15596
15602
  class CustomSymbolClass {
@@ -15680,7 +15686,7 @@
15680
15686
  arrow2Right$1,
15681
15687
  arrow2Up$1,
15682
15688
  arrow2Down$1,
15683
- rect$1,
15689
+ rect,
15684
15690
  lineV$1,
15685
15691
  lineH$1,
15686
15692
  close$1
@@ -15692,7 +15698,6 @@
15692
15698
  const builtInSymbolStrMap = {
15693
15699
  arrowLeft: 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5',
15694
15700
  arrowRight: 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5',
15695
- rect: 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z',
15696
15701
  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',
15697
15702
  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'
15698
15703
  };
@@ -18604,6 +18609,9 @@
18604
18609
  return true;
18605
18610
  }
18606
18611
  updateRectAABBBounds(attribute, rectTheme, aabbBounds, graphic) {
18612
+ if (!this._validCheck(attribute, rectTheme, aabbBounds, graphic)) {
18613
+ return aabbBounds;
18614
+ }
18607
18615
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18608
18616
  const { width = rectTheme.width, height = rectTheme.height } = attribute;
18609
18617
  aabbBounds.set(0, 0, width, height);
@@ -18647,12 +18655,18 @@
18647
18655
  return aabbBounds;
18648
18656
  }
18649
18657
  updateGlyphAABBBounds(attribute, theme, aabbBounds, graphic) {
18658
+ if (!this._validCheck(attribute, theme, aabbBounds, graphic)) {
18659
+ return aabbBounds;
18660
+ }
18650
18661
  graphic.getSubGraphic().forEach((node) => {
18651
18662
  aabbBounds.union(node.AABBBounds);
18652
18663
  });
18653
18664
  return aabbBounds;
18654
18665
  }
18655
18666
  updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
18667
+ if (!this._validCheck(attribute, richtextTheme, aabbBounds, graphic)) {
18668
+ return aabbBounds;
18669
+ }
18656
18670
  if (!graphic) {
18657
18671
  return aabbBounds;
18658
18672
  }
@@ -18702,6 +18716,9 @@
18702
18716
  return aabbBounds;
18703
18717
  }
18704
18718
  updateTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
18719
+ if (!this._validCheck(attribute, textTheme, aabbBounds, graphic)) {
18720
+ return aabbBounds;
18721
+ }
18705
18722
  if (!graphic) {
18706
18723
  return aabbBounds;
18707
18724
  }
@@ -18727,6 +18744,9 @@
18727
18744
  return aabbBounds;
18728
18745
  }
18729
18746
  updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
18747
+ if (!this._validCheck(attribute, pathTheme, aabbBounds, graphic)) {
18748
+ return aabbBounds;
18749
+ }
18730
18750
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18731
18751
  this.updatePathAABBBoundsImprecise(attribute, pathTheme, aabbBounds, graphic);
18732
18752
  }
@@ -18795,6 +18815,9 @@
18795
18815
  return aabbBounds;
18796
18816
  }
18797
18817
  updatePolygonAABBBounds(attribute, polygonTheme, aabbBounds, graphic) {
18818
+ if (!this._validCheck(attribute, polygonTheme, aabbBounds, graphic)) {
18819
+ return aabbBounds;
18820
+ }
18798
18821
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18799
18822
  this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds, graphic);
18800
18823
  }
@@ -18814,6 +18837,9 @@
18814
18837
  return aabbBounds;
18815
18838
  }
18816
18839
  updateLineAABBBounds(attribute, lineTheme, aabbBounds, graphic) {
18840
+ if (!this._validCheck(attribute, lineTheme, aabbBounds, graphic)) {
18841
+ return aabbBounds;
18842
+ }
18817
18843
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18818
18844
  attribute.segments
18819
18845
  ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic)
@@ -18846,6 +18872,9 @@
18846
18872
  return b;
18847
18873
  }
18848
18874
  updateAreaAABBBounds(attribute, areaTheme, aabbBounds, graphic) {
18875
+ if (!this._validCheck(attribute, areaTheme, aabbBounds, graphic)) {
18876
+ return aabbBounds;
18877
+ }
18849
18878
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18850
18879
  attribute.segments
18851
18880
  ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds, graphic)
@@ -18882,6 +18911,9 @@
18882
18911
  return b;
18883
18912
  }
18884
18913
  updateCircleAABBBounds(attribute, circleTheme, aabbBounds, full, graphic) {
18914
+ if (!this._validCheck(attribute, circleTheme, aabbBounds, graphic)) {
18915
+ return aabbBounds;
18916
+ }
18885
18917
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18886
18918
  full
18887
18919
  ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds, graphic)
@@ -18919,6 +18951,9 @@
18919
18951
  return aabbBounds;
18920
18952
  }
18921
18953
  updateArcAABBBounds(attribute, arcTheme, aabbBounds, full, graphic) {
18954
+ if (!this._validCheck(attribute, arcTheme, aabbBounds, graphic)) {
18955
+ return aabbBounds;
18956
+ }
18922
18957
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18923
18958
  full
18924
18959
  ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds, graphic)
@@ -18972,6 +19007,9 @@
18972
19007
  return aabbBounds;
18973
19008
  }
18974
19009
  updateSymbolAABBBounds(attribute, symbolTheme, aabbBounds, full, graphic) {
19010
+ if (!this._validCheck(attribute, symbolTheme, aabbBounds, graphic)) {
19011
+ return aabbBounds;
19012
+ }
18975
19013
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
18976
19014
  full
18977
19015
  ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds, graphic)
@@ -19015,6 +19053,9 @@
19015
19053
  return aabbBounds;
19016
19054
  }
19017
19055
  updateImageAABBBounds(attribute, imageTheme, aabbBounds, graphic) {
19056
+ if (!this._validCheck(attribute, imageTheme, aabbBounds, graphic)) {
19057
+ return aabbBounds;
19058
+ }
19018
19059
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
19019
19060
  const { width = imageTheme.width, height = imageTheme.height } = attribute;
19020
19061
  aabbBounds.set(0, 0, width, height);
@@ -19050,6 +19091,21 @@
19050
19091
  this.combindShadowAABBBounds(aabbBounds, graphic);
19051
19092
  vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
19052
19093
  }
19094
+ _validCheck(attribute, theme, aabbBounds, graphic) {
19095
+ if (!graphic) {
19096
+ return true;
19097
+ }
19098
+ if (!graphic.valid) {
19099
+ aabbBounds.clear();
19100
+ return false;
19101
+ }
19102
+ const { visible = theme.visible } = attribute;
19103
+ if (!visible) {
19104
+ aabbBounds.clear();
19105
+ return false;
19106
+ }
19107
+ return true;
19108
+ }
19053
19109
  };
19054
19110
  exports.DefaultGraphicService = __decorate([
19055
19111
  injectable(),