@visactor/vchart 1.13.23-alpha.1 → 1.13.23
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/es5/index.js +1 -1
- package/build/index.es.js +54 -127
- package/build/index.js +54 -127
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/component/title/title.js +16 -12
- package/cjs/component/title/title.js.map +1 -1
- package/cjs/series/word-cloud/base.d.ts +0 -2
- package/cjs/series/word-cloud/base.js +4 -13
- package/cjs/series/word-cloud/base.js.map +1 -1
- package/esm/component/title/title.js +15 -12
- package/esm/component/title/title.js.map +1 -1
- package/esm/series/word-cloud/base.d.ts +0 -2
- package/esm/series/word-cloud/base.js +3 -14
- package/esm/series/word-cloud/base.js.map +1 -1
- package/package.json +10 -10
- package/cjs/series/word-cloud/measure-cache.d.ts +0 -19
- package/cjs/series/word-cloud/measure-cache.js +0 -33
- package/cjs/series/word-cloud/measure-cache.js.map +0 -1
- package/esm/series/word-cloud/measure-cache.d.ts +0 -19
- package/esm/series/word-cloud/measure-cache.js +0 -25
- package/esm/series/word-cloud/measure-cache.js.map +0 -1
package/build/index.es.js
CHANGED
|
@@ -80487,41 +80487,6 @@ const SHAPE_TYPE = [
|
|
|
80487
80487
|
'rect'
|
|
80488
80488
|
];
|
|
80489
80489
|
|
|
80490
|
-
class WordMeasureCache {
|
|
80491
|
-
constructor(maxSize = 1000) {
|
|
80492
|
-
this._map = new Map();
|
|
80493
|
-
this._maxSize = maxSize;
|
|
80494
|
-
}
|
|
80495
|
-
get(key) {
|
|
80496
|
-
const v = this._map.get(key);
|
|
80497
|
-
if (!v) {
|
|
80498
|
-
return undefined;
|
|
80499
|
-
}
|
|
80500
|
-
this._map.delete(key);
|
|
80501
|
-
this._map.set(key, v);
|
|
80502
|
-
return v;
|
|
80503
|
-
}
|
|
80504
|
-
set(key, value) {
|
|
80505
|
-
if (this._map.has(key)) {
|
|
80506
|
-
this._map.set(key, value);
|
|
80507
|
-
return;
|
|
80508
|
-
}
|
|
80509
|
-
if (this._map.size >= this._maxSize) {
|
|
80510
|
-
const oldest = this._map.keys().next().value;
|
|
80511
|
-
if (oldest !== undefined) {
|
|
80512
|
-
this._map.delete(oldest);
|
|
80513
|
-
}
|
|
80514
|
-
}
|
|
80515
|
-
this._map.set(key, value);
|
|
80516
|
-
}
|
|
80517
|
-
clear() {
|
|
80518
|
-
this._map.clear();
|
|
80519
|
-
}
|
|
80520
|
-
size() {
|
|
80521
|
-
return this._map.size;
|
|
80522
|
-
}
|
|
80523
|
-
}
|
|
80524
|
-
|
|
80525
80490
|
const WORD_CLOUD_TEXT = `${PREFIX}_WORD_CLOUD_TEXT`;
|
|
80526
80491
|
|
|
80527
80492
|
const wordCloudSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), { ["word"]: { name: "word", type: "text" }, ["fillingWord"]: { name: "fillingWord", type: "text" }, ["wordMask"]: { name: "wordMask", type: "rect" } });
|
|
@@ -80598,16 +80563,11 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80598
80563
|
!SHAPE_TYPE.includes(this._maskShape) &&
|
|
80599
80564
|
!['fast', 'grid', 'cloud'].includes(this._wordCloudConfig.layoutMode);
|
|
80600
80565
|
this._defaultFontFamily = this._option.getTheme().fontFamily;
|
|
80601
|
-
if (!this._wordMeasureCache) {
|
|
80602
|
-
this._wordMeasureCache = new WordMeasureCache(1000);
|
|
80603
|
-
}
|
|
80604
80566
|
}
|
|
80605
80567
|
initData() {
|
|
80606
80568
|
var _a, _b;
|
|
80607
80569
|
super.initData();
|
|
80608
80570
|
(_b = (_a = this.getViewData()) === null || _a === void 0 ? void 0 : _a.target) === null || _b === void 0 ? void 0 : _b.addListener('change', () => {
|
|
80609
|
-
var _a;
|
|
80610
|
-
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80611
80571
|
this._dataChange = true;
|
|
80612
80572
|
this.compile();
|
|
80613
80573
|
});
|
|
@@ -80776,7 +80736,7 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80776
80736
|
var _a, _b, _c, _d, _e, _f;
|
|
80777
80737
|
const fillingWordStyleSpec = (_b = (_a = this._spec.fillingWord) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
80778
80738
|
const wordCloudShapeConfig = (_c = this._wordCloudShapeConfig) !== null && _c !== void 0 ? _c : {};
|
|
80779
|
-
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), {
|
|
80739
|
+
return Object.assign(Object.assign(Object.assign({}, wordCloudShapeConfig), this._getCommonTransformOptions()), { rotateList: this._rotateAngles, fillingRotateList: wordCloudShapeConfig.fillingRotateAngles, fillingFontFamily: isValid$1(wordCloudShapeConfig.fillingFontFamilyField)
|
|
80780
80740
|
? { field: wordCloudShapeConfig.fillingFontFamilyField }
|
|
80781
80741
|
: (_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)
|
|
80782
80742
|
? { field: wordCloudShapeConfig.fillingFontStyleField }
|
|
@@ -80825,7 +80785,6 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80825
80785
|
return [this._wordMark];
|
|
80826
80786
|
}
|
|
80827
80787
|
reInit() {
|
|
80828
|
-
var _a;
|
|
80829
80788
|
super.reInit();
|
|
80830
80789
|
if (this._keyWordColorCallback) {
|
|
80831
80790
|
this._keyWordColorCallback = null;
|
|
@@ -80833,13 +80792,6 @@ class BaseWordCloudSeries extends BaseSeries {
|
|
|
80833
80792
|
if (this._fillingColorCallback) {
|
|
80834
80793
|
this._fillingColorCallback = null;
|
|
80835
80794
|
}
|
|
80836
|
-
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80837
|
-
}
|
|
80838
|
-
release() {
|
|
80839
|
-
var _a;
|
|
80840
|
-
super.release();
|
|
80841
|
-
(_a = this._wordMeasureCache) === null || _a === void 0 ? void 0 : _a.clear();
|
|
80842
|
-
this._wordMeasureCache = undefined;
|
|
80843
80795
|
}
|
|
80844
80796
|
}
|
|
80845
80797
|
BaseWordCloudSeries.mark = wordCloudSeriesMark;
|
|
@@ -81766,30 +81718,6 @@ var WORDCLOUD_SHAPE_HOOK_EVENT;
|
|
|
81766
81718
|
!function (WORDCLOUD_SHAPE_HOOK_EVENT) {
|
|
81767
81719
|
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";
|
|
81768
81720
|
}(WORDCLOUD_SHAPE_HOOK_EVENT || (WORDCLOUD_SHAPE_HOOK_EVENT = {}));
|
|
81769
|
-
class MapWordMeasureCache {
|
|
81770
|
-
constructor(maxSize = 1e3) {
|
|
81771
|
-
this._map = new Map(), this._maxSize = maxSize;
|
|
81772
|
-
}
|
|
81773
|
-
get(key) {
|
|
81774
|
-
const value = this._map.get(key);
|
|
81775
|
-
if (void 0 !== value) return this._map.delete(key), this._map.set(key, value), value;
|
|
81776
|
-
}
|
|
81777
|
-
set(key, value) {
|
|
81778
|
-
if (this._map.has(key)) this._map.set(key, value);else {
|
|
81779
|
-
if (this._map.size >= this._maxSize) {
|
|
81780
|
-
const firstKey = this._map.keys().next().value;
|
|
81781
|
-
void 0 !== firstKey && this._map.delete(firstKey);
|
|
81782
|
-
}
|
|
81783
|
-
this._map.set(key, value);
|
|
81784
|
-
}
|
|
81785
|
-
}
|
|
81786
|
-
clear() {
|
|
81787
|
-
this._map.clear();
|
|
81788
|
-
}
|
|
81789
|
-
size() {
|
|
81790
|
-
return this._map.size;
|
|
81791
|
-
}
|
|
81792
|
-
}
|
|
81793
81721
|
const colorListEqual = (arr0, arr1) => {
|
|
81794
81722
|
if (1 === arr1.length && "#537EF5" === arr1[0]) return !0;
|
|
81795
81723
|
if (!Array.isArray(arr0) || !Array.isArray(arr1) || arr0.length !== arr1.length) return !1;
|
|
@@ -82029,7 +81957,7 @@ function layout(words, layoutConfig, segmentationOutput) {
|
|
|
82029
81957
|
ratio: ratio
|
|
82030
81958
|
} = region;
|
|
82031
81959
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82032
|
-
measureSprite(canvas, ctx, words, i
|
|
81960
|
+
measureSprite(canvas, ctx, words, i);
|
|
82033
81961
|
const word = regionWords[i];
|
|
82034
81962
|
word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor) && (word.hasPlaced = !0);
|
|
82035
81963
|
}
|
|
@@ -82039,7 +81967,7 @@ function layout(words, layoutConfig, segmentationOutput) {
|
|
|
82039
81967
|
if (0 === failedWords.length) break;
|
|
82040
81968
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82041
81969
|
const word = failedWords[i];
|
|
82042
|
-
measureSprite(canvas, ctx, failedWords, i
|
|
81970
|
+
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);
|
|
82043
81971
|
}
|
|
82044
81972
|
}
|
|
82045
81973
|
layoutConfig.board = board;
|
|
@@ -82085,7 +82013,7 @@ function layoutGlobalShrink(words, layoutConfig, segmentationOutput) {
|
|
|
82085
82013
|
} = region;
|
|
82086
82014
|
let restartTag = !1;
|
|
82087
82015
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82088
|
-
measureSprite(canvas, ctx, words, i
|
|
82016
|
+
measureSprite(canvas, ctx, words, i);
|
|
82089
82017
|
const word = regionWords[i];
|
|
82090
82018
|
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 {
|
|
82091
82019
|
if (!word.skip && word.weight > weightStd && globalShinkFactor > globalShinkLimit) {
|
|
@@ -82110,7 +82038,7 @@ function layoutGlobalShrink(words, layoutConfig, segmentationOutput) {
|
|
|
82110
82038
|
if (0 === failedWords.length) break;
|
|
82111
82039
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82112
82040
|
const word = failedWords[i];
|
|
82113
|
-
measureSprite(canvas, ctx, failedWords, i
|
|
82041
|
+
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);
|
|
82114
82042
|
}
|
|
82115
82043
|
}
|
|
82116
82044
|
layoutConfig.board = board;
|
|
@@ -82155,7 +82083,7 @@ function layoutSelfEnlarge(words, layoutConfig, segmentationOutput) {
|
|
|
82155
82083
|
} = region;
|
|
82156
82084
|
let restartTag = !1;
|
|
82157
82085
|
for (let i = 0; i < regionWords.length; i++) {
|
|
82158
|
-
measureSprite(canvas, ctx, words, i
|
|
82086
|
+
measureSprite(canvas, ctx, words, i);
|
|
82159
82087
|
const word = regionWords[i];
|
|
82160
82088
|
if (word.x = center[0], word.y = center[1], word.hasText && word.sprite && place$1(board, word, maxR, ratio, size, boardSize, stepFactor)) {
|
|
82161
82089
|
if (word.hasPlaced = !0, word.weight >= weightStd && importantWordSuccessedNum++, importantWordSuccessedNum >= importantCount && !layoutFinish) {
|
|
@@ -82181,7 +82109,7 @@ function layoutSelfEnlarge(words, layoutConfig, segmentationOutput) {
|
|
|
82181
82109
|
if (0 === failedWords.length) break;
|
|
82182
82110
|
for (let i = 0; i < failedWords.length; i++) {
|
|
82183
82111
|
const word = failedWords[i];
|
|
82184
|
-
measureSprite(canvas, ctx, failedWords, i
|
|
82112
|
+
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);
|
|
82185
82113
|
}
|
|
82186
82114
|
}
|
|
82187
82115
|
layoutConfig.board = board;
|
|
@@ -82260,13 +82188,8 @@ function archimedeanSpiral(ratio) {
|
|
|
82260
82188
|
return [ratio * (t *= .1) * Math.cos(t), t * Math.sin(t)];
|
|
82261
82189
|
};
|
|
82262
82190
|
}
|
|
82263
|
-
function measureSprite(canvas, ctx, words, wi
|
|
82264
|
-
|
|
82265
|
-
if (targetWord.sprite || 0 === targetWord.fontSize) return;
|
|
82266
|
-
if (cache) {
|
|
82267
|
-
const cached = cache.get(getWordMeasureKey(targetWord));
|
|
82268
|
-
if (cached) return targetWord.sprite = cached.sprite, targetWord.bounds = cached.bounds, targetWord.wordSize = cached.wordSize, void (targetWord.hasText = !0);
|
|
82269
|
-
}
|
|
82191
|
+
function measureSprite(canvas, ctx, words, wi) {
|
|
82192
|
+
if (words[wi].sprite || 0 === words[wi].fontSize) return;
|
|
82270
82193
|
const cw = 2048,
|
|
82271
82194
|
radians = Math.PI / 180,
|
|
82272
82195
|
n = words.length;
|
|
@@ -82329,25 +82252,14 @@ function measureSprite(canvas, ctx, words, wi, cache) {
|
|
|
82329
82252
|
}
|
|
82330
82253
|
seen && (j < dTop && (dTop = j), j > dBottom && (dBottom = j));
|
|
82331
82254
|
}
|
|
82332
|
-
|
|
82255
|
+
word.bounds = {
|
|
82333
82256
|
dTop: (wordSize[1] >> 1) - dTop,
|
|
82334
82257
|
dBottom: dBottom - (wordSize[1] >> 1),
|
|
82335
82258
|
dLeft: (wordSize[0] >> 1) - dLeft,
|
|
82336
82259
|
dRight: dRight - (wordSize[0] >> 1)
|
|
82337
|
-
}, word.sprite = sprite,
|
|
82338
|
-
const key = getWordMeasureKey(word);
|
|
82339
|
-
cache.set(key, {
|
|
82340
|
-
sprite: sprite,
|
|
82341
|
-
bounds: word.bounds,
|
|
82342
|
-
wordSize: wordSize
|
|
82343
|
-
});
|
|
82344
|
-
}
|
|
82345
|
-
delete word.LT;
|
|
82260
|
+
}, word.sprite = sprite, delete word.LT;
|
|
82346
82261
|
}
|
|
82347
82262
|
}
|
|
82348
|
-
function getWordMeasureKey(word) {
|
|
82349
|
-
return String(word.text) + "|" + String(word.fontFamily) + "|" + String(word.fontStyle) + "|" + String(word.fontWeight) + "|" + String(word.fontSize) + "|" + String(word.rotate) + "|" + String(word.padding);
|
|
82350
|
-
}
|
|
82351
82263
|
function initBoardWithShape(segmentationOutput) {
|
|
82352
82264
|
const {
|
|
82353
82265
|
segmentation: {
|
|
@@ -82444,7 +82356,7 @@ function filling(words, layoutConfig, segmentationOutput) {
|
|
|
82444
82356
|
} = shapeBounds,
|
|
82445
82357
|
[startX, startY] = [x1 + ~~(randomGenerator() * fillingXStep * 2), y1 + ~~(randomGenerator() * fillingYStep * 2)];
|
|
82446
82358
|
for (let y = startY; y <= y2; y += fillingYStep) for (let x = startX; x <= x2; x += fillingXStep) {
|
|
82447
|
-
measureSprite(canvas, ctx, fillingWords, wi
|
|
82359
|
+
measureSprite(canvas, ctx, fillingWords, wi);
|
|
82448
82360
|
const word = fillingWords[wi];
|
|
82449
82361
|
word.x = x, word.y = y;
|
|
82450
82362
|
const {
|
|
@@ -82561,7 +82473,7 @@ class Layout {
|
|
|
82561
82473
|
return this.progressiveResult;
|
|
82562
82474
|
}
|
|
82563
82475
|
doLayout() {
|
|
82564
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x
|
|
82476
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
82565
82477
|
const segmentationInput = this.segmentationInput,
|
|
82566
82478
|
segmentationOutput = segmentation(segmentationInput);
|
|
82567
82479
|
if (!segmentationOutput.segmentation.regions.length) return;
|
|
@@ -82588,36 +82500,35 @@ class Layout {
|
|
|
82588
82500
|
const layoutConfig = {
|
|
82589
82501
|
size: options.size,
|
|
82590
82502
|
ratio: options.ratio || .8,
|
|
82591
|
-
measureCache: null !== (_a = options.measureCache) && void 0 !== _a ? _a : new MapWordMeasureCache(),
|
|
82592
82503
|
shapeUrl: options.shape,
|
|
82593
82504
|
random: void 0 === options.random || options.random,
|
|
82594
|
-
textLayoutTimes: null !== (
|
|
82505
|
+
textLayoutTimes: null !== (_a = options.textLayoutTimes) && void 0 !== _a ? _a : 3,
|
|
82595
82506
|
removeWhiteBorder: options.removeWhiteBorder,
|
|
82596
|
-
layoutMode: null !== (
|
|
82597
|
-
fontSizeShrinkFactor: null !== (
|
|
82598
|
-
stepFactor: null !== (
|
|
82599
|
-
importantWordCount: null !== (
|
|
82507
|
+
layoutMode: null !== (_b = options.layoutMode) && void 0 !== _b ? _b : "default",
|
|
82508
|
+
fontSizeShrinkFactor: null !== (_c = options.fontSizeShrinkFactor) && void 0 !== _c ? _c : .8,
|
|
82509
|
+
stepFactor: null !== (_d = options.stepFactor) && void 0 !== _d ? _d : 1,
|
|
82510
|
+
importantWordCount: null !== (_e = options.importantWordCount) && void 0 !== _e ? _e : 10,
|
|
82600
82511
|
globalShinkLimit: options.globalShinkLimit || .2,
|
|
82601
|
-
fontSizeEnlargeFactor: null !== (
|
|
82602
|
-
fillingRatio: null !== (
|
|
82603
|
-
fillingTimes: null !== (
|
|
82604
|
-
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (
|
|
82605
|
-
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (
|
|
82512
|
+
fontSizeEnlargeFactor: null !== (_f = options.fontSizeEnlargeFactor) && void 0 !== _f ? _f : 1.5,
|
|
82513
|
+
fillingRatio: null !== (_g = options.fillingRatio) && void 0 !== _g ? _g : .7,
|
|
82514
|
+
fillingTimes: null !== (_h = options.fillingTimes) && void 0 !== _h ? _h : 4,
|
|
82515
|
+
fillingXStep: options.fillingXRatioStep ? Math.max(Math.floor(options.size[0] * options.fillingXRatioStep), 1) : null !== (_j = options.fillingXStep) && void 0 !== _j ? _j : 4,
|
|
82516
|
+
fillingYStep: options.fillingYRatioStep ? Math.max(Math.floor(options.size[1] * options.fillingYRatioStep), 1) : null !== (_k = options.fillingYStep) && void 0 !== _k ? _k : 4,
|
|
82606
82517
|
fillingInitialFontSize: options.fillingInitialFontSize,
|
|
82607
82518
|
fillingDeltaFontSize: options.fillingDeltaFontSize,
|
|
82608
|
-
fillingInitialOpacity: null !== (
|
|
82609
|
-
fillingDeltaOpacity: null !== (
|
|
82519
|
+
fillingInitialOpacity: null !== (_l = options.fillingInitialOpacity) && void 0 !== _l ? _l : .8,
|
|
82520
|
+
fillingDeltaOpacity: null !== (_m = options.fillingDeltaOpacity) && void 0 !== _m ? _m : .05,
|
|
82610
82521
|
getFillingFontFamily: field(options.fillingFontFamily || "sans-serif"),
|
|
82611
82522
|
getFillingFontStyle: field(options.fillingFontStyle || "normal"),
|
|
82612
82523
|
getFillingFontWeight: field(options.fillingFontWeight || "normal"),
|
|
82613
|
-
getFillingPadding: field(null !== (
|
|
82614
|
-
fillingRotateList: null !== (
|
|
82615
|
-
fillingDeltaFontSizeFactor: null !== (
|
|
82524
|
+
getFillingPadding: field(null !== (_o = options.fillingPadding) && void 0 !== _o ? _o : .4),
|
|
82525
|
+
fillingRotateList: null !== (_p = options.fillingRotateList) && void 0 !== _p ? _p : [0, 90],
|
|
82526
|
+
fillingDeltaFontSizeFactor: null !== (_q = options.fillingDeltaFontSizeFactor) && void 0 !== _q ? _q : .2,
|
|
82616
82527
|
fillingColorList: options.fillingColorList || ["#537EF5"],
|
|
82617
82528
|
sameColorList: !1,
|
|
82618
|
-
minInitFontSize: null !== (
|
|
82619
|
-
minFontSize: null !== (
|
|
82620
|
-
minFillFontSize: null !== (
|
|
82529
|
+
minInitFontSize: null !== (_r = options.minInitFontSize) && void 0 !== _r ? _r : 10,
|
|
82530
|
+
minFontSize: null !== (_s = options.minFontSize) && void 0 !== _s ? _s : 4,
|
|
82531
|
+
minFillFontSize: null !== (_t = options.minFillFontSize) && void 0 !== _t ? _t : 2
|
|
82621
82532
|
},
|
|
82622
82533
|
sameColorList = colorListEqual(wordsConfig.colorList, layoutConfig.fillingColorList);
|
|
82623
82534
|
layoutConfig.sameColorList = sameColorList, initColorScale(data, wordsConfig, layoutConfig, options), initFillingWordsFontSize(data, wordsConfig, layoutConfig, segmentationOutput);
|
|
@@ -82664,8 +82575,8 @@ class Layout {
|
|
|
82664
82575
|
successedWords: successedWords,
|
|
82665
82576
|
failedWords: failedWords
|
|
82666
82577
|
} = cloud(words, layoutConfig, segmentationOutput),
|
|
82667
|
-
textKey = null !== (
|
|
82668
|
-
dataIndexKey = null !== (
|
|
82578
|
+
textKey = null !== (_v = null === (_u = options.text) || void 0 === _u ? void 0 : _u.field) && void 0 !== _v ? _v : "textKey",
|
|
82579
|
+
dataIndexKey = null !== (_w = options.dataIndexKey) && void 0 !== _w ? _w : "defaultDataIndexKey",
|
|
82669
82580
|
as = options.as ? Object.assign(Object.assign({}, OUTPUT), options.as) : OUTPUT;
|
|
82670
82581
|
let w, t;
|
|
82671
82582
|
const modKeywords = [];
|
|
@@ -82680,7 +82591,7 @@ class Layout {
|
|
|
82680
82591
|
successedWords: successedWords,
|
|
82681
82592
|
failedWords: failedWords
|
|
82682
82593
|
});
|
|
82683
|
-
const stage = null === (
|
|
82594
|
+
const stage = null === (_x = this.view.renderer) || void 0 === _x ? void 0 : _x.stage();
|
|
82684
82595
|
stage && stage.hooks.afterRender.tap(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, () => {
|
|
82685
82596
|
this.view.emit(WORDCLOUD_SHAPE_HOOK_EVENT.AFTER_WORDCLOUD_SHAPE_DRAW, {
|
|
82686
82597
|
successedWords: successedWords,
|
|
@@ -98977,7 +98888,7 @@ class Title extends BaseComponent {
|
|
|
98977
98888
|
};
|
|
98978
98889
|
}
|
|
98979
98890
|
_getTitleAttrs() {
|
|
98980
|
-
var _a, _b, _c, _d, _e, _f
|
|
98891
|
+
var _a, _b, _c, _d, _e, _f;
|
|
98981
98892
|
if (this._spec.visible === false) {
|
|
98982
98893
|
return { visible: false };
|
|
98983
98894
|
}
|
|
@@ -98985,10 +98896,26 @@ class Title extends BaseComponent {
|
|
|
98985
98896
|
const titleWidth = calcLayoutNumber(this._spec.width, layoutRect.width, null, layoutRect.width);
|
|
98986
98897
|
const titleMaxWidth = calcLayoutNumber(this._spec.maxWidth, layoutRect.width, null, layoutRect.width);
|
|
98987
98898
|
const maxWidth = Math.max(Math.min(titleWidth, titleMaxWidth, layoutRect.width), 0);
|
|
98988
|
-
const
|
|
98899
|
+
const hasText = isValid$1(this._spec.text) && this._spec.text !== '';
|
|
98900
|
+
const hasSubtext = isValid$1(this._spec.subtext) && this._spec.subtext !== '';
|
|
98901
|
+
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) });
|
|
98902
|
+
if (hasText) {
|
|
98903
|
+
attrs.textStyle.width = maxWidth;
|
|
98904
|
+
}
|
|
98905
|
+
if (hasSubtext) {
|
|
98906
|
+
attrs.subtextStyle.width = maxWidth;
|
|
98907
|
+
}
|
|
98989
98908
|
if (isValid$1(this._spec.width)) {
|
|
98990
|
-
|
|
98991
|
-
|
|
98909
|
+
const clampedWidth = Math.max(Math.min(titleWidth, layoutRect.width), 0);
|
|
98910
|
+
if (hasText) {
|
|
98911
|
+
attrs.textStyle.width = clampedWidth;
|
|
98912
|
+
}
|
|
98913
|
+
else {
|
|
98914
|
+
delete attrs.textStyle.width;
|
|
98915
|
+
}
|
|
98916
|
+
if (hasSubtext) {
|
|
98917
|
+
attrs.subtextStyle.width = clampedWidth;
|
|
98918
|
+
}
|
|
98992
98919
|
}
|
|
98993
98920
|
return attrs;
|
|
98994
98921
|
}
|