@visactor/vrender-components 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.
package/dist/index.js CHANGED
@@ -7715,7 +7715,7 @@
7715
7715
 
7716
7716
  var tempMatrix = new vutils.Matrix(),
7717
7717
  tempBounds$1 = new vutils.AABBBounds();
7718
- var GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "lineCap", "lineJoin", "miterLimit", "scaleX", "scaleY", "angle", "anchor"];
7718
+ var GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
7719
7719
  var tempConstantXYKey = ["x", "y"],
7720
7720
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
7721
7721
  tempConstantAngleKey = ["angle"],
@@ -11337,32 +11337,37 @@
11337
11337
  }(BaseSymbol);
11338
11338
  var close$1 = new CloseSymbol();
11339
11339
 
11340
- function rect(ctx, size, x, y) {
11340
+ function rectSizeArray(ctx, size, x, y) {
11341
11341
  return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
11342
11342
  }
11343
+ function rectSize(ctx, size, x, y) {
11344
+ var w = size,
11345
+ h = size / 2;
11346
+ return ctx.rect(x - w / 2, y - h / 2, w, h), !1;
11347
+ }
11343
11348
  var RectSymbol = /*#__PURE__*/function (_BaseSymbol) {
11344
11349
  _inherits(RectSymbol, _BaseSymbol);
11345
11350
  var _super = _createSuper(RectSymbol);
11346
11351
  function RectSymbol() {
11347
11352
  var _this;
11348
11353
  _classCallCheck(this, RectSymbol);
11349
- _this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M-0.5,-0.5h1v1h-1Z";
11354
+ _this = _super.apply(this, arguments), _this.type = "rect", _this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
11350
11355
  return _this;
11351
11356
  }
11352
11357
  _createClass(RectSymbol, [{
11353
11358
  key: "draw",
11354
11359
  value: function draw(ctx, size, x, y) {
11355
- return rect(ctx, vutils.isNumber(size) ? [size, size] : size, x, y);
11360
+ return vutils.isNumber(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
11356
11361
  }
11357
11362
  }, {
11358
11363
  key: "drawOffset",
11359
11364
  value: function drawOffset(ctx, size, x, y, offset) {
11360
- return rect(ctx, vutils.isNumber(size) ? [size + 2 * offset, size + 2 * offset] : [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
11365
+ return vutils.isNumber(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
11361
11366
  }
11362
11367
  }]);
11363
11368
  return RectSymbol;
11364
11369
  }(BaseSymbol);
11365
- var rect$1 = new RectSymbol();
11370
+ var rect = new RectSymbol();
11366
11371
 
11367
11372
  var tempBounds = new vutils.AABBBounds();
11368
11373
  var CustomSymbolClass = /*#__PURE__*/function () {
@@ -11401,7 +11406,7 @@
11401
11406
  return CustomSymbolClass;
11402
11407
  }();
11403
11408
 
11404
- var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect$1, lineV$1, lineH$1, close$1];
11409
+ var builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect, lineV$1, lineH$1, close$1];
11405
11410
  var builtinSymbolsMap = {};
11406
11411
  builtinSymbols.forEach(function (symbol) {
11407
11412
  builtinSymbolsMap[symbol.type] = symbol;
@@ -11409,7 +11414,6 @@
11409
11414
  var builtInSymbolStrMap = {
11410
11415
  arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
11411
11416
  arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
11412
- rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
11413
11417
  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",
11414
11418
  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"
11415
11419
  };
@@ -13522,6 +13526,7 @@
13522
13526
  }, {
13523
13527
  key: "updateRectAABBBounds",
13524
13528
  value: function updateRectAABBBounds(attribute, rectTheme, aabbBounds, graphic) {
13529
+ if (!this._validCheck(attribute, rectTheme, aabbBounds, graphic)) return aabbBounds;
13525
13530
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
13526
13531
  var _attribute$width = attribute.width,
13527
13532
  width = _attribute$width === void 0 ? rectTheme.width : _attribute$width,
@@ -13555,13 +13560,14 @@
13555
13560
  }, {
13556
13561
  key: "updateGlyphAABBBounds",
13557
13562
  value: function updateGlyphAABBBounds(attribute, theme, aabbBounds, graphic) {
13558
- return graphic.getSubGraphic().forEach(function (node) {
13563
+ return this._validCheck(attribute, theme, aabbBounds, graphic) ? (graphic.getSubGraphic().forEach(function (node) {
13559
13564
  aabbBounds.union(node.AABBBounds);
13560
- }), aabbBounds;
13565
+ }), aabbBounds) : aabbBounds;
13561
13566
  }
13562
13567
  }, {
13563
13568
  key: "updateRichTextAABBBounds",
13564
13569
  value: function updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
13570
+ if (!this._validCheck(attribute, richtextTheme, aabbBounds, graphic)) return aabbBounds;
13565
13571
  if (!graphic) return aabbBounds;
13566
13572
  var _attribute$width2 = attribute.width,
13567
13573
  width = _attribute$width2 === void 0 ? richtextTheme.width : _attribute$width2,
@@ -13614,6 +13620,7 @@
13614
13620
  }, {
13615
13621
  key: "updateTextAABBBounds",
13616
13622
  value: function updateTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
13623
+ if (!this._validCheck(attribute, textTheme, aabbBounds, graphic)) return aabbBounds;
13617
13624
  if (!graphic) return aabbBounds;
13618
13625
  var _graphic$attribute$te = graphic.attribute.text,
13619
13626
  text = _graphic$attribute$te === void 0 ? textTheme.text : _graphic$attribute$te;
@@ -13638,6 +13645,7 @@
13638
13645
  }, {
13639
13646
  key: "updatePathAABBBounds",
13640
13647
  value: function updatePathAABBBounds(attribute, pathTheme, aabbBounds, graphic) {
13648
+ if (!this._validCheck(attribute, pathTheme, aabbBounds, graphic)) return aabbBounds;
13641
13649
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || this.updatePathAABBBoundsImprecise(attribute, pathTheme, aabbBounds, graphic);
13642
13650
  var tb1 = this.tempAABBBounds1,
13643
13651
  tb2 = this.tempAABBBounds2;
@@ -13689,6 +13697,7 @@
13689
13697
  }, {
13690
13698
  key: "updatePolygonAABBBounds",
13691
13699
  value: function updatePolygonAABBBounds(attribute, polygonTheme, aabbBounds, graphic) {
13700
+ if (!this._validCheck(attribute, polygonTheme, aabbBounds, graphic)) return aabbBounds;
13692
13701
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds, graphic);
13693
13702
  var tb1 = this.tempAABBBounds1,
13694
13703
  tb2 = this.tempAABBBounds2;
@@ -13709,6 +13718,7 @@
13709
13718
  }, {
13710
13719
  key: "updateLineAABBBounds",
13711
13720
  value: function updateLineAABBBounds(attribute, lineTheme, aabbBounds, graphic) {
13721
+ if (!this._validCheck(attribute, lineTheme, aabbBounds, graphic)) return aabbBounds;
13712
13722
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds, graphic));
13713
13723
  var tb1 = this.tempAABBBounds1,
13714
13724
  tb2 = this.tempAABBBounds2;
@@ -13742,6 +13752,7 @@
13742
13752
  }, {
13743
13753
  key: "updateAreaAABBBounds",
13744
13754
  value: function updateAreaAABBBounds(attribute, areaTheme, aabbBounds, graphic) {
13755
+ if (!this._validCheck(attribute, areaTheme, aabbBounds, graphic)) return aabbBounds;
13745
13756
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds, graphic) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds, graphic));
13746
13757
  var tb1 = this.tempAABBBounds1,
13747
13758
  tb2 = this.tempAABBBounds2;
@@ -13777,6 +13788,7 @@
13777
13788
  }, {
13778
13789
  key: "updateCircleAABBBounds",
13779
13790
  value: function updateCircleAABBBounds(attribute, circleTheme, aabbBounds, full, graphic) {
13791
+ if (!this._validCheck(attribute, circleTheme, aabbBounds, graphic)) return aabbBounds;
13780
13792
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds, graphic) : this.updateCircleAABBBoundsAccurate(attribute, circleTheme, aabbBounds, graphic));
13781
13793
  var tb1 = this.tempAABBBounds1,
13782
13794
  tb2 = this.tempAABBBounds2;
@@ -13805,6 +13817,7 @@
13805
13817
  }, {
13806
13818
  key: "updateArcAABBBounds",
13807
13819
  value: function updateArcAABBBounds(attribute, arcTheme, aabbBounds, full, graphic) {
13820
+ if (!this._validCheck(attribute, arcTheme, aabbBounds, graphic)) return aabbBounds;
13808
13821
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateArcAABBBoundsImprecise(attribute, arcTheme, aabbBounds, graphic) : this.updateArcAABBBoundsAccurate(attribute, arcTheme, aabbBounds, graphic));
13809
13822
  var tb1 = this.tempAABBBounds1,
13810
13823
  tb2 = this.tempAABBBounds2;
@@ -13846,6 +13859,7 @@
13846
13859
  }, {
13847
13860
  key: "updateSymbolAABBBounds",
13848
13861
  value: function updateSymbolAABBBounds(attribute, symbolTheme, aabbBounds, full, graphic) {
13862
+ if (!this._validCheck(attribute, symbolTheme, aabbBounds, graphic)) return aabbBounds;
13849
13863
  this.updatePathProxyAABBBounds(aabbBounds, graphic) || (full ? this.updateSymbolAABBBoundsImprecise(attribute, symbolTheme, aabbBounds, graphic) : this.updateSymbolAABBBoundsAccurate(attribute, symbolTheme, aabbBounds, graphic));
13850
13864
  var tb1 = this.tempAABBBounds1,
13851
13865
  tb2 = this.tempAABBBounds2;
@@ -13878,6 +13892,7 @@
13878
13892
  }, {
13879
13893
  key: "updateImageAABBBounds",
13880
13894
  value: function updateImageAABBBounds(attribute, imageTheme, aabbBounds, graphic) {
13895
+ if (!this._validCheck(attribute, imageTheme, aabbBounds, graphic)) return aabbBounds;
13881
13896
  if (!this.updatePathProxyAABBBounds(aabbBounds, graphic)) {
13882
13897
  var _attribute$width3 = attribute.width,
13883
13898
  width = _attribute$width3 === void 0 ? imageTheme.width : _attribute$width3,
@@ -13924,6 +13939,15 @@
13924
13939
  }
13925
13940
  this.combindShadowAABBBounds(aabbBounds, graphic), vutils.transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix);
13926
13941
  }
13942
+ }, {
13943
+ key: "_validCheck",
13944
+ value: function _validCheck(attribute, theme, aabbBounds, graphic) {
13945
+ if (!graphic) return !0;
13946
+ if (!graphic.valid) return aabbBounds.clear(), !1;
13947
+ var _attribute$visible = attribute.visible,
13948
+ visible = _attribute$visible === void 0 ? theme.visible : _attribute$visible;
13949
+ return !!visible || (aabbBounds.clear(), !1);
13950
+ }
13927
13951
  }]);
13928
13952
  return DefaultGraphicService;
13929
13953
  }();
@@ -22931,7 +22955,7 @@
22931
22955
  }
22932
22956
  getGraphicBounds(graphic, point = {}) {
22933
22957
  var _a;
22934
- if (graphic.type !== 'line') {
22958
+ if (!graphic || graphic.type !== 'line') {
22935
22959
  return super.getGraphicBounds(graphic, point);
22936
22960
  }
22937
22961
  const { position = 'end' } = this.attribute;
@@ -28063,27 +28087,31 @@
28063
28087
  });
28064
28088
  itemGroup.add(innerGroup);
28065
28089
  let focusStartX = 0;
28066
- const shapeSize = vutils.get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);
28067
- const shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
28068
- const itemShape = createSymbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeAttr.style));
28069
- Object.keys(shapeAttr.state || {}).forEach(key => {
28070
- const color = shapeAttr.state[key].fill ||
28071
- shapeAttr.state[key].stroke;
28072
- if (shape.fill && vutils.isNil(shapeAttr.state[key].fill) && color) {
28073
- shapeAttr.state[key].fill = color;
28074
- }
28075
- if (shape.stroke && vutils.isNil(shapeAttr.state[key].stroke) && color) {
28076
- shapeAttr.state[key].stroke = color;
28077
- }
28078
- });
28079
- this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.state);
28080
- itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
28081
- innerGroup.add(itemShape);
28090
+ let shapeSize = 0;
28091
+ let shapeSpace = 0;
28092
+ if ((shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.visible) !== false) {
28093
+ shapeSize = vutils.get(shapeAttr, 'style.size', DEFAULT_SHAPE_SIZE);
28094
+ shapeSpace = vutils.get(shapeAttr, 'space', DEFAULT_SHAPE_SPACE);
28095
+ const itemShape = createSymbol(Object.assign(Object.assign({ x: 0, y: 0, symbolType: 'circle', strokeBoundsBuffer: 0 }, shape), shapeAttr.style));
28096
+ Object.keys(shapeAttr.state || {}).forEach(key => {
28097
+ const color = shapeAttr.state[key].fill ||
28098
+ shapeAttr.state[key].stroke;
28099
+ if (shape.fill && vutils.isNil(shapeAttr.state[key].fill) && color) {
28100
+ shapeAttr.state[key].fill = color;
28101
+ }
28102
+ if (shape.stroke && vutils.isNil(shapeAttr.state[key].stroke) && color) {
28103
+ shapeAttr.state[key].stroke = color;
28104
+ }
28105
+ });
28106
+ this._appendDataToShape(itemShape, exports.LEGEND_ELEMENT_NAME.itemShape, item, itemGroup, shapeAttr === null || shapeAttr === void 0 ? void 0 : shapeAttr.state);
28107
+ itemShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
28108
+ innerGroup.add(itemShape);
28109
+ }
28082
28110
  let focusShape;
28083
28111
  let focusSpace = 0;
28084
28112
  if (focus) {
28085
28113
  const focusSize = vutils.get(focusIconStyle, 'size', DEFAULT_SHAPE_SIZE);
28086
- focusShape = createSymbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0 }, focusIconStyle), { visible: false, pickMode: 'imprecise', boundsPadding: parsedPadding }));
28114
+ focusShape = createSymbol(Object.assign(Object.assign({ x: 0, y: -focusSize / 2 - 1, strokeBoundsBuffer: 0 }, focusIconStyle), { visible: true, pickMode: 'imprecise', boundsPadding: parsedPadding }));
28087
28115
  this._appendDataToShape(focusShape, exports.LEGEND_ELEMENT_NAME.focus, item, itemGroup);
28088
28116
  focusSpace = focusSize;
28089
28117
  }
@@ -28158,6 +28186,7 @@
28158
28186
  const itemGroupHeight = this._itemHeightByUser || innerGroupHeight + parsedPadding[0] + parsedPadding[2];
28159
28187
  itemGroup.attribute.width = itemGroupWidth;
28160
28188
  itemGroup.attribute.height = itemGroupHeight;
28189
+ focusShape && focusShape.setAttribute('visible', false);
28161
28190
  innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]);
28162
28191
  return itemGroup;
28163
28192
  }
@@ -31509,7 +31538,7 @@
31509
31538
  }
31510
31539
  };
31511
31540
 
31512
- const version = "0.16.15";
31541
+ const version = "0.16.17-alpha.1";
31513
31542
 
31514
31543
  exports.AbstractComponent = AbstractComponent;
31515
31544
  exports.ArcInfo = ArcInfo;