@visactor/vchart 1.13.23-alpha.1 → 1.13.24-alpha.0

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/build/index.js CHANGED
@@ -58360,6 +58360,33 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58360
58360
  });
58361
58361
  }
58362
58362
  }
58363
+ _isGeoRegionRoamDragEnabled() {
58364
+ var _a, _b;
58365
+ const chartSpec = (_b = (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.getSpec) === null || _b === void 0 ? void 0 : _b.call(_a);
58366
+ const regions = chartSpec === null || chartSpec === void 0 ? void 0 : chartSpec.region;
58367
+ if (!isArray$1(regions)) {
58368
+ return false;
58369
+ }
58370
+ return regions.some((region) => {
58371
+ var _a;
58372
+ if ((region === null || region === void 0 ? void 0 : region.coordinate) !== 'geo' || !region.roam) {
58373
+ return false;
58374
+ }
58375
+ if (region.roam === true) {
58376
+ return true;
58377
+ }
58378
+ return (_a = region.roam.drag) !== null && _a !== void 0 ? _a : true;
58379
+ });
58380
+ }
58381
+ _shouldDisableCanvasTouchAction() {
58382
+ if (!isTrueBrowser(this._option.mode)) {
58383
+ return false;
58384
+ }
58385
+ const supportsTouchEvents = isValid$1(this._option.supportsTouchEvents)
58386
+ ? this._option.supportsTouchEvents
58387
+ : vglobal.supportsTouchEvents;
58388
+ return supportsTouchEvents === false && this._isGeoRegionRoamDragEnabled();
58389
+ }
58363
58390
  _setCanvasStyle() {
58364
58391
  if (!this._view) {
58365
58392
  return;
@@ -58370,6 +58397,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58370
58397
  const canvas = this.getCanvas();
58371
58398
  if (canvas) {
58372
58399
  canvas.style.display = 'block';
58400
+ canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? 'none' : '';
58373
58401
  }
58374
58402
  }
58375
58403
  }
@@ -58416,6 +58444,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58416
58444
  return;
58417
58445
  }
58418
58446
  chart.compile();
58447
+ this._setCanvasStyle();
58419
58448
  chart.afterCompile();
58420
58449
  this.updateDepend();
58421
58450
  this.compileInteractions();
@@ -80493,41 +80522,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80493
80522
  'rect'
80494
80523
  ];
80495
80524
 
80496
- class WordMeasureCache {
80497
- constructor(maxSize = 1000) {
80498
- this._map = new Map();
80499
- this._maxSize = maxSize;
80500
- }
80501
- get(key) {
80502
- const v = this._map.get(key);
80503
- if (!v) {
80504
- return undefined;
80505
- }
80506
- this._map.delete(key);
80507
- this._map.set(key, v);
80508
- return v;
80509
- }
80510
- set(key, value) {
80511
- if (this._map.has(key)) {
80512
- this._map.set(key, value);
80513
- return;
80514
- }
80515
- if (this._map.size >= this._maxSize) {
80516
- const oldest = this._map.keys().next().value;
80517
- if (oldest !== undefined) {
80518
- this._map.delete(oldest);
80519
- }
80520
- }
80521
- this._map.set(key, value);
80522
- }
80523
- clear() {
80524
- this._map.clear();
80525
- }
80526
- size() {
80527
- return this._map.size;
80528
- }
80529
- }
80530
-
80531
80525
  const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
80532
80526
 
80533
80527
  const wordCloudSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { ["word"]: { name: "word", type: "text" }, ["fillingWord"]: { name: "fillingWord", type: "text" }, ["wordMask"]: { name: "wordMask", type: "rect" } });
@@ -80604,16 +80598,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80604
80598
  !SHAPE_TYPE.includes(this._maskShape) &&
80605
80599
  !['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);
80606
80600
  this._defaultFontFamily = this._option.getTheme().fontFamily;
80607
- if (!this._wordMeasureCache) {
80608
- this._wordMeasureCache = new WordMeasureCache(1000);
80609
- }
80610
80601
  }
80611
80602
  initData() {
80612
80603
  var _a, _b;
80613
80604
  super.initData();
80614
80605
  (_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.addListener('change', () => {
80615
- var _a;
80616
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80617
80606
  this._dataChange = true;
80618
80607
  this.compile();
80619
80608
  });
@@ -80782,7 +80771,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80782
80771
  var _a, _b, _c, _d, _e, _f;
80783
80772
  const fillingWordStyleSpec = (_b = (_a = this._spec.fillingWord) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
80784
80773
  const wordCloudShapeConfig = (_c = this._wordCloudShapeConfig) !== null && _c !== void 0 ? _c : {};
80785
- return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { measureCache: this._wordMeasureCache, rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
80774
+ return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
80786
80775
  ? { field: wordCloudShapeConfig.fillingFontFamilyField }
80787
80776
  : (_d = fillingWordStyleSpec.fontFamily) !== null && _d !== void 0 ? _d : this._defaultFontFamily, fillingPadding: (_f = (_e = this._spec.fillingWord) === null || _e === void 0 ? void 0 : _e.padding) !== null && _f !== void 0 ? _f : DEFAULT_FONT_PADDING, fillingFontStyle: isValid$1(wordCloudShapeConfig.fillingFontStyleField)
80788
80777
  ? { field: wordCloudShapeConfig.fillingFontStyleField }
@@ -80831,7 +80820,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80831
80820
  return [this._wordMark];
80832
80821
  }
80833
80822
  reInit() {
80834
- var _a;
80835
80823
  super.reInit();
80836
80824
  if (this._keyWordColorCallback) {
80837
80825
  this._keyWordColorCallback = null;
@@ -80839,13 +80827,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80839
80827
  if (this._fillingColorCallback) {
80840
80828
  this._fillingColorCallback = null;
80841
80829
  }
80842
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80843
- }
80844
- release() {
80845
- var _a;
80846
- super.release();
80847
- (_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
80848
- this._wordMeasureCache = undefined;
80849
80830
  }
80850
80831
  }
80851
80832
  BaseWordCloudSeries.mark = wordCloudSeriesMark;
@@ -81772,30 +81753,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81772
81753
  !function (WORDCLOUD_SHAPE_HOOK_EVENT) {
81773
81754
  WORDCLOUD_SHAPE_HOOK_EVENT.BEFORE_WORDCLOUD_SHAPE_LAYOUT = "beforeWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_LAYOUT = "afterWordcloudShapeLayout", WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW = "afterWordcloudShapeDraw";
81774
81755
  }(WORDCLOUD_SHAPE_HOOK_EVENT || (WORDCLOUD_SHAPE_HOOK_EVENT = {}));
81775
- class MapWordMeasureCache {
81776
- constructor(maxSize = 1e3) {
81777
- this._map = new Map(), this._maxSize = maxSize;
81778
- }
81779
- get(key) {
81780
- const value = this._map.get(key);
81781
- if (void 0 !== value) return this._map.delete(key), this._map.set(key, value), value;
81782
- }
81783
- set(key, value) {
81784
- if (this._map.has(key)) this._map.set(key, value);else {
81785
- if (this._map.size >= this._maxSize) {
81786
- const firstKey = this._map.keys().next().value;
81787
- void 0 !== firstKey && this._map.delete(firstKey);
81788
- }
81789
- this._map.set(key, value);
81790
- }
81791
- }
81792
- clear() {
81793
- this._map.clear();
81794
- }
81795
- size() {
81796
- return this._map.size;
81797
- }
81798
- }
81799
81756
  const colorListEqual = (arr0, arr1) => {
81800
81757
  if (1 === arr1.length && "#537EF5" === arr1[0]) return !0;
81801
81758
  if (!Array.isArray(arr0) || !Array.isArray(arr1) || arr0.length !== arr1.length) return !1;
@@ -82035,7 +81992,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82035
81992
  ratio: ratio
82036
81993
  } = region;
82037
81994
  for (let i = 0; i < regionWords.length; i++) {
82038
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
81995
+ measureSprite(canvas, ctx, words, i);
82039
81996
  const word = regionWords[i];
82040
81997
  word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82041
81998
  }
@@ -82045,7 +82002,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82045
82002
  if (0 === failedWords.length) break;
82046
82003
  for (let i = 0; i < failedWords.length; i++) {
82047
82004
  const word = failedWords[i];
82048
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82005
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82049
82006
  }
82050
82007
  }
82051
82008
  layoutConfig.board = board;
@@ -82091,7 +82048,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82091
82048
  } = region;
82092
82049
  let restartTag = !1;
82093
82050
  for (let i = 0; i < regionWords.length; i++) {
82094
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
82051
+ measureSprite(canvas, ctx, words, i);
82095
82052
  const word = regionWords[i];
82096
82053
  if (word.x = center[0], word.y = center[1], !word.skip && word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) word.hasPlaced = !0;else {
82097
82054
  if (!word.skip && word.weight > weightStd && globalShinkFactor > globalShinkLimit) {
@@ -82116,7 +82073,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82116
82073
  if (0 === failedWords.length) break;
82117
82074
  for (let i = 0; i < failedWords.length; i++) {
82118
82075
  const word = failedWords[i];
82119
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82076
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82120
82077
  }
82121
82078
  }
82122
82079
  layoutConfig.board = board;
@@ -82161,7 +82118,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82161
82118
  } = region;
82162
82119
  let restartTag = !1;
82163
82120
  for (let i = 0; i < regionWords.length; i++) {
82164
- measureSprite(canvas, ctx, words, i, layoutConfig.measureCache);
82121
+ measureSprite(canvas, ctx, words, i);
82165
82122
  const word = regionWords[i];
82166
82123
  if (word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) {
82167
82124
  if (word.hasPlaced = !0, word.weight >= weightStd && importantWordSuccessedNum++, importantWordSuccessedNum >= importantCount && !layoutFinish) {
@@ -82187,7 +82144,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82187
82144
  if (0 === failedWords.length) break;
82188
82145
  for (let i = 0; i < failedWords.length; i++) {
82189
82146
  const word = failedWords[i];
82190
- measureSprite(canvas, ctx, failedWords, i, layoutConfig.measureCache), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82147
+ measureSprite(canvas, ctx, failedWords, i), word.x = shapeCenter[0], word.y = shapeCenter[1], word.hasText && place$1(board, word, shapeMaxR, shapeRatio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
82191
82148
  }
82192
82149
  }
82193
82150
  layoutConfig.board = board;
@@ -82266,13 +82223,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82266
82223
  return [ratio * (t *= .1) * Math.cos(t), t * Math.sin(t)];
82267
82224
  };
82268
82225
  }
82269
- function measureSprite(canvas, ctx, words, wi, cache) {
82270
- const targetWord = words[wi];
82271
- if (targetWord.sprite || 0 === targetWord.fontSize) return;
82272
- if (cache) {
82273
- const cached = cache.get(getWordMeasureKey(targetWord));
82274
- if (cached) return targetWord.sprite = cached.sprite, targetWord.bounds = cached.bounds, targetWord.wordSize = cached.wordSize, void (targetWord.hasText = !0);
82275
- }
82226
+ function measureSprite(canvas, ctx, words, wi) {
82227
+ if (words[wi].sprite || 0 === words[wi].fontSize) return;
82276
82228
  const cw = 2048,
82277
82229
  radians = Math.PI / 180,
82278
82230
  n = words.length;
@@ -82335,25 +82287,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82335
82287
  }
82336
82288
  seen && (j < dTop && (dTop = j), j > dBottom && (dBottom = j));
82337
82289
  }
82338
- if (word.bounds = {
82290
+ word.bounds = {
82339
82291
  dTop: (wordSize[1] >> 1) - dTop,
82340
82292
  dBottom: dBottom - (wordSize[1] >> 1),
82341
82293
  dLeft: (wordSize[0] >> 1) - dLeft,
82342
82294
  dRight: dRight - (wordSize[0] >> 1)
82343
- }, word.sprite = sprite, cache) {
82344
- const key = getWordMeasureKey(word);
82345
- cache.set(key, {
82346
- sprite: sprite,
82347
- bounds: word.bounds,
82348
- wordSize: wordSize
82349
- });
82350
- }
82351
- delete word.LT;
82295
+ }, word.sprite = sprite, delete word.LT;
82352
82296
  }
82353
82297
  }
82354
- function getWordMeasureKey(word) {
82355
- return String(word.text) + "|" + String(word.fontFamily) + "|" + String(word.fontStyle) + "|" + String(word.fontWeight) + "|" + String(word.fontSize) + "|" + String(word.rotate) + "|" + String(word.padding);
82356
- }
82357
82298
  function initBoardWithShape(segmentationOutput) {
82358
82299
  const {
82359
82300
  segmentation: {
@@ -82450,7 +82391,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82450
82391
  } = shapeBounds,
82451
82392
  [startX, startY] = [x1 + ~~(randomGenerator() * fillingXStep * 2), y1 + ~~(randomGenerator() * fillingYStep * 2)];
82452
82393
  for (let y = startY; y <= y2; y += fillingYStep) for (let x = startX; x <= x2; x += fillingXStep) {
82453
- measureSprite(canvas, ctx, fillingWords, wi, layoutConfig.measureCache);
82394
+ measureSprite(canvas, ctx, fillingWords, wi);
82454
82395
  const word = fillingWords[wi];
82455
82396
  word.x = x, word.y = y;
82456
82397
  const {
@@ -82567,7 +82508,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82567
82508
  return this.progressiveResult;
82568
82509
  }
82569
82510
  doLayout() {
82570
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
82511
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
82571
82512
  const segmentationInput = this.segmentationInput,
82572
82513
  segmentationOutput = segmentation(segmentationInput);
82573
82514
  if (!segmentationOutput.segmentation.regions.length) return;
@@ -82594,36 +82535,35 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82594
82535
  const layoutConfig = {
82595
82536
  size: options.size,
82596
82537
  ratio: options.ratio || .8,
82597
- measureCache: null !== (_a = options.measureCache) && void 0 !== _a ? _a : new MapWordMeasureCache(),
82598
82538
  shapeUrl: options.shape,
82599
82539
  random: void 0 === options.random || options.random,
82600
- textLayoutTimes: null !== (_b = options.textLayoutTimes) && void 0 !== _b ? _b : 3,
82540
+ textLayoutTimes: null !== (_a = options.textLayoutTimes) && void 0 !== _a ? _a : 3,
82601
82541
  removeWhiteBorder: options.removeWhiteBorder,
82602
- layoutMode: null !== (_c = options.layoutMode) && void 0 !== _c ? _c : "default",
82603
- fontSizeShrinkFactor: null !== (_d = options.fontSizeShrinkFactor) && void 0 !== _d ? _d : .8,
82604
- stepFactor: null !== (_e = options.stepFactor) && void 0 !== _e ? _e : 1,
82605
- importantWordCount: null !== (_f = options.importantWordCount) && void 0 !== _f ? _f : 10,
82542
+ layoutMode: null !== (_b = options.layoutMode) && void 0 !== _b ? _b : "default",
82543
+ fontSizeShrinkFactor: null !== (_c = options.fontSizeShrinkFactor) && void 0 !== _c ? _c : .8,
82544
+ stepFactor: null !== (_d = options.stepFactor) && void 0 !== _d ? _d : 1,
82545
+ importantWordCount: null !== (_e = options.importantWordCount) && void 0 !== _e ? _e : 10,
82606
82546
  globalShinkLimit: options.globalShinkLimit || .2,
82607
- fontSizeEnlargeFactor: null !== (_g = options.fontSizeEnlargeFactor) && void 0 !== _g ? _g : 1.5,
82608
- fillingRatio: null !== (_h = options.fillingRatio) && void 0 !== _h ? _h : .7,
82609
- fillingTimes: null !== (_j = options.fillingTimes) && void 0 !== _j ? _j : 4,
82610
- fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_k = options.fillingXStep) && void 0 !== _k ? _k : 4,
82611
- fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_l = options.fillingYStep) && void 0 !== _l ? _l : 4,
82547
+ fontSizeEnlargeFactor: null !== (_f = options.fontSizeEnlargeFactor) && void 0 !== _f ? _f : 1.5,
82548
+ fillingRatio: null !== (_g = options.fillingRatio) && void 0 !== _g ? _g : .7,
82549
+ fillingTimes: null !== (_h = options.fillingTimes) && void 0 !== _h ? _h : 4,
82550
+ fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_j = options.fillingXStep) && void 0 !== _j ? _j : 4,
82551
+ fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_k = options.fillingYStep) && void 0 !== _k ? _k : 4,
82612
82552
  fillingInitialFontSize: options.fillingInitialFontSize,
82613
82553
  fillingDeltaFontSize: options.fillingDeltaFontSize,
82614
- fillingInitialOpacity: null !== (_m = options.fillingInitialOpacity) && void 0 !== _m ? _m : .8,
82615
- fillingDeltaOpacity: null !== (_o = options.fillingDeltaOpacity) && void 0 !== _o ? _o : .05,
82554
+ fillingInitialOpacity: null !== (_l = options.fillingInitialOpacity) && void 0 !== _l ? _l : .8,
82555
+ fillingDeltaOpacity: null !== (_m = options.fillingDeltaOpacity) && void 0 !== _m ? _m : .05,
82616
82556
  getFillingFontFamily: field(options.fillingFontFamily || "sans-serif"),
82617
82557
  getFillingFontStyle: field(options.fillingFontStyle || "normal"),
82618
82558
  getFillingFontWeight: field(options.fillingFontWeight || "normal"),
82619
- getFillingPadding: field(null !== (_p = options.fillingPadding) && void 0 !== _p ? _p : .4),
82620
- fillingRotateList: null !== (_q = options.fillingRotateList) && void 0 !== _q ? _q : [0, 90],
82621
- fillingDeltaFontSizeFactor: null !== (_r = options.fillingDeltaFontSizeFactor) && void 0 !== _r ? _r : .2,
82559
+ getFillingPadding: field(null !== (_o = options.fillingPadding) && void 0 !== _o ? _o : .4),
82560
+ fillingRotateList: null !== (_p = options.fillingRotateList) && void 0 !== _p ? _p : [0, 90],
82561
+ fillingDeltaFontSizeFactor: null !== (_q = options.fillingDeltaFontSizeFactor) && void 0 !== _q ? _q : .2,
82622
82562
  fillingColorList: options.fillingColorList || ["#537EF5"],
82623
82563
  sameColorList: !1,
82624
- minInitFontSize: null !== (_s = options.minInitFontSize) && void 0 !== _s ? _s : 10,
82625
- minFontSize: null !== (_t = options.minFontSize) && void 0 !== _t ? _t : 4,
82626
- minFillFontSize: null !== (_u = options.minFillFontSize) && void 0 !== _u ? _u : 2
82564
+ minInitFontSize: null !== (_r = options.minInitFontSize) && void 0 !== _r ? _r : 10,
82565
+ minFontSize: null !== (_s = options.minFontSize) && void 0 !== _s ? _s : 4,
82566
+ minFillFontSize: null !== (_t = options.minFillFontSize) && void 0 !== _t ? _t : 2
82627
82567
  },
82628
82568
  sameColorList = colorListEqual(wordsConfig.colorList, layoutConfig.fillingColorList);
82629
82569
  layoutConfig.sameColorList = sameColorList, initColorScale(data, wordsConfig, layoutConfig, options), initFillingWordsFontSize(data, wordsConfig, layoutConfig, segmentationOutput);
@@ -82670,8 +82610,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82670
82610
  successedWords: successedWords,
82671
82611
  failedWords: failedWords
82672
82612
  } = cloud(words, layoutConfig, segmentationOutput),
82673
- textKey = null !== (_w = null === (_v = options.text) || void 0 === _v ? void 0 : _v.field) && void 0 !== _w ? _w : "textKey",
82674
- dataIndexKey = null !== (_x = options.dataIndexKey) && void 0 !== _x ? _x : "defaultDataIndexKey",
82613
+ textKey = null !== (_v = null === (_u = options.text) || void 0 === _u ? void 0 : _u.field) && void 0 !== _v ? _v : "textKey",
82614
+ dataIndexKey = null !== (_w = options.dataIndexKey) && void 0 !== _w ? _w : "defaultDataIndexKey",
82675
82615
  as = options.as ? Object.assign(Object.assign({}, OUTPUT), options.as) : OUTPUT;
82676
82616
  let w, t;
82677
82617
  const modKeywords = [];
@@ -82686,7 +82626,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
82686
82626
  successedWords: successedWords,
82687
82627
  failedWords: failedWords
82688
82628
  });
82689
- const stage = null === (_y = this.view.renderer) || void 0 === _y ? void 0 : _y.stage();
82629
+ const stage = null === (_x = this.view.renderer) || void 0 === _x ? void 0 : _x.stage();
82690
82630
  stage && stage.hooks.afterRender.tap(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, () => {
82691
82631
  this.view.emit(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, {
82692
82632
  successedWords: successedWords,
@@ -98983,7 +98923,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98983
98923
  };
98984
98924
  }
98985
98925
  _getTitleAttrs() {
98986
- var _a, _b, _c, _d, _e, _f, _g, _h;
98926
+ var _a, _b, _c, _d, _e, _f;
98987
98927
  if (this._spec.visible === false) {
98988
98928
  return { visible: false };
98989
98929
  }
@@ -98991,10 +98931,26 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98991
98931
  const titleWidth = calcLayoutNumber(this._spec.width, layoutRect.width, null, layoutRect.width);
98992
98932
  const titleMaxWidth = calcLayoutNumber(this._spec.maxWidth, layoutRect.width, null, layoutRect.width);
98993
98933
  const maxWidth = Math.max(Math.min(titleWidth, titleMaxWidth, layoutRect.width), 0);
98994
- const attrs = Object.assign(Object.assign({}, pickWithout(this._spec, ['padding'])), { textType: (_a = this._spec.textType) !== null && _a !== void 0 ? _a : 'text', text: (_b = this._spec.text) !== null && _b !== void 0 ? _b : '', subtextType: (_c = this._spec.subtextType) !== null && _c !== void 0 ? _c : 'text', subtext: (_d = this._spec.subtext) !== null && _d !== void 0 ? _d : '', x: (_e = this._spec.x) !== null && _e !== void 0 ? _e : 0, y: (_f = this._spec.y) !== null && _f !== void 0 ? _f : 0, height: this._spec.height, minWidth: this._spec.minWidth, maxWidth, minHeight: this._spec.minHeight, maxHeight: this._spec.maxHeight, padding: this._spec.innerPadding, align: (_g = this._spec.align) !== null && _g !== void 0 ? _g : 'left', verticalAlign: (_h = this._spec.verticalAlign) !== null && _h !== void 0 ? _h : 'top', textStyle: Object.assign({ width: maxWidth, maxLineWidth: maxWidth }, this._spec.textStyle), subtextStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.subtextStyle) });
98934
+ const hasText = isValid$1(this._spec.text) && this._spec.text !== '';
98935
+ const hasSubtext = isValid$1(this._spec.subtext) && this._spec.subtext !== '';
98936
+ const attrs = Object.assign(Object.assign({}, pickWithout(this._spec, ['padding'])), { textType: (_a = this._spec.textType) !== null && _a !== void 0 ? _a : 'text', text: hasText ? this._spec.text : undefined, subtextType: (_b = this._spec.subtextType) !== null && _b !== void 0 ? _b : 'text', subtext: hasSubtext ? this._spec.subtext : undefined, x: (_c = this._spec.x) !== null && _c !== void 0 ? _c : 0, y: (_d = this._spec.y) !== null && _d !== void 0 ? _d : 0, height: this._spec.height, minWidth: this._spec.minWidth, maxWidth, minHeight: this._spec.minHeight, maxHeight: this._spec.maxHeight, padding: this._spec.innerPadding, align: (_e = this._spec.align) !== null && _e !== void 0 ? _e : 'left', verticalAlign: (_f = this._spec.verticalAlign) !== null && _f !== void 0 ? _f : 'top', textStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.textStyle), subtextStyle: Object.assign({ maxLineWidth: maxWidth }, this._spec.subtextStyle) });
98937
+ if (hasText) {
98938
+ attrs.textStyle.width = maxWidth;
98939
+ }
98940
+ if (hasSubtext) {
98941
+ attrs.subtextStyle.width = maxWidth;
98942
+ }
98995
98943
  if (isValid$1(this._spec.width)) {
98996
- attrs.textStyle.width = Math.max(titleWidth, layoutRect.width);
98997
- attrs.subtextStyle.width = attrs.textStyle.width;
98944
+ const clampedWidth = Math.max(Math.min(titleWidth, layoutRect.width), 0);
98945
+ if (hasText) {
98946
+ attrs.textStyle.width = clampedWidth;
98947
+ }
98948
+ else {
98949
+ delete attrs.textStyle.width;
98950
+ }
98951
+ if (hasSubtext) {
98952
+ attrs.subtextStyle.width = clampedWidth;
98953
+ }
98998
98954
  }
98999
98955
  return attrs;
99000
98956
  }