@visactor/vrender-components 0.17.4 → 0.17.5-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
@@ -3163,6 +3163,7 @@
3163
3163
  wordBreak: "break-all",
3164
3164
  ignoreBuf: !1,
3165
3165
  verticalMode: 0,
3166
+ wrap: !1,
3166
3167
  whiteSpace: "no-wrap",
3167
3168
  heightLimit: 1 / 0,
3168
3169
  lineClamp: 1 / 0,
@@ -8218,7 +8219,7 @@
8218
8219
  return CanvasTextLayout;
8219
8220
  }();
8220
8221
 
8221
- var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
8222
+ var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
8222
8223
  var Text = /*#__PURE__*/function (_Graphic) {
8223
8224
  _inherits(Text, _Graphic);
8224
8225
  var _super = _createSuper(Text);
@@ -8278,7 +8279,9 @@
8278
8279
  key: "_isValid",
8279
8280
  value: function _isValid() {
8280
8281
  var text = this.attribute.text;
8281
- return null != text && "" !== text;
8282
+ return vutils.isArray(text) ? !text.every(function (t) {
8283
+ return null == t || "" === t;
8284
+ }) : null != text && "" !== text;
8282
8285
  }
8283
8286
  }, {
8284
8287
  key: "doUpdateAABBBounds",
@@ -8426,7 +8429,10 @@
8426
8429
  value: function updateHorizontalSinglelineAABBBounds(text) {
8427
8430
  var _a, _b;
8428
8431
  var textTheme = getTheme(this).text,
8429
- textMeasure = application.graphicUtil.textMeasure;
8432
+ _this$attribute$wrap = this.attribute.wrap,
8433
+ wrap = _this$attribute$wrap === void 0 ? textTheme.wrap : _this$attribute$wrap;
8434
+ if (wrap) return this.updateWrapAABBBounds([text]);
8435
+ var textMeasure = application.graphicUtil.textMeasure;
8430
8436
  var width, str;
8431
8437
  var attribute = this.attribute,
8432
8438
  _attribute$maxLineWid3 = attribute.maxLineWidth,
@@ -8584,7 +8590,10 @@
8584
8590
  value: function updateHorizontalMultilineAABBBounds(text) {
8585
8591
  var _a, _b;
8586
8592
  var textTheme = getTheme(this).text,
8587
- attribute = this.attribute,
8593
+ _this$attribute$wrap2 = this.attribute.wrap,
8594
+ wrap = _this$attribute$wrap2 === void 0 ? textTheme.wrap : _this$attribute$wrap2;
8595
+ if (wrap) return this.updateWrapAABBBounds(text);
8596
+ var attribute = this.attribute,
8588
8597
  _attribute$fontFamily3 = attribute.fontFamily,
8589
8598
  fontFamily = _attribute$fontFamily3 === void 0 ? textTheme.fontFamily : _attribute$fontFamily3,
8590
8599
  _attribute$textAlign3 = attribute.textAlign,
@@ -8771,9 +8780,11 @@
8771
8780
  var WrapText = /*#__PURE__*/function (_Text) {
8772
8781
  _inherits(WrapText, _Text);
8773
8782
  var _super = _createSuper(WrapText);
8774
- function WrapText() {
8783
+ function WrapText(params) {
8775
8784
  _classCallCheck(this, WrapText);
8776
- return _super.apply(this, arguments);
8785
+ return _super.call(this, Object.assign(Object.assign({}, params), {
8786
+ wrap: !0
8787
+ }));
8777
8788
  }
8778
8789
  _createClass(WrapText, [{
8779
8790
  key: "_isValid",
@@ -14311,7 +14322,7 @@
14311
14322
  if (context.beginPath(), keepDirIn3d && context.camera && context.project) {
14312
14323
  var p = context.project(x, y, z),
14313
14324
  camera = context.camera;
14314
- context.camera = null, !1 === parsedPath.draw(context, size, p.x, p.y, void 0, function (p, a) {
14325
+ context.camera = null, !1 === parsedPath.draw(context, vutils.isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, function (p, a) {
14315
14326
  var _a, _b, _c;
14316
14327
  if (symbol._parsedPath.svgCache) {
14317
14328
  var obj = Object.assign({}, a);
@@ -18554,6 +18565,10 @@
18554
18565
  e.stopPropagation();
18555
18566
  const { direction } = this.attribute;
18556
18567
  this._prePos = direction === 'horizontal' ? e.clientX : e.clientY;
18568
+ this._dispatchEvent('scrollDown', {
18569
+ pos: this._prePos,
18570
+ event: e
18571
+ });
18557
18572
  if (vglobal.env === 'browser') {
18558
18573
  vglobal.addEventListener('pointermove', this._onSliderPointerMove, { capture: true });
18559
18574
  vglobal.addEventListener('pointerup', this._onSliderPointerUp);
@@ -20693,6 +20708,7 @@
20693
20708
  const currentTextMap = new Map();
20694
20709
  const prevTextMap = this._graphicToText || new Map();
20695
20710
  const texts = [];
20711
+ const labelLines = [];
20696
20712
  labels.forEach((text, index) => {
20697
20713
  var _a, _b, _c, _d, _e, _f, _g;
20698
20714
  const labelLine = this._labelLine(text);
@@ -20708,12 +20724,14 @@
20708
20724
  this.add(text);
20709
20725
  if (labelLine) {
20710
20726
  this._setStatesOfLabelLine(labelLine);
20727
+ labelLines.push(labelLine);
20711
20728
  this.add(labelLine);
20712
20729
  }
20713
20730
  this._syncStateWithRelatedGraphic(relatedGraphic);
20714
20731
  relatedGraphic.once('animate-bind', a => {
20715
20732
  text.setAttributes(from);
20716
- const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, this._animationConfig.enter);
20733
+ labelLine && labelLine.setAttributes(from);
20734
+ const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
20717
20735
  relatedGraphic.on('afterAttributeUpdate', listener);
20718
20736
  });
20719
20737
  }
@@ -20784,22 +20802,23 @@
20784
20802
  relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
20785
20803
  }
20786
20804
  }
20787
- _afterRelatedGraphicAttributeUpdate(text, texts, index, relatedGraphic, to, { mode, duration, easing, delay }) {
20805
+ _afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, { mode, duration, easing, delay }) {
20788
20806
  const listener = (event) => {
20789
- var _a, _b;
20807
+ var _a, _b, _c;
20790
20808
  const { detail } = event;
20791
20809
  if (!detail) {
20792
20810
  return {};
20793
20811
  }
20794
- const isValidAnimateState = detail &&
20795
- detail.type === AttributeUpdateType.ANIMATE_UPDATE &&
20796
- detail.animationState &&
20797
- ((_a = detail.animationState.step) === null || _a === void 0 ? void 0 : _a.type) !== 'wait';
20812
+ const step = (_a = detail.animationState) === null || _a === void 0 ? void 0 : _a.step;
20813
+ const isValidAnimateState = detail.type === AttributeUpdateType.ANIMATE_UPDATE &&
20814
+ step &&
20815
+ !(step.type === 'wait' && ((_b = step.prev) === null || _b === void 0 ? void 0 : _b.type) == null);
20798
20816
  if (!isValidAnimateState) {
20799
20817
  return {};
20800
20818
  }
20801
20819
  if (detail.type === AttributeUpdateType.ANIMATE_END) {
20802
20820
  text.setAttributes(to);
20821
+ labelLine && labelLine.setAttributes(to);
20803
20822
  return;
20804
20823
  }
20805
20824
  const onStart = () => {
@@ -20812,6 +20831,7 @@
20812
20831
  case 'after':
20813
20832
  if (detail.animationState.end) {
20814
20833
  text.animate({ onStart }).wait(delay).to(to, duration, easing);
20834
+ labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
20815
20835
  }
20816
20836
  break;
20817
20837
  case 'after-all':
@@ -20820,6 +20840,9 @@
20820
20840
  texts.forEach(t => {
20821
20841
  t.animate({ onStart }).wait(delay).to(to, duration, easing);
20822
20842
  });
20843
+ labelLines.forEach(t => {
20844
+ t.animate().wait(delay).to(to, duration, easing);
20845
+ });
20823
20846
  }
20824
20847
  }
20825
20848
  break;
@@ -20829,12 +20852,14 @@
20829
20852
  const point = this._idToPoint.get(text.attribute.id);
20830
20853
  if (point &&
20831
20854
  (!text.animates || !text.animates.has('label-animate')) &&
20832
- relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_b = this.stage) === null || _b === void 0 ? void 0 : _b.pickerService)) {
20855
+ relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.pickerService)) {
20833
20856
  text.animate({ onStart }).wait(delay).to(to, duration, easing);
20857
+ labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
20834
20858
  }
20835
20859
  }
20836
20860
  else if (detail.animationState.isFirstFrameOfStep) {
20837
20861
  text.animate({ onStart }).wait(delay).to(to, duration, easing);
20862
+ labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
20838
20863
  }
20839
20864
  break;
20840
20865
  }
@@ -29901,7 +29926,7 @@
29901
29926
  }
29902
29927
  };
29903
29928
 
29904
- const version = "0.17.4";
29929
+ const version = "0.17.5-alpha.1";
29905
29930
 
29906
29931
  exports.AbstractComponent = AbstractComponent;
29907
29932
  exports.ArcInfo = ArcInfo;