@visactor/vchart-extension 2.1.0-alpha.22 → 2.1.0-alpha.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/index.js +143 -103
- package/build/index.min.js +1 -1
- package/cjs/charts/axis-3d/index.js +2 -1
- package/cjs/charts/axis-3d/linear-axis.js +1 -2
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -1
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +1 -2
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -2
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/funnel-3d/series.js +1 -1
- package/cjs/charts/funnel-3d/theme.js +1 -1
- package/cjs/charts/histogram-3d/chart.js +1 -1
- package/cjs/charts/storyline/layouts/arc.js +61 -17
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +16 -8
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +3 -15
- package/cjs/charts/storyline/layouts/common.js +9 -21
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +14 -8
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +15 -9
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +21 -15
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.d.ts +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +21 -16
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +15 -8
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +1 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +2 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +2 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/axis-3d/index.js +2 -1
- package/esm/charts/axis-3d/linear-axis.js +1 -2
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -1
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +1 -2
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -2
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/funnel-3d/series.js +1 -1
- package/esm/charts/funnel-3d/theme.js +1 -1
- package/esm/charts/histogram-3d/chart.js +1 -1
- package/esm/charts/storyline/layouts/arc.js +59 -17
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +17 -9
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +3 -15
- package/esm/charts/storyline/layouts/common.js +6 -18
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +14 -9
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +15 -10
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +20 -16
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.d.ts +1 -1
- package/esm/charts/storyline/layouts/portrait.js +20 -16
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +15 -9
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +1 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +2 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +2 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -6078,6 +6078,7 @@
|
|
|
6078
6078
|
const DEFAULT_IMAGE_HEIGHT = 48;
|
|
6079
6079
|
const DEFAULT_IMAGE_GAP = 10;
|
|
6080
6080
|
const DEFAULT_THEME_COLOR = '#e8543d';
|
|
6081
|
+
const BLOCK_TITLE_MAX_LINES = 2;
|
|
6081
6082
|
const DEFAULT_TITLE_IMAGE_WIDTH_RATIO = 0.52;
|
|
6082
6083
|
const DEFAULT_TITLE_IMAGE_MAX_WIDTH = 720;
|
|
6083
6084
|
const DEFAULT_TITLE_IMAGE_HEIGHT_RATIO = 0.36;
|
|
@@ -6138,7 +6139,9 @@
|
|
|
6138
6139
|
const canvasSize = Math.sqrt(width * height) * options.canvasRatio;
|
|
6139
6140
|
const lengthFactor = Math.sqrt(8 / Math.max(textWeight, 4));
|
|
6140
6141
|
const adaptiveSize = width <= 1 && height <= 1 ? options.fallback : canvasSize * lengthFactor;
|
|
6141
|
-
const boxWidthLimit = options.boxWidth && options.boxWidth > 0
|
|
6142
|
+
const boxWidthLimit = options.boxWidth && options.boxWidth > 0
|
|
6143
|
+
? ((options.boxWidth * BLOCK_TITLE_MAX_LINES) / textWeight) * 0.96
|
|
6144
|
+
: Number.POSITIVE_INFINITY;
|
|
6142
6145
|
const boxHeightLimit = options.boxHeight && options.boxHeight > 0 ? options.boxHeight / Math.max(textWeight, 1) : Number.POSITIVE_INFINITY;
|
|
6143
6146
|
return Math.floor(clamp(Math.min(adaptiveSize, boxWidthLimit, boxHeightLimit), minFontSize, maxFontSize));
|
|
6144
6147
|
};
|
|
@@ -6326,27 +6329,8 @@
|
|
|
6326
6329
|
y: block.center.y + startY
|
|
6327
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 })) }))) });
|
|
6328
6331
|
};
|
|
6329
|
-
const
|
|
6330
|
-
|
|
6331
|
-
const fontSize = Number((_e = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _e !== void 0 ? _e : 18);
|
|
6332
|
-
const lineHeight = Number((_j = (_f = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _f !== void 0 ? _f : (_h = (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : 26);
|
|
6333
|
-
const fill = (_o = (_k = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _k !== void 0 ? _k : (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.fill) !== null && _o !== void 0 ? _o : '#596173';
|
|
6334
|
-
const align = (_p = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _p !== void 0 ? _p : 'left';
|
|
6335
|
-
return {
|
|
6336
|
-
type: 'rich',
|
|
6337
|
-
text: contentText.reduce((result, paragraph, index) => {
|
|
6338
|
-
const suffix = index === contentText.length - 1 ? '' : '\n';
|
|
6339
|
-
result.push({
|
|
6340
|
-
text: `${paragraph}${suffix}`,
|
|
6341
|
-
fontSize,
|
|
6342
|
-
lineHeight,
|
|
6343
|
-
fill,
|
|
6344
|
-
align
|
|
6345
|
-
});
|
|
6346
|
-
return result;
|
|
6347
|
-
}, [])
|
|
6348
|
-
};
|
|
6349
|
-
};
|
|
6332
|
+
const buildPlainContent = (contentText) => contentText.join('\n');
|
|
6333
|
+
const getBlockTitleHeight = (lineHeight, title) => title ? lineHeight * BLOCK_TITLE_MAX_LINES : 0;
|
|
6350
6334
|
const omitImageLayoutSpec = (imageSpec) => {
|
|
6351
6335
|
if (!imageSpec) {
|
|
6352
6336
|
return {};
|
|
@@ -6444,8 +6428,9 @@
|
|
|
6444
6428
|
const CLOCK_ORBIT_DASH = [4, 4];
|
|
6445
6429
|
const CLOCK_TITLE_FONT_SIZE = 22;
|
|
6446
6430
|
const CLOCK_TITLE_LINE_HEIGHT = 28;
|
|
6447
|
-
const CLOCK_CONTENT_FONT_SIZE =
|
|
6448
|
-
const CLOCK_CONTENT_LINE_HEIGHT =
|
|
6431
|
+
const CLOCK_CONTENT_FONT_SIZE = 14;
|
|
6432
|
+
const CLOCK_CONTENT_LINE_HEIGHT = 20;
|
|
6433
|
+
const CLOCK_CONTENT_LINES = 4;
|
|
6449
6434
|
const getClockGeometry = (spec, ctx) => {
|
|
6450
6435
|
var _a, _b, _c;
|
|
6451
6436
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
@@ -6455,7 +6440,7 @@
|
|
|
6455
6440
|
const cx = startX + padding.left + innerWidth / 2;
|
|
6456
6441
|
const cy = startY + padding.top + innerHeight / 2;
|
|
6457
6442
|
const textReserveX = CLOCK_TEXT_MAX_WIDTH;
|
|
6458
|
-
const textReserveY = 4 + CLOCK_CONTENT_LINE_HEIGHT *
|
|
6443
|
+
const textReserveY = 4 + CLOCK_CONTENT_LINE_HEIGHT * CLOCK_CONTENT_LINES;
|
|
6459
6444
|
const rMaxX = (innerWidth / 2 - textReserveX) / CLOCK_TEXT_INNER_RATIO;
|
|
6460
6445
|
const rMaxY = (innerHeight / 2 - textReserveY) / CLOCK_TEXT_INNER_RATIO;
|
|
6461
6446
|
const R = Math.max(Math.min(rMaxX, rMaxY), 1);
|
|
@@ -6588,10 +6573,10 @@
|
|
|
6588
6573
|
}
|
|
6589
6574
|
},
|
|
6590
6575
|
block.title
|
|
6591
|
-
? 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 - getTitleLineHeight(ctx), text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, 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' }, (_b = spec.title) === null || _b === void 0 ? void 0 : _b.style) })
|
|
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 - getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, height: (_d, ctx) => getTitleLineHeight(ctx) * BLOCK_TITLE_MAX_LINES, 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) })
|
|
6592
6577
|
: null,
|
|
6593
6578
|
contentText.length
|
|
6594
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), {
|
|
6579
|
+
? 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) })
|
|
6595
6580
|
: null
|
|
6596
6581
|
];
|
|
6597
6582
|
return {
|
|
@@ -6640,7 +6625,7 @@
|
|
|
6640
6625
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
6641
6626
|
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]);
|
|
6642
6627
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_u = spec.title) === null || _u === void 0 ? void 0 : _u.style, Math.round(18 * 1.35));
|
|
6643
|
-
const titleHeight = ((_w = (_v = spec.data) === null || _v === void 0 ? void 0 : _v[index]) === null || _w === void 0 ? void 0 : _w.title)
|
|
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);
|
|
6644
6629
|
const contentGap = ((_y = (_x = spec.data) === null || _x === void 0 ? void 0 : _x[index]) === null || _y === void 0 ? void 0 : _y.title) ? 8 : 0;
|
|
6645
6630
|
return {
|
|
6646
6631
|
block: {
|
|
@@ -6693,14 +6678,10 @@
|
|
|
6693
6678
|
? 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) })
|
|
6694
6679
|
: null,
|
|
6695
6680
|
block.title
|
|
6696
|
-
? 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, 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' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
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).titleLineHeight * BLOCK_TITLE_MAX_LINES, 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) })
|
|
6697
6682
|
: null,
|
|
6698
6683
|
contentText.length
|
|
6699
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
6700
|
-
fontSize: 18,
|
|
6701
|
-
lineHeight: 26,
|
|
6702
|
-
fill: '#596173'
|
|
6703
|
-
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
6684
|
+
? 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) })
|
|
6704
6685
|
: null
|
|
6705
6686
|
].filter(Boolean)
|
|
6706
6687
|
};
|
|
@@ -6752,8 +6733,8 @@
|
|
|
6752
6733
|
const LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12;
|
|
6753
6734
|
const LANDSCAPE_CONTENT_LINES = 10;
|
|
6754
6735
|
const LANDSCAPE_TITLE_LINE_HEIGHT = 34;
|
|
6755
|
-
const LANDSCAPE_CONTENT_LINE_HEIGHT =
|
|
6756
|
-
const LANDSCAPE_CONTENT_FONT_SIZE =
|
|
6736
|
+
const LANDSCAPE_CONTENT_LINE_HEIGHT = 23;
|
|
6737
|
+
const LANDSCAPE_CONTENT_FONT_SIZE = 16;
|
|
6757
6738
|
const LANDSCAPE_TITLE_TO_CONTENT_GAP = 4;
|
|
6758
6739
|
const getLandscapeImageCenter = (spec, ctx, index) => {
|
|
6759
6740
|
var _a, _b, _c, _e;
|
|
@@ -6821,20 +6802,21 @@
|
|
|
6821
6802
|
};
|
|
6822
6803
|
};
|
|
6823
6804
|
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
6824
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
6805
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6825
6806
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6826
6807
|
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]);
|
|
6827
6808
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style, LANDSCAPE_TITLE_LINE_HEIGHT);
|
|
6828
|
-
const
|
|
6829
|
-
const
|
|
6830
|
-
const
|
|
6809
|
+
const titleHeight = getBlockTitleHeight(titleLineHeight, (_h = (_g = spec.data) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h.title);
|
|
6810
|
+
const contentFontSize = Number((_l = (_k = (_j = spec.content) === null || _j === void 0 ? void 0 : _j.style) === null || _k === void 0 ? void 0 : _k.fontSize) !== null && _l !== void 0 ? _l : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6811
|
+
const contentLineHeight = Number((_p = (_o = (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) === null || _o === void 0 ? void 0 : _o.lineHeight) !== null && _p !== void 0 ? _p : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
6812
|
+
const imageHeight = Math.max((_r = (_q = spec.image) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
|
|
6831
6813
|
const connectorGap = LANDSCAPE_DETACHED_GAP;
|
|
6832
6814
|
const canvasHeight = spec.height;
|
|
6833
6815
|
const contentHeight = canvasHeight
|
|
6834
6816
|
? Math.max(contentLineHeight * 2, Math.round(canvasHeight / 4))
|
|
6835
6817
|
: LANDSCAPE_CONTENT_LINES * contentLineHeight;
|
|
6836
6818
|
const titleToContentGap = LANDSCAPE_TITLE_TO_CONTENT_GAP;
|
|
6837
|
-
const textHeight =
|
|
6819
|
+
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
6838
6820
|
const textOnTop = index % 2 === 0;
|
|
6839
6821
|
let textBox;
|
|
6840
6822
|
let contentBox;
|
|
@@ -6845,17 +6827,19 @@
|
|
|
6845
6827
|
const imageX = 0;
|
|
6846
6828
|
const connectorX = imageX + blockWidth * LANDSCAPE_CONNECTOR_X_RATIO;
|
|
6847
6829
|
const textX = connectorX + LANDSCAPE_TEXT_GAP_FROM_CONNECTOR;
|
|
6848
|
-
const
|
|
6830
|
+
const { width: regionWidth } = getRegionGeometry(ctx, spec);
|
|
6831
|
+
const blockCount = Math.max((_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 1, 1);
|
|
6832
|
+
const textWidth = Math.max(regionWidth / blockCount, 1);
|
|
6849
6833
|
if (textOnTop) {
|
|
6850
6834
|
const imageY = 0;
|
|
6851
6835
|
const textY = imageY - connectorGap - textHeight;
|
|
6852
6836
|
const connectorY1 = imageY;
|
|
6853
|
-
const connectorY2 = textY + titleLineHeight / 2;
|
|
6837
|
+
const connectorY2 = textY + Math.max(titleHeight, titleLineHeight) / 2;
|
|
6854
6838
|
imageBox = { x: imageX, y: imageY, width: blockWidth, height: imageHeight };
|
|
6855
6839
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
6856
6840
|
contentBox = {
|
|
6857
6841
|
x: textX,
|
|
6858
|
-
y: textY +
|
|
6842
|
+
y: textY + titleHeight + titleToContentGap,
|
|
6859
6843
|
width: textWidth,
|
|
6860
6844
|
height: contentHeight
|
|
6861
6845
|
};
|
|
@@ -6872,7 +6856,7 @@
|
|
|
6872
6856
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
6873
6857
|
contentBox = {
|
|
6874
6858
|
x: textX,
|
|
6875
|
-
y: textY +
|
|
6859
|
+
y: textY + titleHeight + titleToContentGap,
|
|
6876
6860
|
width: textWidth,
|
|
6877
6861
|
height: contentHeight
|
|
6878
6862
|
};
|
|
@@ -6887,7 +6871,7 @@
|
|
|
6887
6871
|
contentFontSize,
|
|
6888
6872
|
contentLineHeight,
|
|
6889
6873
|
contentHeight,
|
|
6890
|
-
blockWidth,
|
|
6874
|
+
blockWidth: Math.max(blockWidth, textX + textWidth),
|
|
6891
6875
|
imageBox,
|
|
6892
6876
|
textBox,
|
|
6893
6877
|
contentBox,
|
|
@@ -6973,14 +6957,10 @@
|
|
|
6973
6957
|
}
|
|
6974
6958
|
},
|
|
6975
6959
|
block.title
|
|
6976
|
-
? 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, 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' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
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).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: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6977
6961
|
: null,
|
|
6978
6962
|
contentText.length
|
|
6979
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
6980
|
-
fontSize: LANDSCAPE_CONTENT_FONT_SIZE,
|
|
6981
|
-
lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT,
|
|
6982
|
-
fill: '#596173'
|
|
6983
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
6963
|
+
? 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) })
|
|
6984
6964
|
: null
|
|
6985
6965
|
].filter(Boolean)
|
|
6986
6966
|
};
|
|
@@ -6988,8 +6968,8 @@
|
|
|
6988
6968
|
|
|
6989
6969
|
const PORTRAIT_AXIS_WIDTH = 96;
|
|
6990
6970
|
const PORTRAIT_AXIS_PADDING = 120;
|
|
6991
|
-
const PORTRAIT_MARKER_FONT_SIZE =
|
|
6992
|
-
const PORTRAIT_MARKER_LINE_HEIGHT =
|
|
6971
|
+
const PORTRAIT_MARKER_FONT_SIZE = 34;
|
|
6972
|
+
const PORTRAIT_MARKER_LINE_HEIGHT = 24;
|
|
6993
6973
|
const PORTRAIT_MARKER_AXIS_PADDING = 6;
|
|
6994
6974
|
const PORTRAIT_IMAGE_HEIGHT_RATIO = 0.6;
|
|
6995
6975
|
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1.25;
|
|
@@ -7000,8 +6980,8 @@
|
|
|
7000
6980
|
const PORTRAIT_TEXT_GAP_FROM_IMAGE = 8;
|
|
7001
6981
|
const PORTRAIT_CONTENT_LINES = 3;
|
|
7002
6982
|
const PORTRAIT_TITLE_LINE_HEIGHT = 34;
|
|
7003
|
-
const PORTRAIT_CONTENT_LINE_HEIGHT =
|
|
7004
|
-
const PORTRAIT_CONTENT_FONT_SIZE =
|
|
6983
|
+
const PORTRAIT_CONTENT_LINE_HEIGHT = 23;
|
|
6984
|
+
const PORTRAIT_CONTENT_FONT_SIZE = 16;
|
|
7005
6985
|
const PORTRAIT_TITLE_TO_CONTENT_GAP = 4;
|
|
7006
6986
|
const buildPortraitAxisMark = (spec) => {
|
|
7007
6987
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k;
|
|
@@ -7043,7 +7023,7 @@
|
|
|
7043
7023
|
}, text: (_d, ctx) => {
|
|
7044
7024
|
var _a, _b, _c;
|
|
7045
7025
|
const axis = getPortraitAxisRect(spec, ctx);
|
|
7046
|
-
const markerFontSize = resolveMarkerFontSize(spec, ctx, block.marker, axis.height / Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1, 1), PORTRAIT_MARKER_FONT_SIZE);
|
|
7026
|
+
const markerFontSize = resolveMarkerFontSize(spec, ctx, block.marker, axis.height / Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 1, 1), PORTRAIT_MARKER_FONT_SIZE, [16, 38]);
|
|
7047
7027
|
const markerLineHeight = resolveAdaptiveLineHeight(markerFontSize, (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style, PORTRAIT_MARKER_LINE_HEIGHT, 0.9);
|
|
7048
7028
|
return {
|
|
7049
7029
|
type: 'rich',
|
|
@@ -7084,7 +7064,7 @@
|
|
|
7084
7064
|
};
|
|
7085
7065
|
};
|
|
7086
7066
|
const getPortraitMetrics = (spec, blockWidth, blockHeight, index, ctx) => {
|
|
7087
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
7067
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7088
7068
|
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : PORTRAIT_CONTENT_FONT_SIZE);
|
|
7089
7069
|
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : PORTRAIT_CONTENT_LINE_HEIGHT);
|
|
7090
7070
|
const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
|
|
@@ -7092,9 +7072,10 @@
|
|
|
7092
7072
|
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);
|
|
7093
7073
|
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]);
|
|
7094
7074
|
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);
|
|
7095
7076
|
const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
|
|
7096
7077
|
const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
|
|
7097
|
-
const textHeight =
|
|
7078
|
+
const textHeight = titleHeight + titleToContentGap + contentHeight;
|
|
7098
7079
|
const onLeft = index % 2 === 0;
|
|
7099
7080
|
const axisHalf = PORTRAIT_AXIS_WIDTH / 2;
|
|
7100
7081
|
const imageX = onLeft
|
|
@@ -7106,7 +7087,7 @@
|
|
|
7106
7087
|
const textWidth = imageWidth;
|
|
7107
7088
|
const contentBox = {
|
|
7108
7089
|
x: textX,
|
|
7109
|
-
y: textY +
|
|
7090
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7110
7091
|
width: textWidth,
|
|
7111
7092
|
height: contentHeight
|
|
7112
7093
|
};
|
|
@@ -7218,14 +7199,10 @@
|
|
|
7218
7199
|
? 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) })
|
|
7219
7200
|
: null,
|
|
7220
7201
|
block.title
|
|
7221
|
-
? 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, 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' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
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).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: 'left', textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_f = spec.title) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7222
7203
|
: null,
|
|
7223
7204
|
contentText.length
|
|
7224
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
7225
|
-
fontSize: PORTRAIT_CONTENT_FONT_SIZE,
|
|
7226
|
-
lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
|
|
7227
|
-
fill: '#596173'
|
|
7228
|
-
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_g = spec.content) === null || _g === void 0 ? void 0 : _g.style) })
|
|
7205
|
+
? 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) })
|
|
7229
7206
|
: null
|
|
7230
7207
|
].filter(Boolean)
|
|
7231
7208
|
};
|
|
@@ -7237,8 +7214,8 @@
|
|
|
7237
7214
|
const ARC_TEXT_GAP_FROM_IMAGE = 10;
|
|
7238
7215
|
const ARC_TITLE_FONT_SIZE = 32;
|
|
7239
7216
|
const ARC_TITLE_LINE_HEIGHT = 34;
|
|
7240
|
-
const ARC_CONTENT_LINE_HEIGHT =
|
|
7241
|
-
const ARC_CONTENT_FONT_SIZE =
|
|
7217
|
+
const ARC_CONTENT_LINE_HEIGHT = 24;
|
|
7218
|
+
const ARC_CONTENT_FONT_SIZE = 18;
|
|
7242
7219
|
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7243
7220
|
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7244
7221
|
const ARC_TEXT_PADDING = 20;
|
|
@@ -7247,6 +7224,7 @@
|
|
|
7247
7224
|
const ARC_TITLE_IMAGE_MAX_WIDTH = 900;
|
|
7248
7225
|
const ARC_TITLE_IMAGE_HEIGHT_RATIO = 0.34;
|
|
7249
7226
|
const ARC_GAP_FROM_TITLE_IMAGE = 200;
|
|
7227
|
+
const ARC_FIT_MARGIN = 8;
|
|
7250
7228
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7251
7229
|
const getArcTitleImageRect = (spec, ctx) => {
|
|
7252
7230
|
var _a, _b, _c, _e;
|
|
@@ -7261,7 +7239,7 @@
|
|
|
7261
7239
|
const top = isDown ? startY : startY + innerHeight - h;
|
|
7262
7240
|
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7263
7241
|
};
|
|
7264
|
-
const
|
|
7242
|
+
const getBaseArcGeometry = (spec, ctx) => {
|
|
7265
7243
|
var _a, _b, _c;
|
|
7266
7244
|
const { width, startX } = getRegionGeometry(ctx);
|
|
7267
7245
|
const innerWidth = Math.max(width, 1);
|
|
@@ -7299,9 +7277,8 @@
|
|
|
7299
7277
|
centerBottom
|
|
7300
7278
|
};
|
|
7301
7279
|
};
|
|
7302
|
-
const
|
|
7280
|
+
const getArcBlockCenterByGeometry = (spec, arc, index) => {
|
|
7303
7281
|
var _a, _b, _c, _e;
|
|
7304
|
-
const arc = getArcGeometry(spec, ctx);
|
|
7305
7282
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7306
7283
|
if (count <= 0) {
|
|
7307
7284
|
return { x: arc.cx, y: arc.cy };
|
|
@@ -7319,6 +7296,76 @@
|
|
|
7319
7296
|
const offset = imageHeight / 2;
|
|
7320
7297
|
return { x: px + nx * offset, y: py + ny * offset };
|
|
7321
7298
|
};
|
|
7299
|
+
const getArcBlockBounds = (spec, arc, index) => {
|
|
7300
|
+
const center = getArcBlockCenterByGeometry(spec, arc, index);
|
|
7301
|
+
const metrics = getArcBlockMetrics(spec, index);
|
|
7302
|
+
const halo = shouldShowImageBackground(spec) ? ARC_BLOCK_IMAGE_HALO_PADDING + ARC_BLOCK_IMAGE_BORDER : 0;
|
|
7303
|
+
const minX = Math.min(metrics.imageBox.x - halo, metrics.textBox.x, metrics.contentBox.x);
|
|
7304
|
+
const maxX = Math.max(metrics.imageBox.x + metrics.imageBox.width + halo, metrics.textBox.x + metrics.textBox.width, metrics.contentBox.x + metrics.contentBox.width);
|
|
7305
|
+
const minY = Math.min(metrics.imageBox.y - halo, metrics.textBox.y, metrics.contentBox.y);
|
|
7306
|
+
const maxY = Math.max(metrics.imageBox.y + metrics.imageBox.height + halo, metrics.textBox.y + metrics.textBox.height, metrics.contentBox.y + metrics.contentBox.height);
|
|
7307
|
+
return {
|
|
7308
|
+
left: center.x + minX,
|
|
7309
|
+
right: center.x + maxX,
|
|
7310
|
+
top: center.y + minY,
|
|
7311
|
+
bottom: center.y + maxY
|
|
7312
|
+
};
|
|
7313
|
+
};
|
|
7314
|
+
const getArcBlocksBounds = (spec, arc) => {
|
|
7315
|
+
var _a, _b;
|
|
7316
|
+
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7317
|
+
if (!count) {
|
|
7318
|
+
return { left: arc.cx, right: arc.cx, top: arc.cy, bottom: arc.cy };
|
|
7319
|
+
}
|
|
7320
|
+
return Array.from({ length: count }, (_, index) => getArcBlockBounds(spec, arc, index)).reduce((bounds, blockBounds) => ({
|
|
7321
|
+
left: Math.min(bounds.left, blockBounds.left),
|
|
7322
|
+
right: Math.max(bounds.right, blockBounds.right),
|
|
7323
|
+
top: Math.min(bounds.top, blockBounds.top),
|
|
7324
|
+
bottom: Math.max(bounds.bottom, blockBounds.bottom)
|
|
7325
|
+
}), {
|
|
7326
|
+
left: Number.POSITIVE_INFINITY,
|
|
7327
|
+
right: Number.NEGATIVE_INFINITY,
|
|
7328
|
+
top: Number.POSITIVE_INFINITY,
|
|
7329
|
+
bottom: Number.NEGATIVE_INFINITY
|
|
7330
|
+
});
|
|
7331
|
+
};
|
|
7332
|
+
const getArcGeometry = (spec, ctx) => {
|
|
7333
|
+
const arc = getBaseArcGeometry(spec, ctx);
|
|
7334
|
+
const region = getRegionGeometry(ctx);
|
|
7335
|
+
const bounds = getArcBlocksBounds(spec, arc);
|
|
7336
|
+
const fit = {
|
|
7337
|
+
left: region.startX + ARC_FIT_MARGIN,
|
|
7338
|
+
right: region.startX + region.width - ARC_FIT_MARGIN,
|
|
7339
|
+
top: region.startY + ARC_FIT_MARGIN,
|
|
7340
|
+
bottom: region.startY + region.height - ARC_FIT_MARGIN
|
|
7341
|
+
};
|
|
7342
|
+
let shiftX = 0;
|
|
7343
|
+
let shiftY = 0;
|
|
7344
|
+
const boundsWidth = bounds.right - bounds.left;
|
|
7345
|
+
const boundsHeight = bounds.bottom - bounds.top;
|
|
7346
|
+
const fitWidth = fit.right - fit.left;
|
|
7347
|
+
const fitHeight = fit.bottom - fit.top;
|
|
7348
|
+
if (boundsWidth > fitWidth) {
|
|
7349
|
+
shiftX = (fit.left + fit.right - bounds.left - bounds.right) / 2;
|
|
7350
|
+
}
|
|
7351
|
+
else if (bounds.left < fit.left) {
|
|
7352
|
+
shiftX = fit.left - bounds.left;
|
|
7353
|
+
}
|
|
7354
|
+
else if (bounds.right > fit.right) {
|
|
7355
|
+
shiftX = fit.right - bounds.right;
|
|
7356
|
+
}
|
|
7357
|
+
if (boundsHeight > fitHeight) {
|
|
7358
|
+
shiftY = (fit.top + fit.bottom - bounds.top - bounds.bottom) / 2;
|
|
7359
|
+
}
|
|
7360
|
+
else if (bounds.top < fit.top) {
|
|
7361
|
+
shiftY = fit.top - bounds.top;
|
|
7362
|
+
}
|
|
7363
|
+
else if (bounds.bottom > fit.bottom) {
|
|
7364
|
+
shiftY = fit.bottom - bounds.bottom;
|
|
7365
|
+
}
|
|
7366
|
+
return shiftX || shiftY ? Object.assign(Object.assign({}, arc), { cx: arc.cx + shiftX, cy: arc.cy + shiftY }) : arc;
|
|
7367
|
+
};
|
|
7368
|
+
const getArcBlockCenter = (spec, ctx, index) => getArcBlockCenterByGeometry(spec, getArcGeometry(spec, ctx), index);
|
|
7322
7369
|
const buildArcMark = (spec) => {
|
|
7323
7370
|
var _a;
|
|
7324
7371
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
@@ -7382,7 +7429,7 @@
|
|
|
7382
7429
|
};
|
|
7383
7430
|
};
|
|
7384
7431
|
const getArcBlockMetrics = (spec, index = 0) => {
|
|
7385
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
7432
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
7386
7433
|
const contentFontSize = Number((_c = (_b = (_a = spec.content) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : ARC_CONTENT_FONT_SIZE);
|
|
7387
7434
|
const contentLineHeight = Number((_g = (_f = (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : ARC_CONTENT_LINE_HEIGHT);
|
|
7388
7435
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
@@ -7396,8 +7443,9 @@
|
|
|
7396
7443
|
const textBoxWidth = Math.max(Number((_r = (_q = spec.block) === null || _q === void 0 ? void 0 : _q.width) !== null && _r !== void 0 ? _r : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
|
|
7397
7444
|
const titleFontSize = resolveTitleFontSize(spec, undefined, (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s[index]) === null || _t === void 0 ? void 0 : _t.title, textBoxWidth, ARC_TITLE_FONT_SIZE, [8, 40]);
|
|
7398
7445
|
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);
|
|
7399
7447
|
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7400
|
-
const contentHeight = Math.max(textHeight -
|
|
7448
|
+
const contentHeight = Math.max(textHeight - titleHeight - titleToContentGap, contentLineHeight);
|
|
7401
7449
|
const isLeftSide = index < count / 2;
|
|
7402
7450
|
const textAlign = isLeftSide ? 'right' : 'left';
|
|
7403
7451
|
const imageBox = {
|
|
@@ -7415,7 +7463,7 @@
|
|
|
7415
7463
|
};
|
|
7416
7464
|
const contentBox = {
|
|
7417
7465
|
x: textBox.x,
|
|
7418
|
-
y: textBox.y +
|
|
7466
|
+
y: textBox.y + titleHeight + titleToContentGap,
|
|
7419
7467
|
width: textBox.width,
|
|
7420
7468
|
height: contentHeight
|
|
7421
7469
|
};
|
|
@@ -7493,15 +7541,10 @@
|
|
|
7493
7541
|
}
|
|
7494
7542
|
: null,
|
|
7495
7543
|
block.title
|
|
7496
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
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: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, height: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES, heightLimit: metrics.titleLineHeight * BLOCK_TITLE_MAX_LINES, lineClamp: BLOCK_TITLE_MAX_LINES, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7497
7545
|
: null,
|
|
7498
7546
|
contentText.length
|
|
7499
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, spec.content), {
|
|
7500
|
-
fontSize: metrics.contentFontSize,
|
|
7501
|
-
lineHeight: metrics.contentLineHeight,
|
|
7502
|
-
fill: '#596173',
|
|
7503
|
-
align: metrics.textAlign
|
|
7504
|
-
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
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: metrics.contentBox.x, y: metrics.contentBox.y, width: metrics.contentBox.width, height: metrics.contentBox.height, maxLineWidth: metrics.contentBox.width, heightLimit: metrics.contentBox.height, text: buildPlainContent(contentText), fontSize: metrics.contentFontSize, lineHeight: metrics.contentLineHeight, textAlign: metrics.textAlign, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7505
7548
|
: null
|
|
7506
7549
|
].filter(Boolean)
|
|
7507
7550
|
};
|
|
@@ -7654,16 +7697,17 @@
|
|
|
7654
7697
|
};
|
|
7655
7698
|
const WING_TEXT_IMAGE_GAP = 120;
|
|
7656
7699
|
const getWingBlockMetrics = (spec, ctx, index) => {
|
|
7657
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
7700
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
7658
7701
|
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]);
|
|
7659
7702
|
const titleLineHeight = resolveAdaptiveLineHeight(titleFontSize, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style, WING_TITLE_LINE_HEIGHT, 1.3);
|
|
7660
|
-
const
|
|
7661
|
-
const
|
|
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);
|
|
7704
|
+
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
|
+
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);
|
|
7662
7706
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7663
7707
|
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7664
7708
|
const contentHeight = 100000;
|
|
7665
|
-
const imageWidth = Number((
|
|
7666
|
-
const imageHeight = Number((
|
|
7709
|
+
const imageWidth = Number((_p = (_o = spec.image) === null || _o === void 0 ? void 0 : _o.width) !== null && _p !== void 0 ? _p : WING_BLOCK_IMAGE_SIZE);
|
|
7710
|
+
const imageHeight = Number((_r = (_q = spec.image) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : WING_BLOCK_IMAGE_SIZE);
|
|
7667
7711
|
const imageBox = {
|
|
7668
7712
|
x: -imageWidth / 2,
|
|
7669
7713
|
y: -imageHeight / 2,
|
|
@@ -7671,7 +7715,7 @@
|
|
|
7671
7715
|
height: imageHeight
|
|
7672
7716
|
};
|
|
7673
7717
|
const direction = getWingDirection(spec);
|
|
7674
|
-
const count = (
|
|
7718
|
+
const count = (_t = (_s = spec.data) === null || _s === void 0 ? void 0 : _s.length) !== null && _t !== void 0 ? _t : 0;
|
|
7675
7719
|
const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
|
|
7676
7720
|
const isVerticalLayout = isSpecialBelow;
|
|
7677
7721
|
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
@@ -7686,7 +7730,7 @@
|
|
|
7686
7730
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7687
7731
|
contentBox = {
|
|
7688
7732
|
x: textX,
|
|
7689
|
-
y: textY +
|
|
7733
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7690
7734
|
width: textWidth,
|
|
7691
7735
|
height: contentHeight
|
|
7692
7736
|
};
|
|
@@ -7706,7 +7750,7 @@
|
|
|
7706
7750
|
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7707
7751
|
contentBox = {
|
|
7708
7752
|
x: textX,
|
|
7709
|
-
y: textY +
|
|
7753
|
+
y: textY + titleHeight + titleToContentGap,
|
|
7710
7754
|
width: textWidth,
|
|
7711
7755
|
height: contentHeight
|
|
7712
7756
|
};
|
|
@@ -7787,28 +7831,28 @@
|
|
|
7787
7831
|
return m.textBox.x + m.textBox.width / 2;
|
|
7788
7832
|
}
|
|
7789
7833
|
return m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7790
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, 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) => {
|
|
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).titleLineHeight * BLOCK_TITLE_MAX_LINES, 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) => {
|
|
7791
7835
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7792
7836
|
if (m.verticalAlign) {
|
|
7793
7837
|
return 'center';
|
|
7794
7838
|
}
|
|
7795
7839
|
return m.onLeft ? 'right' : 'left';
|
|
7796
|
-
}, textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7840
|
+
}, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7797
7841
|
: null,
|
|
7798
7842
|
contentText.length
|
|
7799
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), {
|
|
7843
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), { style: Object.assign({ x: (_d, ctx) => {
|
|
7800
7844
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7801
7845
|
if (m.verticalAlign) {
|
|
7802
7846
|
return m.contentBox.x + m.contentBox.width / 2;
|
|
7803
7847
|
}
|
|
7804
7848
|
return m.onLeft ? m.contentBox.x + m.contentBox.width : m.contentBox.x;
|
|
7805
|
-
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, text:
|
|
7849
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, text: buildPlainContent(contentText), fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentLineHeight, textAlign: (_d, ctx) => {
|
|
7806
7850
|
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7807
7851
|
if (m.verticalAlign) {
|
|
7808
7852
|
return 'center';
|
|
7809
7853
|
}
|
|
7810
7854
|
return m.onLeft ? 'right' : 'left';
|
|
7811
|
-
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7855
|
+
}, textBaseline: 'top', whiteSpace: 'normal', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7812
7856
|
: null
|
|
7813
7857
|
].filter(Boolean)
|
|
7814
7858
|
};
|
|
@@ -7822,8 +7866,8 @@
|
|
|
7822
7866
|
const LADDER_BLOCK_IMAGE_SIZE = 100;
|
|
7823
7867
|
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7824
7868
|
const LADDER_TITLE_LINE_HEIGHT = 26;
|
|
7825
|
-
const LADDER_CONTENT_FONT_SIZE =
|
|
7826
|
-
const LADDER_CONTENT_LINE_HEIGHT =
|
|
7869
|
+
const LADDER_CONTENT_FONT_SIZE = 16;
|
|
7870
|
+
const LADDER_CONTENT_LINE_HEIGHT = 23;
|
|
7827
7871
|
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7828
7872
|
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7829
7873
|
var _a;
|
|
@@ -7934,7 +7978,7 @@
|
|
|
7934
7978
|
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7935
7979
|
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]);
|
|
7936
7980
|
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);
|
|
7937
|
-
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title)
|
|
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);
|
|
7938
7982
|
const contentGap = ((_x = (_w = spec.data) === null || _w === void 0 ? void 0 : _w[index]) === null || _x === void 0 ? void 0 : _x.title) ? 8 : 0;
|
|
7939
7983
|
return {
|
|
7940
7984
|
block: { width: blockWidth, height: blockHeight },
|
|
@@ -7992,14 +8036,10 @@
|
|
|
7992
8036
|
? 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) })
|
|
7993
8037
|
: null,
|
|
7994
8038
|
block.title
|
|
7995
|
-
? 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, 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' }, (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style), { textAlign: align }) })
|
|
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).titleLineHeight * BLOCK_TITLE_MAX_LINES, 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 }) })
|
|
7996
8040
|
: null,
|
|
7997
8041
|
contentText.length
|
|
7998
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), {
|
|
7999
|
-
fontSize: LADDER_CONTENT_FONT_SIZE,
|
|
8000
|
-
lineHeight: LADDER_CONTENT_LINE_HEIGHT,
|
|
8001
|
-
align: align
|
|
8002
|
-
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style), { textAlign: align }) })
|
|
8042
|
+
? 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 }) })
|
|
8003
8043
|
: null
|
|
8004
8044
|
].filter(Boolean)
|
|
8005
8045
|
};
|