@visactor/vchart-extension 2.1.0-alpha.23 → 2.1.0-alpha.24
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 +147 -88
- package/build/index.min.js +2 -2
- package/cjs/charts/axis-3d/linear-axis.js +2 -1
- package/cjs/charts/bar-3d/constant.js +1 -2
- package/cjs/charts/candlestick/candlestick.js +2 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -2
- package/cjs/charts/funnel-3d/chart.js +2 -1
- package/cjs/charts/funnel-3d/series.js +1 -2
- package/cjs/charts/histogram-3d/chart.js +1 -1
- package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/cjs/charts/storyline/layouts/arc.js +57 -48
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +3 -3
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +2 -1
- package/cjs/charts/storyline/layouts/common.js +12 -2
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +3 -2
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +3 -2
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +32 -20
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +3 -2
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +3 -2
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +1 -1
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/charts/axis-3d/linear-axis.js +2 -1
- package/esm/charts/bar-3d/constant.js +1 -2
- package/esm/charts/candlestick/candlestick.js +2 -1
- package/esm/charts/conversion-funnel/interface.js +1 -2
- package/esm/charts/funnel-3d/chart.js +2 -1
- package/esm/charts/funnel-3d/series.js +1 -2
- package/esm/charts/histogram-3d/chart.js +1 -1
- package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/esm/charts/storyline/layouts/arc.js +55 -46
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +4 -4
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +2 -1
- package/esm/charts/storyline/layouts/common.js +8 -1
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +3 -2
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +3 -2
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +30 -18
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.js +3 -2
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +3 -2
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +1 -1
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -6094,7 +6094,7 @@
|
|
|
6094
6094
|
const shouldShowImageBackground = (spec) => { var _a, _b; return (_b = (_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) !== null && _b !== void 0 ? _b : !(isPortrait(spec) || isLandscape(spec)); };
|
|
6095
6095
|
const TITLE_FONT_SCALE_ID = 'storylineTitleFontSize';
|
|
6096
6096
|
const MARKER_FONT_SCALE_ID = 'storylineMarkerFontSize';
|
|
6097
|
-
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
6097
|
+
const clamp$1 = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
6098
6098
|
const getTextWeight = (text) => {
|
|
6099
6099
|
if (!text) {
|
|
6100
6100
|
return 4;
|
|
@@ -6143,7 +6143,7 @@
|
|
|
6143
6143
|
? ((options.boxWidth * BLOCK_TITLE_MAX_LINES) / textWeight) * 0.96
|
|
6144
6144
|
: Number.POSITIVE_INFINITY;
|
|
6145
6145
|
const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
|
|
6146
|
-
return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6146
|
+
return Math.floor(clamp$1(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6147
6147
|
};
|
|
6148
6148
|
const resolveAdaptiveLineHeight = (fontSize, style, fallback, ratio = 1.35) => { var _a; return Number((_a = style === null || style === void 0 ? void 0 : style.lineHeight) !== null && _a !== void 0 ? _a : Math.round((Number.isFinite(fontSize) ? fontSize : fallback) * ratio)); };
|
|
6149
6149
|
const resolveTitleFontSize = (spec, ctx, title, boxWidth, fallback, range = [16, 34]) => {
|
|
@@ -6330,7 +6330,17 @@
|
|
|
6330
6330
|
} }))), links: result.links.map(link => (Object.assign(Object.assign({}, link), { start: { x: link.start.x + startX, y: link.start.y + startY }, end: { x: link.end.x + startX, y: link.end.y + startY }, points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY })) }))) });
|
|
6331
6331
|
};
|
|
6332
6332
|
const buildPlainContent = (contentText) => contentText.join('\n');
|
|
6333
|
-
const
|
|
6333
|
+
const getBlockTitleLineCount = (title, boxWidth, fontSize) => {
|
|
6334
|
+
if (!title) {
|
|
6335
|
+
return 0;
|
|
6336
|
+
}
|
|
6337
|
+
if (!boxWidth || boxWidth <= 0 || !fontSize || fontSize <= 0) {
|
|
6338
|
+
return 1;
|
|
6339
|
+
}
|
|
6340
|
+
const estimatedWidth = getTextWeight(title) * fontSize;
|
|
6341
|
+
return Math.max(1, Math.min(BLOCK_TITLE_MAX_LINES, Math.ceil(estimatedWidth / Math.max(boxWidth * 0.96, 1))));
|
|
6342
|
+
};
|
|
6343
|
+
const getBlockTitleHeight = (lineHeight, title, boxWidth, fontSize) => lineHeight * getBlockTitleLineCount(title, boxWidth, fontSize);
|
|
6334
6344
|
const omitImageLayoutSpec = (imageSpec) => {
|
|
6335
6345
|
if (!imageSpec) {
|
|
6336
6346
|
return {};
|
|
@@ -6524,6 +6534,7 @@
|
|
|
6524
6534
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6525
6535
|
const getTitleFontSize = (ctx) => resolveTitleFontSize(spec, ctx, block.title, getClockTextRect(spec, ctx, index).width, CLOCK_TITLE_FONT_SIZE, [8, 30]);
|
|
6526
6536
|
const getTitleLineHeight = (ctx) => { var _a; return resolveAdaptiveLineHeight(getTitleFontSize(ctx), (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style, CLOCK_TITLE_LINE_HEIGHT, 1.28); };
|
|
6537
|
+
const getTitleHeight = (ctx) => getBlockTitleHeight(getTitleLineHeight(ctx), block.title, getClockTextRect(spec, ctx, index).width, getTitleFontSize(ctx));
|
|
6527
6538
|
const leadPath = (_d, ctx) => {
|
|
6528
6539
|
const { start, end } = getClockLeadLine(spec, ctx, index);
|
|
6529
6540
|
return `M ${start.x.toFixed(2)} ${start.y.toFixed(2)} L ${end.x.toFixed(2)} ${end.y.toFixed(2)}`;
|
|
@@ -6573,7 +6584,7 @@
|
|
|
6573
6584
|
}
|
|
6574
6585
|
},
|
|
6575
6586
|
block.title
|
|
6576
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY -
|
|
6587
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY - getTitleHeight(ctx), text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: (_d, ctx) => getTitleHeight(ctx), heightLimit: (_d, ctx) => getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getTitleFontSize(ctx), lineHeight: (_d, ctx) => getTitleLineHeight(ctx), fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
|
|
6577
6588
|
: null,
|
|
6578
6589
|
contentText.length
|
|
6579
6590
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getClockTextRect(spec, ctx, index).x, y: (_d, ctx) => getClockTextRect(spec, ctx, index).anchorY + 4, width: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, heightLimit: CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES, text: buildPlainContent(contentText), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word' }, (_c = spec.content) === null || _c === void 0 ? void 0 : _c.style) })
|
|
@@ -6625,7 +6636,7 @@
|
|
|
6625
6636
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6626
6637
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBox.width, 18, [8, 28]);
|
|
6627
6638
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, Math.round(18 * 1.35));
|
|
6628
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title);
|
|
6639
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title, textBox.width, titleFontSize);
|
|
6629
6640
|
const contentGap = ((_y = (_x = spec.data) === null || _x === void 0 ? void 0 : _x[index]) === null || _y === void 0 ? void 0 : _y.title) ? 8 : 0;
|
|
6630
6641
|
return {
|
|
6631
6642
|
block: {
|
|
@@ -6634,6 +6645,7 @@
|
|
|
6634
6645
|
},
|
|
6635
6646
|
titleFontSize,
|
|
6636
6647
|
titleLineHeight,
|
|
6648
|
+
titleHeight,
|
|
6637
6649
|
imageBox,
|
|
6638
6650
|
textBox,
|
|
6639
6651
|
contentBox: {
|
|
@@ -6678,7 +6690,7 @@
|
|
|
6678
6690
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
6679
6691
|
: null,
|
|
6680
6692
|
block.title
|
|
6681
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).
|
|
6693
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
6682
6694
|
: null,
|
|
6683
6695
|
contentText.length
|
|
6684
6696
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.x, y: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.y, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, fontSize: 16, lineHeight: 23, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
@@ -6727,25 +6739,27 @@
|
|
|
6727
6739
|
};
|
|
6728
6740
|
|
|
6729
6741
|
const LANDSCAPE_IMAGE_HEIGHT_RATIO = 0.42;
|
|
6730
|
-
const
|
|
6742
|
+
const LANDSCAPE_CONNECTOR_GAP = 8;
|
|
6731
6743
|
const LANDSCAPE_CONNECTOR_ARROW_SIZE = 9;
|
|
6732
6744
|
const LANDSCAPE_CONNECTOR_X_RATIO = 0.2;
|
|
6733
6745
|
const LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12;
|
|
6734
|
-
const LANDSCAPE_CONTENT_LINES = 10;
|
|
6735
6746
|
const LANDSCAPE_TITLE_LINE_HEIGHT = 34;
|
|
6736
6747
|
const LANDSCAPE_CONTENT_LINE_HEIGHT = 23;
|
|
6737
6748
|
const LANDSCAPE_CONTENT_FONT_SIZE = 16;
|
|
6738
6749
|
const LANDSCAPE_TITLE_TO_CONTENT_GAP = 4;
|
|
6750
|
+
const LANDSCAPE_BODY_MARGIN = 8;
|
|
6751
|
+
const LANDSCAPE_IMAGE_BAND_RATIO = 0.28;
|
|
6752
|
+
const LANDSCAPE_IMAGE_BAND_MAX_RATIO = 0.42;
|
|
6739
6753
|
const getLandscapeImageCenter = (spec, ctx, index) => {
|
|
6740
|
-
var _a, _b, _c, _e;
|
|
6741
6754
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
6742
6755
|
if (!lb) {
|
|
6743
6756
|
return null;
|
|
6744
6757
|
}
|
|
6745
|
-
const
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6758
|
+
const m = getLandscapeMetrics(spec, lb.width, lb.height, index, ctx);
|
|
6759
|
+
return {
|
|
6760
|
+
x: lb.x + m.imageBox.x + m.imageBox.width / 2,
|
|
6761
|
+
y: m.bodyOriginY + m.imageBox.y + m.imageBox.height / 2
|
|
6762
|
+
};
|
|
6749
6763
|
};
|
|
6750
6764
|
const buildLandscapeConnectingCurve = (spec) => {
|
|
6751
6765
|
var _a, _b, _c, _e, _f, _g, _h;
|
|
@@ -6806,16 +6820,19 @@
|
|
|
6806
6820
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6807
6821
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_e = (_c = spec.data) === null || _c === void 0 ? void 0 : _c[index]) === null || _e === void 0 ? void 0 : _e.title, blockWidth, 26, [8, 34]);
|
|
6808
6822
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style, LANDSCAPE_TITLE_LINE_HEIGHT);
|
|
6809
|
-
const
|
|
6810
|
-
const
|
|
6811
|
-
const
|
|
6812
|
-
const
|
|
6813
|
-
const
|
|
6814
|
-
const
|
|
6815
|
-
const
|
|
6816
|
-
? Math.max(contentLineHeight * 2, Math.round(canvasHeight / 4))
|
|
6817
|
-
: LANDSCAPE_CONTENT_LINES * contentLineHeight;
|
|
6823
|
+
const contentFontSize = Number((_j = (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.fontSize) !== null && _j !== void 0 ? _j : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6824
|
+
const contentLineHeight = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.lineHeight) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
6825
|
+
const { width: regionWidth } = getRegionGeometry(ctx, spec);
|
|
6826
|
+
const blockCount = Math.max((_p = (_o = spec.data) === null || _o === void 0 ? void 0 : _o.length) !== null && _p !== void 0 ? _p : 1, 1);
|
|
6827
|
+
const textWidth = Math.max(regionWidth / blockCount, 1);
|
|
6828
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q[index]) === null || _r === void 0 ? void 0 : _r.title, textWidth, titleFontSize);
|
|
6829
|
+
const rawImageHeight = Math.max((_t = (_s = spec.image) === null || _s === void 0 ? void 0 : _s.height) !== null && _t !== void 0 ? _t : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
|
|
6818
6830
|
const titleToContentGap = LANDSCAPE_TITLE_TO_CONTENT_GAP;
|
|
6831
|
+
const minTextBandHeight = titleHeight + titleToContentGap + contentLineHeight * 2;
|
|
6832
|
+
const body = getLandscapeBodyGeometry(ctx, spec, rawImageHeight, blockHeight, minTextBandHeight);
|
|
6833
|
+
const imageHeight = body.imageHeight;
|
|
6834
|
+
const textBandHeight = body.textBandHeight;
|
|
6835
|
+
const contentHeight = Math.max(0, textBandHeight - titleHeight - titleToContentGap);
|
|
6819
6836
|
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
6820
6837
|
const textOnTop = index % 2 === 0;
|
|
6821
6838
|
let textBox;
|
|
@@ -6827,13 +6844,11 @@
|
|
|
6827
6844
|
const imageX = 0;
|
|
6828
6845
|
const connectorX = imageX + blockWidth * LANDSCAPE_CONNECTOR_X_RATIO;
|
|
6829
6846
|
const textX = connectorX + LANDSCAPE_TEXT_GAP_FROM_CONNECTOR;
|
|
6830
|
-
const
|
|
6831
|
-
const
|
|
6832
|
-
const textWidth = Math.max(regionWidth / blockCount, 1);
|
|
6847
|
+
const waveOffset = (textOnTop ? -1 : 1) * body.waveAmplitude;
|
|
6848
|
+
const imageY = body.imageBandTop + body.imageBandHeight / 2 + waveOffset - imageHeight / 2;
|
|
6833
6849
|
if (textOnTop) {
|
|
6834
|
-
const
|
|
6835
|
-
const
|
|
6836
|
-
const connectorY1 = imageY;
|
|
6850
|
+
const textY = body.upperTextTop;
|
|
6851
|
+
const connectorY1 = Math.max(imageY - LANDSCAPE_CONNECTOR_GAP, body.upperTextTop);
|
|
6837
6852
|
const connectorY2 = textY + Math.max(titleHeight, titleLineHeight) / 2;
|
|
6838
6853
|
imageBox = { x: imageX, y: imageY, width: blockWidth, height: imageHeight };
|
|
6839
6854
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
@@ -6844,13 +6859,12 @@
|
|
|
6844
6859
|
height: contentHeight
|
|
6845
6860
|
};
|
|
6846
6861
|
connector = { x1: connectorX, y1: connectorY1, x2: connectorX, y2: connectorY2 };
|
|
6847
|
-
groupTop =
|
|
6848
|
-
groupHeight =
|
|
6862
|
+
groupTop = 0;
|
|
6863
|
+
groupHeight = body.height;
|
|
6849
6864
|
}
|
|
6850
6865
|
else {
|
|
6851
|
-
const
|
|
6852
|
-
const
|
|
6853
|
-
const connectorY1 = imageY + imageHeight;
|
|
6866
|
+
const textY = body.lowerTextTop;
|
|
6867
|
+
const connectorY1 = Math.min(imageY + imageHeight + LANDSCAPE_CONNECTOR_GAP, body.height);
|
|
6854
6868
|
const connectorY2 = textY + textHeight;
|
|
6855
6869
|
imageBox = { x: imageX, y: imageY, width: blockWidth, height: imageHeight };
|
|
6856
6870
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
@@ -6861,16 +6875,19 @@
|
|
|
6861
6875
|
height: contentHeight
|
|
6862
6876
|
};
|
|
6863
6877
|
connector = { x1: connectorX, y1: connectorY1, x2: connectorX, y2: connectorY2 };
|
|
6864
|
-
groupTop =
|
|
6865
|
-
groupHeight =
|
|
6878
|
+
groupTop = 0;
|
|
6879
|
+
groupHeight = body.height;
|
|
6866
6880
|
}
|
|
6867
6881
|
return {
|
|
6868
6882
|
padding,
|
|
6869
6883
|
titleFontSize,
|
|
6870
6884
|
titleLineHeight,
|
|
6885
|
+
titleHeight,
|
|
6871
6886
|
contentFontSize,
|
|
6872
6887
|
contentLineHeight,
|
|
6873
6888
|
contentHeight,
|
|
6889
|
+
minTextBandHeight,
|
|
6890
|
+
bodyOriginY: body.originY,
|
|
6874
6891
|
blockWidth: Math.max(blockWidth, textX + textWidth),
|
|
6875
6892
|
imageBox,
|
|
6876
6893
|
textBox,
|
|
@@ -6881,6 +6898,28 @@
|
|
|
6881
6898
|
groupHeight
|
|
6882
6899
|
};
|
|
6883
6900
|
};
|
|
6901
|
+
const getLandscapeBodyGeometry = (ctx, spec, rawImageHeight, blockHeight, minTextBandHeight) => {
|
|
6902
|
+
const region = getRegionGeometry(ctx, spec);
|
|
6903
|
+
const margin = Math.min(LANDSCAPE_BODY_MARGIN, Math.max(region.height * 0.04, 0));
|
|
6904
|
+
const height = Math.max(region.height - margin * 2, 1);
|
|
6905
|
+
const textBandReserve = Math.min(minTextBandHeight, Math.max((height - 48) / 2, 0));
|
|
6906
|
+
const maxImageBandHeight = Math.max(height - textBandReserve * 2, height * 0.18);
|
|
6907
|
+
const imageBandHeight = Math.min(Math.max(rawImageHeight + 24, height * LANDSCAPE_IMAGE_BAND_RATIO), Math.max(1, Math.min(maxImageBandHeight, height * LANDSCAPE_IMAGE_BAND_MAX_RATIO)));
|
|
6908
|
+
const imageHeight = Math.min(rawImageHeight, Math.max(imageBandHeight - 16, 1));
|
|
6909
|
+
const textBandHeight = Math.max((height - imageBandHeight) / 2, 1);
|
|
6910
|
+
const imageBandTop = textBandHeight;
|
|
6911
|
+
return {
|
|
6912
|
+
originY: region.startY + margin,
|
|
6913
|
+
height,
|
|
6914
|
+
textBandHeight,
|
|
6915
|
+
imageBandTop,
|
|
6916
|
+
imageBandHeight,
|
|
6917
|
+
imageHeight,
|
|
6918
|
+
upperTextTop: 0,
|
|
6919
|
+
lowerTextTop: imageBandTop + imageBandHeight,
|
|
6920
|
+
waveAmplitude: Math.min(imageBandHeight * 0.18, blockHeight * 0.1)
|
|
6921
|
+
};
|
|
6922
|
+
};
|
|
6884
6923
|
const buildLandscapeBlockMark = (spec, block, index) => {
|
|
6885
6924
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6886
6925
|
const hasImage = !!block.image;
|
|
@@ -6910,13 +6949,8 @@
|
|
|
6910
6949
|
return (_a = lb === null || lb === void 0 ? void 0 : lb.x) !== null && _a !== void 0 ? _a : 0;
|
|
6911
6950
|
},
|
|
6912
6951
|
y: (_d, ctx) => {
|
|
6913
|
-
var _a, _b, _c, _e, _f, _g, _h;
|
|
6914
|
-
const lb = getLayout(spec, ctx).blocks[index];
|
|
6915
6952
|
const m = getMetrics(ctx);
|
|
6916
|
-
|
|
6917
|
-
const blockH = (_h = (_f = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _f !== void 0 ? _f : (_g = spec.block) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_BLOCK_HEIGHT;
|
|
6918
|
-
const stagger = m.textOnTop ? blockH * 0.1 : -blockH * 0.1;
|
|
6919
|
-
return cy - m.imageBox.height / 2 + stagger;
|
|
6953
|
+
return m.bodyOriginY;
|
|
6920
6954
|
},
|
|
6921
6955
|
width: (_d, ctx) => getMetrics(ctx).blockWidth,
|
|
6922
6956
|
height: (_d, ctx) => getMetrics(ctx).groupHeight
|
|
@@ -6957,7 +6991,7 @@
|
|
|
6957
6991
|
}
|
|
6958
6992
|
},
|
|
6959
6993
|
block.title
|
|
6960
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).
|
|
6994
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).titleHeight, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6961
6995
|
: null,
|
|
6962
6996
|
contentText.length
|
|
6963
6997
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
@@ -7072,7 +7106,7 @@
|
|
|
7072
7106
|
const imageHeight = (_l = (_k = spec.image) === null || _k === void 0 ? void 0 : _k.height) !== null && _l !== void 0 ? _l : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
|
|
7073
7107
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_o = (_m = spec.data) === null || _m === void 0 ? void 0 : _m[index]) === null || _o === void 0 ? void 0 : _o.title, imageWidth, 26, [8, 34]);
|
|
7074
7108
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_p = spec.title) === null || _p === void 0 ? void 0 : _p.style, PORTRAIT_TITLE_LINE_HEIGHT);
|
|
7075
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q[index]) === null || _r === void 0 ? void 0 : _r.title);
|
|
7109
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_r = (_q = spec.data) === null || _q === void 0 ? void 0 : _q[index]) === null || _r === void 0 ? void 0 : _r.title, imageWidth, titleFontSize);
|
|
7076
7110
|
const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
|
|
7077
7111
|
const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
|
|
7078
7112
|
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
@@ -7107,6 +7141,7 @@
|
|
|
7107
7141
|
onLeft,
|
|
7108
7142
|
titleFontSize,
|
|
7109
7143
|
titleLineHeight,
|
|
7144
|
+
titleHeight,
|
|
7110
7145
|
contentFontSize,
|
|
7111
7146
|
contentLineHeight,
|
|
7112
7147
|
blockWidth,
|
|
@@ -7199,7 +7234,7 @@
|
|
|
7199
7234
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_e = spec.image) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7200
7235
|
: null,
|
|
7201
7236
|
block.title
|
|
7202
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).
|
|
7237
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textBox.x, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).titleHeight, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7203
7238
|
: null,
|
|
7204
7239
|
contentText.length
|
|
7205
7240
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).contentBox.x, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
@@ -7219,12 +7254,15 @@
|
|
|
7219
7254
|
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7220
7255
|
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7221
7256
|
const ARC_TEXT_PADDING = 20;
|
|
7222
|
-
const ARC_TEXT_BOX_MIN_WIDTH =
|
|
7257
|
+
const ARC_TEXT_BOX_MIN_WIDTH = 96;
|
|
7258
|
+
const ARC_TEXT_BOX_ABSOLUTE_MIN_WIDTH = 64;
|
|
7259
|
+
const ARC_TEXT_BOX_MAX_WIDTH = 260;
|
|
7223
7260
|
const ARC_TITLE_IMAGE_WIDTH_RATIO = 0.68;
|
|
7224
7261
|
const ARC_TITLE_IMAGE_MAX_WIDTH = 900;
|
|
7225
7262
|
const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
|
|
7226
7263
|
const ARC_GAP_FROM_TITLE_IMAGE = 200;
|
|
7227
7264
|
const ARC_FIT_MARGIN = 8;
|
|
7265
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
7228
7266
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7229
7267
|
const getArcTitleImageRect = (spec, ctx) => {
|
|
7230
7268
|
var _a, _b, _c, _e;
|
|
@@ -7277,8 +7315,8 @@
|
|
|
7277
7315
|
centerBottom
|
|
7278
7316
|
};
|
|
7279
7317
|
};
|
|
7280
|
-
const getArcBlockCenterByGeometry = (spec, arc, index) => {
|
|
7281
|
-
var _a, _b
|
|
7318
|
+
const getArcBlockCenterByGeometry = (spec, arc, index, ctx) => {
|
|
7319
|
+
var _a, _b;
|
|
7282
7320
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7283
7321
|
if (count <= 0) {
|
|
7284
7322
|
return { x: arc.cx, y: arc.cy };
|
|
@@ -7292,13 +7330,13 @@
|
|
|
7292
7330
|
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7293
7331
|
const nx = nxRaw / nLen;
|
|
7294
7332
|
const ny = nyRaw / nLen;
|
|
7295
|
-
const imageHeight = (
|
|
7333
|
+
const imageHeight = getArcBlockMetrics(spec, index, ctx).imageBox.height;
|
|
7296
7334
|
const offset = imageHeight / 2;
|
|
7297
7335
|
return { x: px + nx * offset, y: py + ny * offset };
|
|
7298
7336
|
};
|
|
7299
|
-
const getArcBlockBounds = (spec, arc, index) => {
|
|
7300
|
-
const center = getArcBlockCenterByGeometry(spec, arc, index);
|
|
7301
|
-
const metrics = getArcBlockMetrics(spec, index);
|
|
7337
|
+
const getArcBlockBounds = (spec, arc, index, ctx) => {
|
|
7338
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index, ctx);
|
|
7339
|
+
const metrics = getArcBlockMetrics(spec, index, ctx);
|
|
7302
7340
|
const halo = shouldShowImageBackground(spec) ? ARC_BLOCK_IMAGE_HALO_PADDING + ARC_BLOCK_IMAGE_BORDER : 0;
|
|
7303
7341
|
const minX = Math.min(metrics.imageBox.x - halo, metrics.textBox.x, metrics.contentBox.x);
|
|
7304
7342
|
const maxX = Math.max(metrics.imageBox.x + metrics.imageBox.width + halo, metrics.textBox.x + metrics.textBox.width, metrics.contentBox.x + metrics.contentBox.width);
|
|
@@ -7311,13 +7349,13 @@
|
|
|
7311
7349
|
bottom: center.y + maxY
|
|
7312
7350
|
};
|
|
7313
7351
|
};
|
|
7314
|
-
const getArcBlocksBounds = (spec, arc) => {
|
|
7352
|
+
const getArcBlocksBounds = (spec, arc, ctx) => {
|
|
7315
7353
|
var _a, _b;
|
|
7316
7354
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7317
7355
|
if (!count) {
|
|
7318
7356
|
return { left: arc.cx, right: arc.cx, top: arc.cy, bottom: arc.cy };
|
|
7319
7357
|
}
|
|
7320
|
-
return Array.from({ length: count }, (_, index) => getArcBlockBounds(spec, arc, index)).reduce((bounds, blockBounds) => ({
|
|
7358
|
+
return Array.from({ length: count }, (_, index) => getArcBlockBounds(spec, arc, index, ctx)).reduce((bounds, blockBounds) => ({
|
|
7321
7359
|
left: Math.min(bounds.left, blockBounds.left),
|
|
7322
7360
|
right: Math.max(bounds.right, blockBounds.right),
|
|
7323
7361
|
top: Math.min(bounds.top, blockBounds.top),
|
|
@@ -7332,7 +7370,7 @@
|
|
|
7332
7370
|
const getArcGeometry = (spec, ctx) => {
|
|
7333
7371
|
const arc = getBaseArcGeometry(spec, ctx);
|
|
7334
7372
|
const region = getRegionGeometry(ctx);
|
|
7335
|
-
const bounds = getArcBlocksBounds(spec, arc);
|
|
7373
|
+
const bounds = getArcBlocksBounds(spec, arc, ctx);
|
|
7336
7374
|
const fit = {
|
|
7337
7375
|
left: region.startX + ARC_FIT_MARGIN,
|
|
7338
7376
|
right: region.startX + region.width - ARC_FIT_MARGIN,
|
|
@@ -7365,7 +7403,7 @@
|
|
|
7365
7403
|
}
|
|
7366
7404
|
return shiftX || shiftY ? Object.assign(Object.assign({}, arc), { cx: arc.cx + shiftX, cy: arc.cy + shiftY }) : arc;
|
|
7367
7405
|
};
|
|
7368
|
-
const getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index);
|
|
7406
|
+
const getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index, ctx);
|
|
7369
7407
|
const buildArcMark = (spec) => {
|
|
7370
7408
|
var _a;
|
|
7371
7409
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
@@ -7428,23 +7466,32 @@
|
|
|
7428
7466
|
]
|
|
7429
7467
|
};
|
|
7430
7468
|
};
|
|
7431
|
-
const getArcBlockMetrics = (spec, index = 0) => {
|
|
7469
|
+
const getArcBlockMetrics = (spec, index = 0, ctx) => {
|
|
7432
7470
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
7433
|
-
const
|
|
7434
|
-
const
|
|
7471
|
+
const region = ctx ? getRegionGeometry(ctx, spec) : undefined;
|
|
7472
|
+
const count = Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0, 1);
|
|
7473
|
+
const regionWidth = Math.max((_c = region === null || region === void 0 ? void 0 : region.width) !== null && _c !== void 0 ? _c : Number((_e = spec.width) !== null && _e !== void 0 ? _e : ARC_BLOCK_IMAGE_SIZE * count), 1);
|
|
7474
|
+
const regionHeight = Math.max((_f = region === null || region === void 0 ? void 0 : region.height) !== null && _f !== void 0 ? _f : Number((_g = spec.height) !== null && _g !== void 0 ? _g : ARC_TEXT_BOX_HEIGHT), 1);
|
|
7475
|
+
const slotWidth = regionWidth / (count + 1);
|
|
7476
|
+
const imageScale = clamp(Math.min(regionWidth / Math.max(count * ARC_BLOCK_IMAGE_SIZE * 0.92, 1), regionHeight / 620), 0.42, 1);
|
|
7477
|
+
const textScale = clamp(Math.min(slotWidth / 180, imageScale), 0.48, 1);
|
|
7478
|
+
const styleContent = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style;
|
|
7479
|
+
const contentFontSize = Number((_j = styleContent === null || styleContent === void 0 ? void 0 : styleContent.fontSize) !== null && _j !== void 0 ? _j : Math.round(ARC_CONTENT_FONT_SIZE * textScale));
|
|
7480
|
+
const contentLineHeight = Number((_k = styleContent === null || styleContent === void 0 ? void 0 : styleContent.lineHeight) !== null && _k !== void 0 ? _k : Math.round(Math.max(contentFontSize * 1.35, ARC_CONTENT_LINE_HEIGHT * textScale)));
|
|
7435
7481
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7436
|
-
const
|
|
7482
|
+
const configuredImageDiameter = Math.max((_m = (_l = spec.image) === null || _l === void 0 ? void 0 : _l.width) !== null && _m !== void 0 ? _m : ARC_BLOCK_IMAGE_SIZE, (_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.height) !== null && _p !== void 0 ? _p : ARC_BLOCK_IMAGE_SIZE);
|
|
7483
|
+
const imageDiameter = Math.round(clamp(configuredImageDiameter * imageScale, 64, configuredImageDiameter));
|
|
7437
7484
|
const imageWidth = imageDiameter;
|
|
7438
7485
|
const imageHeight = imageDiameter;
|
|
7439
7486
|
const isDown = isDownArc(spec);
|
|
7440
|
-
const
|
|
7441
|
-
const
|
|
7442
|
-
const
|
|
7443
|
-
const textBoxWidth = Math.
|
|
7444
|
-
const titleFontSize = resolveTitleFontSize(spec,
|
|
7487
|
+
const configuredTextWidth = Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : ARC_TEXT_BOX_MAX_WIDTH);
|
|
7488
|
+
const defaultTextWidth = Math.round(slotWidth * 0.96);
|
|
7489
|
+
const minTextWidth = Math.min(ARC_TEXT_BOX_MIN_WIDTH, Math.max(Math.round(slotWidth * 0.72), ARC_TEXT_BOX_ABSOLUTE_MIN_WIDTH));
|
|
7490
|
+
const textBoxWidth = Math.round(clamp(Math.min(configuredTextWidth, defaultTextWidth), minTextWidth, ARC_TEXT_BOX_MAX_WIDTH));
|
|
7491
|
+
const titleFontSize = resolveTitleFontSize(spec, ctx, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, Math.round(ARC_TITLE_FONT_SIZE * textScale), [10, 40]);
|
|
7445
7492
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, ARC_TITLE_LINE_HEIGHT);
|
|
7446
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title);
|
|
7447
|
-
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7493
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title, textBoxWidth, titleFontSize);
|
|
7494
|
+
const textHeight = Math.round(clamp(ARC_TEXT_BOX_HEIGHT * textScale, 88, ARC_TEXT_BOX_HEIGHT));
|
|
7448
7495
|
const contentHeight = Math.max(textHeight - titleHeight - titleToContentGap, contentLineHeight);
|
|
7449
7496
|
const isLeftSide = index < count / 2;
|
|
7450
7497
|
const textAlign = isLeftSide ? 'right' : 'left';
|
|
@@ -7454,7 +7501,9 @@
|
|
|
7454
7501
|
width: imageWidth,
|
|
7455
7502
|
height: imageHeight
|
|
7456
7503
|
};
|
|
7457
|
-
const
|
|
7504
|
+
const textPadding = Math.round(ARC_TEXT_PADDING * textScale);
|
|
7505
|
+
const textBoxX = isLeftSide ? -textPadding - textBoxWidth : textPadding;
|
|
7506
|
+
const textAnchorX = isLeftSide ? -textPadding : textPadding;
|
|
7458
7507
|
const textBox = {
|
|
7459
7508
|
x: textBoxX,
|
|
7460
7509
|
y: isDown ? imageBox.y + imageHeight + ARC_TEXT_GAP_FROM_IMAGE : imageBox.y - ARC_TEXT_GAP_FROM_IMAGE - textHeight,
|
|
@@ -7476,7 +7525,8 @@
|
|
|
7476
7525
|
textBox,
|
|
7477
7526
|
contentBox,
|
|
7478
7527
|
isDown,
|
|
7479
|
-
textAlign
|
|
7528
|
+
textAlign,
|
|
7529
|
+
textAnchorX
|
|
7480
7530
|
};
|
|
7481
7531
|
};
|
|
7482
7532
|
const buildArcBlockMark = (spec, block, index) => {
|
|
@@ -7484,12 +7534,18 @@
|
|
|
7484
7534
|
const hasImage = !!block.image;
|
|
7485
7535
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7486
7536
|
const themeColor = getThemeColor(spec);
|
|
7487
|
-
const
|
|
7488
|
-
const
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7537
|
+
const getMetrics = (ctx) => getArcBlockMetrics(spec, index, ctx);
|
|
7538
|
+
const getConnectorBox = (ctx) => {
|
|
7539
|
+
const metrics = getMetrics(ctx);
|
|
7540
|
+
return {
|
|
7541
|
+
x: -1,
|
|
7542
|
+
y: metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y,
|
|
7543
|
+
width: 2,
|
|
7544
|
+
height: metrics.isDown
|
|
7545
|
+
? Math.max(metrics.textBox.y + metrics.textBox.height - (metrics.imageBox.y + metrics.imageBox.height), 0)
|
|
7546
|
+
: Math.max(metrics.imageBox.y - metrics.textBox.y, 0)
|
|
7547
|
+
};
|
|
7548
|
+
};
|
|
7493
7549
|
return {
|
|
7494
7550
|
type: 'group',
|
|
7495
7551
|
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
@@ -7506,22 +7562,22 @@
|
|
|
7506
7562
|
interactive: false,
|
|
7507
7563
|
zIndex: vchart.LayoutZIndex.Mark + 2,
|
|
7508
7564
|
style: {
|
|
7509
|
-
x:
|
|
7510
|
-
y:
|
|
7511
|
-
width:
|
|
7512
|
-
height:
|
|
7565
|
+
x: (_d, ctx) => getConnectorBox(ctx).x,
|
|
7566
|
+
y: (_d, ctx) => getConnectorBox(ctx).y,
|
|
7567
|
+
width: (_d, ctx) => getConnectorBox(ctx).width,
|
|
7568
|
+
height: (_d, ctx) => getConnectorBox(ctx).height,
|
|
7513
7569
|
fill: themeColor,
|
|
7514
7570
|
fillOpacity: 0.6
|
|
7515
7571
|
}
|
|
7516
7572
|
},
|
|
7517
7573
|
hasImage
|
|
7518
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x:
|
|
7574
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).imageBox.x, y: (_d, ctx) => getMetrics(ctx).imageBox.y, width: (_d, ctx) => getMetrics(ctx).imageBox.width, height: (_d, ctx) => getMetrics(ctx).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'contain', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7519
7575
|
: {
|
|
7520
7576
|
type: 'symbol',
|
|
7521
7577
|
name: `storyline-block-image-bg-${index}`,
|
|
7522
7578
|
interactive: false,
|
|
7523
7579
|
zIndex: vchart.LayoutZIndex.Mark + 3,
|
|
7524
|
-
style: Object.assign({ x: 0, y: 0, size: Math.min(
|
|
7580
|
+
style: Object.assign({ x: 0, y: 0, size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height), symbolType: 'circle' }, getImageBackgroundStyle(spec))
|
|
7525
7581
|
},
|
|
7526
7582
|
shouldShowImageBackground(spec)
|
|
7527
7583
|
? {
|
|
@@ -7532,7 +7588,8 @@
|
|
|
7532
7588
|
style: {
|
|
7533
7589
|
x: 0,
|
|
7534
7590
|
y: 0,
|
|
7535
|
-
size: Math.min(
|
|
7591
|
+
size: (_d, ctx) => Math.min(getMetrics(ctx).imageBox.width, getMetrics(ctx).imageBox.height) +
|
|
7592
|
+
ARC_BLOCK_IMAGE_HALO_PADDING * 2,
|
|
7536
7593
|
symbolType: 'circle',
|
|
7537
7594
|
fill: 'transparent',
|
|
7538
7595
|
stroke: withAlpha(themeColor, 0.82),
|
|
@@ -7541,10 +7598,10 @@
|
|
|
7541
7598
|
}
|
|
7542
7599
|
: null,
|
|
7543
7600
|
block.title
|
|
7544
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x:
|
|
7601
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textAnchorX, y: (_d, ctx) => getMetrics(ctx).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width, height: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: (_d, ctx) => getMetrics(ctx).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getMetrics(ctx).titleFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getMetrics(ctx).textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7545
7602
|
: null,
|
|
7546
7603
|
contentText.length
|
|
7547
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), { style: Object.assign({ x:
|
|
7604
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), { style: Object.assign({ x: (_d, ctx) => getMetrics(ctx).textAnchorX, y: (_d, ctx) => getMetrics(ctx).contentBox.y, width: (_d, ctx) => getMetrics(ctx).contentBox.width, height: (_d, ctx) => getMetrics(ctx).contentBox.height, maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width, heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getMetrics(ctx).contentFontSize, lineHeight: (_d, ctx) => getMetrics(ctx).contentLineHeight, textAlign: (_d, ctx) => getMetrics(ctx).textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7548
7605
|
: null
|
|
7549
7606
|
].filter(Boolean)
|
|
7550
7607
|
};
|
|
@@ -7700,7 +7757,7 @@
|
|
|
7700
7757
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
7701
7758
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b.title, WING_TEXT_BOX_WIDTH, WING_TITLE_FONT_SIZE, [8, 30]);
|
|
7702
7759
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style, WING_TITLE_LINE_HEIGHT, 1.3);
|
|
7703
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f.title);
|
|
7760
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_f = (_e = spec.data) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f.title, WING_TEXT_BOX_WIDTH, titleFontSize);
|
|
7704
7761
|
const contentFontSize = Number((_j = (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.fontSize) !== null && _j !== void 0 ? _j : WING_CONTENT_FONT_SIZE);
|
|
7705
7762
|
const contentLineHeight = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.lineHeight) !== null && _m !== void 0 ? _m : WING_CONTENT_LINE_HEIGHT);
|
|
7706
7763
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
@@ -7770,6 +7827,7 @@
|
|
|
7770
7827
|
verticalAlign,
|
|
7771
7828
|
titleFontSize,
|
|
7772
7829
|
titleLineHeight,
|
|
7830
|
+
titleHeight,
|
|
7773
7831
|
contentFontSize,
|
|
7774
7832
|
contentLineHeight,
|
|
7775
7833
|
imageBox,
|
|
@@ -7831,7 +7889,7 @@
|
|
|
7831
7889
|
return m.textBox.x + m.textBox.width / 2;
|
|
7832
7890
|
}
|
|
7833
7891
|
return m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7834
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).
|
|
7892
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => {
|
|
7835
7893
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7836
7894
|
if (m.verticalAlign) {
|
|
7837
7895
|
return 'center';
|
|
@@ -7978,12 +8036,13 @@
|
|
|
7978
8036
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7979
8037
|
const titleFontSize = resolveTitleFontSize(spec, ctx, (_s = (_r = spec.data) === null || _r === void 0 ? void 0 : _r[index]) === null || _s === void 0 ? void 0 : _s.title, textBox.width, LADDER_TITLE_FONT_SIZE, [8, 34]);
|
|
7980
8038
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_t = spec.title) === null || _t === void 0 ? void 0 : _t.style, LADDER_TITLE_LINE_HEIGHT, LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE);
|
|
7981
|
-
const titleHeight = getBlockTitleHeight(titleLineHeight, (_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title);
|
|
8039
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title, textBox.width, titleFontSize);
|
|
7982
8040
|
const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
|
|
7983
8041
|
return {
|
|
7984
8042
|
block: { width: blockWidth, height: blockHeight },
|
|
7985
8043
|
titleFontSize,
|
|
7986
8044
|
titleLineHeight,
|
|
8045
|
+
titleHeight,
|
|
7987
8046
|
imageBox,
|
|
7988
8047
|
textBox,
|
|
7989
8048
|
contentBox: {
|
|
@@ -8036,7 +8095,7 @@
|
|
|
8036
8095
|
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).imageBox.height, image: block.image }, (_f = spec.image) === null || _f === void 0 ? void 0 : _f.style) })
|
|
8037
8096
|
: null,
|
|
8038
8097
|
block.title
|
|
8039
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).
|
|
8098
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, spec.title), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleHeight, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
|
|
8040
8099
|
: null,
|
|
8041
8100
|
contentText.length
|
|
8042
8101
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { style: Object.assign(Object.assign({ x: (_d, ctx) => getTitleX(ctx), y: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, fontSize: LADDER_CONTENT_FONT_SIZE, lineHeight: LADDER_CONTENT_LINE_HEIGHT, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
|
|
@@ -8136,7 +8195,7 @@
|
|
|
8136
8195
|
: wing
|
|
8137
8196
|
? 300
|
|
8138
8197
|
: arcUp
|
|
8139
|
-
?
|
|
8198
|
+
? 100
|
|
8140
8199
|
: arcDown
|
|
8141
8200
|
? TEXT_RESERVE
|
|
8142
8201
|
: LARGE;
|