@visactor/vchart-extension 2.1.0-alpha.16 → 2.1.0-alpha.17
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 +401 -469
- package/build/index.min.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -2
- package/cjs/charts/candlestick/candlestick.js +2 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +0 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- 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 +2 -1
- package/cjs/charts/histogram-3d/index.js +1 -1
- package/cjs/charts/histogram-3d/interface.js +1 -1
- package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/cjs/charts/image-cloud/image-cloud.js +1 -1
- package/cjs/charts/image-cloud/index.js +1 -1
- package/cjs/charts/image-cloud/interface.js +1 -1
- package/cjs/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/cjs/charts/storyline/interface.d.ts +8 -2
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layout.js +19 -25
- package/cjs/charts/storyline/layout.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.d.ts +5 -0
- package/cjs/charts/storyline/layouts/{dome.js → arc.js} +56 -61
- package/cjs/charts/storyline/layouts/arc.js.map +1 -0
- package/cjs/charts/storyline/layouts/clock.js +8 -9
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +3 -2
- package/cjs/charts/storyline/layouts/common.js +7 -7
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +6 -4
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.d.ts +5 -0
- package/cjs/charts/storyline/layouts/ladder.js +205 -0
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -0
- package/cjs/charts/storyline/layouts/landscape.js +5 -3
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.js +16 -42
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +14 -14
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +27 -15
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/charts/bar-3d/interface.js +1 -2
- package/esm/charts/candlestick/candlestick.js +2 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -2
- package/esm/charts/funnel-3d/chart.js +1 -1
- 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 +2 -1
- package/esm/charts/histogram-3d/index.js +1 -1
- package/esm/charts/histogram-3d/interface.js +1 -1
- package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/esm/charts/image-cloud/image-cloud.js +1 -1
- package/esm/charts/image-cloud/index.js +1 -1
- package/esm/charts/image-cloud/interface.js +1 -1
- package/esm/charts/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/esm/charts/storyline/interface.d.ts +8 -2
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layout.js +19 -25
- package/esm/charts/storyline/layout.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.d.ts +5 -0
- package/esm/charts/storyline/layouts/{dome.js → arc.js} +51 -57
- package/esm/charts/storyline/layouts/arc.js.map +1 -0
- package/esm/charts/storyline/layouts/clock.js +8 -9
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +3 -2
- package/esm/charts/storyline/layouts/common.js +3 -3
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +6 -4
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.d.ts +5 -0
- package/esm/charts/storyline/layouts/ladder.js +196 -0
- package/esm/charts/storyline/layouts/ladder.js.map +1 -0
- package/esm/charts/storyline/layouts/landscape.js +5 -3
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.js +16 -42
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +14 -14
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +25 -15
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/package.json +2 -2
- package/cjs/charts/storyline/layouts/bowl.d.ts +0 -5
- package/cjs/charts/storyline/layouts/bowl.js +0 -285
- package/cjs/charts/storyline/layouts/bowl.js.map +0 -1
- package/cjs/charts/storyline/layouts/dome.d.ts +0 -5
- package/cjs/charts/storyline/layouts/dome.js.map +0 -1
- package/esm/charts/storyline/layouts/bowl.d.ts +0 -5
- package/esm/charts/storyline/layouts/bowl.js +0 -277
- package/esm/charts/storyline/layouts/bowl.js.map +0 -1
- package/esm/charts/storyline/layouts/dome.d.ts +0 -5
- package/esm/charts/storyline/layouts/dome.js.map +0 -1
package/build/index.js
CHANGED
|
@@ -5880,27 +5880,43 @@
|
|
|
5880
5880
|
case 'portrait':
|
|
5881
5881
|
centers = lineCenters(count, center.x, inner.y + block.height / 2, center.x, inner.y + inner.height - block.height / 2);
|
|
5882
5882
|
break;
|
|
5883
|
-
case '
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5883
|
+
case 'ladder': {
|
|
5884
|
+
const isDown = layout.direction === 'down';
|
|
5885
|
+
const x0 = inner.x + block.width / 2;
|
|
5886
|
+
const x1 = inner.x + inner.width - block.width / 2;
|
|
5887
|
+
const yTop = inner.y + block.height / 2;
|
|
5888
|
+
const yBot = inner.y + inner.height - block.height / 2;
|
|
5889
|
+
const y0 = isDown ? yTop : yBot;
|
|
5890
|
+
const y1 = isDown ? yBot : yTop;
|
|
5891
|
+
const anchors = lineCenters(count, x0, y0, x1, y1);
|
|
5892
|
+
const dx = x1 - x0;
|
|
5893
|
+
const dy = y1 - y0;
|
|
5894
|
+
const len = Math.hypot(dx, dy) || 1;
|
|
5895
|
+
const nx = -dy / len;
|
|
5896
|
+
const ny = dx / len;
|
|
5897
|
+
const headlineFontSize = Math.max(80, Math.min(240, Math.round(inner.height * 0.42)));
|
|
5898
|
+
const offset = headlineFontSize * 1.2;
|
|
5899
|
+
centers = anchors.map((p, i) => {
|
|
5900
|
+
const sign = i % 2 === 0 ? 1 : -1;
|
|
5901
|
+
return {
|
|
5902
|
+
x: p.x + nx * offset * sign,
|
|
5903
|
+
y: p.y + ny * offset * sign
|
|
5904
|
+
};
|
|
5905
|
+
});
|
|
5891
5906
|
break;
|
|
5907
|
+
}
|
|
5892
5908
|
case 'spiral':
|
|
5893
5909
|
centers = alternatingVerticalCenters(count, inner, block, gap);
|
|
5894
5910
|
break;
|
|
5895
5911
|
case 'clock':
|
|
5896
5912
|
centers = circularCenters(count, viewBox, block, padding, layout);
|
|
5897
5913
|
break;
|
|
5898
|
-
case '
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
centers = arcCenters(count, inner, block, layout, 160, 20);
|
|
5914
|
+
case 'arc': {
|
|
5915
|
+
const isDown = layout.direction === 'down';
|
|
5916
|
+
const [s, e] = isDown ? [20, 160] : [200, 340];
|
|
5917
|
+
centers = arcCenters(count, inner, block, layout, s, e);
|
|
5903
5918
|
break;
|
|
5919
|
+
}
|
|
5904
5920
|
case 'wing': {
|
|
5905
5921
|
const direction = layout.direction === 'right' ? 'right' : 'left';
|
|
5906
5922
|
const [s, e] = direction === 'right' ? [110, 250] : [-70, 70];
|
|
@@ -5938,15 +5954,6 @@
|
|
|
5938
5954
|
};
|
|
5939
5955
|
});
|
|
5940
5956
|
};
|
|
5941
|
-
const alternatingHorizontalCenters = (count, inner, block, gap) => {
|
|
5942
|
-
const baseY = inner.y + inner.height / 2;
|
|
5943
|
-
const offset = Math.min(Math.max(block.height * 0.65 + gap / 2, 0), Math.max((inner.height - block.height) / 2, 0));
|
|
5944
|
-
const points = lineCenters(count, inner.x + block.width / 2, baseY, inner.x + inner.width - block.width / 2, baseY);
|
|
5945
|
-
return points.map((point, index) => ({
|
|
5946
|
-
x: point.x,
|
|
5947
|
-
y: point.y + (index % 2 === 0 ? -offset : offset)
|
|
5948
|
-
}));
|
|
5949
|
-
};
|
|
5950
5957
|
const alternatingVerticalCenters = (count, inner, block, gap) => {
|
|
5951
5958
|
const baseX = inner.x + inner.width / 2;
|
|
5952
5959
|
const offset = Math.min(Math.max(block.width * 0.65 + gap / 2, 0), Math.max((inner.width - block.width) / 2, 0));
|
|
@@ -6066,9 +6073,9 @@
|
|
|
6066
6073
|
const isLandscape = (spec) => normalizeLayout(spec.layout).type === 'landscape';
|
|
6067
6074
|
const isPortrait = (spec) => normalizeLayout(spec.layout).type === 'portrait';
|
|
6068
6075
|
const isClock = (spec) => normalizeLayout(spec.layout).type === 'clock';
|
|
6069
|
-
const
|
|
6070
|
-
const isBowl = (spec) => normalizeLayout(spec.layout).type === 'bowl';
|
|
6076
|
+
const isArc = (spec) => normalizeLayout(spec.layout).type === 'arc';
|
|
6071
6077
|
const isWing = (spec) => normalizeLayout(spec.layout).type === 'wing';
|
|
6078
|
+
const isLadder = (spec) => normalizeLayout(spec.layout).type === 'ladder';
|
|
6072
6079
|
const getThemeColor = (spec) => { var _a; return (_a = spec.themeColor) !== null && _a !== void 0 ? _a : DEFAULT_THEME_COLOR; };
|
|
6073
6080
|
const withAlpha = (color, alpha) => {
|
|
6074
6081
|
const safeAlpha = Math.max(0, Math.min(1, alpha));
|
|
@@ -6283,8 +6290,8 @@
|
|
|
6283
6290
|
const CLOCK_LEAD_LINE_GAP = 6;
|
|
6284
6291
|
const CLOCK_TEXT_GAP_FROM_LEAD = 8;
|
|
6285
6292
|
const CLOCK_ORBIT_DASH = [4, 4];
|
|
6286
|
-
const CLOCK_TITLE_FONT_SIZE =
|
|
6287
|
-
const CLOCK_TITLE_LINE_HEIGHT =
|
|
6293
|
+
const CLOCK_TITLE_FONT_SIZE = 18;
|
|
6294
|
+
const CLOCK_TITLE_LINE_HEIGHT = 24;
|
|
6288
6295
|
const CLOCK_CONTENT_FONT_SIZE = 11;
|
|
6289
6296
|
const CLOCK_CONTENT_LINE_HEIGHT = 15;
|
|
6290
6297
|
const getClockGeometry = (spec, ctx) => {
|
|
@@ -6345,7 +6352,7 @@
|
|
|
6345
6352
|
}, y: (_d, ctx) => {
|
|
6346
6353
|
const g = getClockGeometry(spec, ctx);
|
|
6347
6354
|
return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
6348
|
-
}, width: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, height: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image,
|
|
6355
|
+
}, width: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, height: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO * 2, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', anchor: (_d, ctx) => {
|
|
6349
6356
|
const g = getClockGeometry(spec, ctx);
|
|
6350
6357
|
return [g.cx, g.cy];
|
|
6351
6358
|
}, dx: (_d, ctx) => {
|
|
@@ -6483,13 +6490,10 @@
|
|
|
6483
6490
|
width: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6484
6491
|
height: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter,
|
|
6485
6492
|
image: block.image,
|
|
6486
|
-
cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2,
|
|
6487
6493
|
repeatX: 'no-repeat',
|
|
6488
6494
|
repeatY: 'no-repeat',
|
|
6489
6495
|
imageMode: 'cover',
|
|
6490
|
-
imagePosition: 'center'
|
|
6491
|
-
stroke: themeColor,
|
|
6492
|
-
lineWidth: 2
|
|
6496
|
+
imagePosition: 'center'
|
|
6493
6497
|
}
|
|
6494
6498
|
}
|
|
6495
6499
|
: {
|
|
@@ -6507,7 +6511,7 @@
|
|
|
6507
6511
|
}
|
|
6508
6512
|
},
|
|
6509
6513
|
block.title
|
|
6510
|
-
? 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 - CLOCK_TITLE_LINE_HEIGHT, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: CLOCK_TITLE_FONT_SIZE, lineHeight: CLOCK_TITLE_LINE_HEIGHT, fontWeight: 'bold', fill: themeColor, textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6514
|
+
? 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 - CLOCK_TITLE_LINE_HEIGHT, text: block.title, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, fontSize: CLOCK_TITLE_FONT_SIZE, lineHeight: CLOCK_TITLE_LINE_HEIGHT, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top' }, (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) })
|
|
6511
6515
|
: null,
|
|
6512
6516
|
contentText.length
|
|
6513
6517
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-clock-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, maxLineWidth: (_d, ctx) => getClockTextRect(spec, ctx, index).width, text: buildRichContent(contentText, spec), fontSize: CLOCK_CONTENT_FONT_SIZE, lineHeight: CLOCK_CONTENT_LINE_HEIGHT, fill: '#3a3f4d', textAlign: (_d, ctx) => getClockTextRect(spec, ctx, index).onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word' }, (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) })
|
|
@@ -6553,7 +6557,7 @@
|
|
|
6553
6557
|
const imageHeight = (_h = (_g = spec.image) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_IMAGE_HEIGHT;
|
|
6554
6558
|
const imageGap = (_k = (_j = spec.image) === null || _j === void 0 ? void 0 : _j.gap) !== null && _k !== void 0 ? _k : DEFAULT_IMAGE_GAP;
|
|
6555
6559
|
const hasImage = !!((_m = (_l = spec.data) === null || _l === void 0 ? void 0 : _l[index]) === null || _m === void 0 ? void 0 : _m.image);
|
|
6556
|
-
const titleFontSize = Number((_q = (_p = (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.fontSize) !== null && _q !== void 0 ? _q :
|
|
6560
|
+
const titleFontSize = Number((_q = (_p = (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.fontSize) !== null && _q !== void 0 ? _q : 18);
|
|
6557
6561
|
const titleLineHeight = Number((_t = (_s = (_r = spec.title) === null || _r === void 0 ? void 0 : _r.style) === null || _s === void 0 ? void 0 : _s.lineHeight) !== null && _t !== void 0 ? _t : Math.round(titleFontSize * 1.35));
|
|
6558
6562
|
const titleHeight = ((_v = (_u = spec.data) === null || _u === void 0 ? void 0 : _u[index]) === null || _v === void 0 ? void 0 : _v.title) ? titleLineHeight : 0;
|
|
6559
6563
|
const blockWidth = (_w = block === null || block === void 0 ? void 0 : block.width) !== null && _w !== void 0 ? _w : resolveBlockWidth(spec, 0);
|
|
@@ -6578,7 +6582,7 @@
|
|
|
6578
6582
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
6579
6583
|
const hasImage = !!block.image;
|
|
6580
6584
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6581
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c :
|
|
6585
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
6582
6586
|
const titleLineHeight = Number((_f = (_e = (_d = spec.title) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.lineHeight) !== null && _f !== void 0 ? _f : Math.round(titleFontSize * 1.35));
|
|
6583
6587
|
return {
|
|
6584
6588
|
type: 'group',
|
|
@@ -6599,10 +6603,10 @@
|
|
|
6599
6603
|
style: Object.assign({ x: 0, y: 0, width: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.width, height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style)
|
|
6600
6604
|
},
|
|
6601
6605
|
hasImage
|
|
6602
|
-
? 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
|
|
6606
|
+
? 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 }, (_j = spec.image) === null || _j === void 0 ? void 0 : _j.style) })
|
|
6603
6607
|
: null,
|
|
6604
6608
|
block.title
|
|
6605
|
-
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', textAlign: 'left', textBaseline: 'top' }, (_k = spec.title) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6609
|
+
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_k = spec.title) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6606
6610
|
: null,
|
|
6607
6611
|
contentText.length
|
|
6608
6612
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, text: buildRichContent(contentText, spec), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, fontSize: 12, lineHeight: 18, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) })
|
|
@@ -6728,7 +6732,7 @@
|
|
|
6728
6732
|
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6729
6733
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6730
6734
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
6731
|
-
const titleFontSize = Number((_f = (_e = (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f :
|
|
6735
|
+
const titleFontSize = Number((_f = (_e = (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : 18);
|
|
6732
6736
|
const titleLineHeight = Number((_j = (_h = (_g = spec.title) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : Math.max(LANDSCAPE_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
6733
6737
|
const contentFontSize = Number((_m = (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fontSize) !== null && _m !== void 0 ? _m : LANDSCAPE_CONTENT_FONT_SIZE);
|
|
6734
6738
|
const contentLineHeight = Number((_q = (_p = (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style) === null || _p === void 0 ? void 0 : _p.lineHeight) !== null && _q !== void 0 ? _q : LANDSCAPE_CONTENT_LINE_HEIGHT);
|
|
@@ -6803,7 +6807,7 @@
|
|
|
6803
6807
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6804
6808
|
const hasImage = !!block.image;
|
|
6805
6809
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6806
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c :
|
|
6810
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
6807
6811
|
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * 1.35));
|
|
6808
6812
|
const getMetrics = (ctx) => {
|
|
6809
6813
|
var _a, _b, _c, _e;
|
|
@@ -6849,7 +6853,7 @@
|
|
|
6849
6853
|
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: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
|
|
6850
6854
|
},
|
|
6851
6855
|
hasImage
|
|
6852
|
-
? 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,
|
|
6856
|
+
? 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: 'cover', imagePosition: 'center' }, (_r = spec.image) === null || _r === void 0 ? void 0 : _r.style) })
|
|
6853
6857
|
: null,
|
|
6854
6858
|
{
|
|
6855
6859
|
type: 'path',
|
|
@@ -6875,7 +6879,7 @@
|
|
|
6875
6879
|
}
|
|
6876
6880
|
},
|
|
6877
6881
|
block.title
|
|
6878
|
-
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', textAlign: 'left', textBaseline: 'top' }, (_s = spec.title) === null || _s === void 0 ? void 0 : _s.style) })
|
|
6882
|
+
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_s = spec.title) === null || _s === void 0 ? void 0 : _s.style) })
|
|
6879
6883
|
: null,
|
|
6880
6884
|
contentText.length
|
|
6881
6885
|
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: LANDSCAPE_CONTENT_FONT_SIZE, lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_t = spec.content) === null || _t === void 0 ? void 0 : _t.style) })
|
|
@@ -6889,9 +6893,9 @@
|
|
|
6889
6893
|
const PORTRAIT_IMAGE_WIDTH = 180;
|
|
6890
6894
|
const PORTRAIT_IMAGE_HEIGHT = 110;
|
|
6891
6895
|
const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
|
|
6892
|
-
const PORTRAIT_SHADOW_OFFSET_X =
|
|
6893
|
-
const PORTRAIT_SHADOW_OFFSET_Y =
|
|
6894
|
-
const PORTRAIT_SHADOW_SCALE = 1
|
|
6896
|
+
const PORTRAIT_SHADOW_OFFSET_X = 24;
|
|
6897
|
+
const PORTRAIT_SHADOW_OFFSET_Y = 16;
|
|
6898
|
+
const PORTRAIT_SHADOW_SCALE = 1;
|
|
6895
6899
|
const PORTRAIT_TEXT_GAP_FROM_IMAGE = 8;
|
|
6896
6900
|
const PORTRAIT_CONTENT_LINES = 3;
|
|
6897
6901
|
const PORTRAIT_TITLE_LINE_HEIGHT = 19;
|
|
@@ -6955,7 +6959,7 @@
|
|
|
6955
6959
|
};
|
|
6956
6960
|
const getPortraitMetrics = (spec, blockWidth, _blockHeight, index) => {
|
|
6957
6961
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6958
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c :
|
|
6962
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
6959
6963
|
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
6960
6964
|
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : PORTRAIT_CONTENT_FONT_SIZE);
|
|
6961
6965
|
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : PORTRAIT_CONTENT_LINE_HEIGHT);
|
|
@@ -7005,11 +7009,13 @@
|
|
|
7005
7009
|
};
|
|
7006
7010
|
};
|
|
7007
7011
|
const buildPortraitBlockMark = (spec, block, index) => {
|
|
7008
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7012
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
7009
7013
|
const hasImage = !!block.image;
|
|
7014
|
+
const hasSubImage = !!block.subImage;
|
|
7010
7015
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7011
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c :
|
|
7016
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
7012
7017
|
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
7018
|
+
const showBackground = ((_h = spec.image) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7013
7019
|
const getMetrics = (ctx) => {
|
|
7014
7020
|
var _a, _b, _c, _e;
|
|
7015
7021
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
@@ -7018,10 +7024,10 @@
|
|
|
7018
7024
|
return getPortraitMetrics(spec, w, h, index);
|
|
7019
7025
|
};
|
|
7020
7026
|
const themeColor = getThemeColor(spec);
|
|
7021
|
-
const blockStyle = (
|
|
7027
|
+
const blockStyle = (_k = (_j = spec.block) === null || _j === void 0 ? void 0 : _j.style) !== null && _k !== void 0 ? _k : {};
|
|
7022
7028
|
return {
|
|
7023
7029
|
type: 'group',
|
|
7024
|
-
id: `storyline-block-${(
|
|
7030
|
+
id: `storyline-block-${(_l = block.id) !== null && _l !== void 0 ? _l : index}`,
|
|
7025
7031
|
name: `storyline-block-${index}`,
|
|
7026
7032
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7027
7033
|
style: {
|
|
@@ -7037,7 +7043,7 @@
|
|
|
7037
7043
|
}
|
|
7038
7044
|
},
|
|
7039
7045
|
children: [
|
|
7040
|
-
|
|
7046
|
+
hasSubImage && showBackground
|
|
7041
7047
|
? {
|
|
7042
7048
|
type: 'image',
|
|
7043
7049
|
name: `storyline-block-shadow-image-${index}`,
|
|
@@ -7047,8 +7053,7 @@
|
|
|
7047
7053
|
y: (_d, ctx) => getMetrics(ctx).shadowBox.y,
|
|
7048
7054
|
width: (_d, ctx) => getMetrics(ctx).shadowBox.width,
|
|
7049
7055
|
height: (_d, ctx) => getMetrics(ctx).shadowBox.height,
|
|
7050
|
-
image: block.
|
|
7051
|
-
cornerRadius: 8,
|
|
7056
|
+
image: block.subImage,
|
|
7052
7057
|
repeatX: 'no-repeat',
|
|
7053
7058
|
repeatY: 'no-repeat',
|
|
7054
7059
|
imageMode: 'cover',
|
|
@@ -7056,33 +7061,6 @@
|
|
|
7056
7061
|
}
|
|
7057
7062
|
}
|
|
7058
7063
|
: null,
|
|
7059
|
-
hasImage
|
|
7060
|
-
? {
|
|
7061
|
-
type: 'rect',
|
|
7062
|
-
name: `storyline-block-shadow-mask-${index}`,
|
|
7063
|
-
interactive: false,
|
|
7064
|
-
style: {
|
|
7065
|
-
x: (_d, ctx) => getMetrics(ctx).shadowBox.x,
|
|
7066
|
-
y: (_d, ctx) => getMetrics(ctx).shadowBox.y,
|
|
7067
|
-
width: (_d, ctx) => getMetrics(ctx).shadowBox.width,
|
|
7068
|
-
height: (_d, ctx) => getMetrics(ctx).shadowBox.height,
|
|
7069
|
-
cornerRadius: 8,
|
|
7070
|
-
stroke: false,
|
|
7071
|
-
lineWidth: 0,
|
|
7072
|
-
fill: {
|
|
7073
|
-
gradient: 'linear',
|
|
7074
|
-
x0: 0,
|
|
7075
|
-
y0: 0,
|
|
7076
|
-
x1: 0,
|
|
7077
|
-
y1: 1,
|
|
7078
|
-
stops: [
|
|
7079
|
-
{ offset: 0, color: withAlpha(themeColor, 0.2) },
|
|
7080
|
-
{ offset: 1, color: withAlpha(themeColor, 1) }
|
|
7081
|
-
]
|
|
7082
|
-
}
|
|
7083
|
-
}
|
|
7084
|
-
}
|
|
7085
|
-
: null,
|
|
7086
7064
|
{
|
|
7087
7065
|
type: 'rect',
|
|
7088
7066
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7090,349 +7068,76 @@
|
|
|
7090
7068
|
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: 8, fill: '#ffffff', stroke: themeColor, lineWidth: 2 }, blockStyle)
|
|
7091
7069
|
},
|
|
7092
7070
|
hasImage
|
|
7093
|
-
? 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,
|
|
7071
|
+
? 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: 'cover', imagePosition: 'center' }, (_m = spec.image) === null || _m === void 0 ? void 0 : _m.style) })
|
|
7094
7072
|
: null,
|
|
7095
7073
|
block.title
|
|
7096
|
-
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', textAlign: 'left', textBaseline: 'top' }, (
|
|
7074
|
+
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: 'left', textBaseline: 'top' }, (_o = spec.title) === null || _o === void 0 ? void 0 : _o.style) })
|
|
7097
7075
|
: null,
|
|
7098
7076
|
contentText.length
|
|
7099
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (
|
|
7077
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: PORTRAIT_CONTENT_FONT_SIZE, lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style) })
|
|
7100
7078
|
: null
|
|
7101
7079
|
].filter(Boolean)
|
|
7102
7080
|
};
|
|
7103
7081
|
};
|
|
7104
7082
|
|
|
7105
|
-
const
|
|
7106
|
-
const
|
|
7107
|
-
const
|
|
7108
|
-
const
|
|
7109
|
-
const
|
|
7110
|
-
const
|
|
7111
|
-
const
|
|
7112
|
-
const
|
|
7113
|
-
const
|
|
7114
|
-
const
|
|
7115
|
-
const
|
|
7083
|
+
const ARC_BLOCK_IMAGE_SIZE = 140;
|
|
7084
|
+
const ARC_TEXT_GAP_FROM_IMAGE = 10;
|
|
7085
|
+
const ARC_TITLE_LINE_HEIGHT = 19;
|
|
7086
|
+
const ARC_CONTENT_LINE_HEIGHT = 17;
|
|
7087
|
+
const ARC_CONTENT_FONT_SIZE = 12;
|
|
7088
|
+
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7089
|
+
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7090
|
+
const ARC_TEXT_LEFT_PADDING = 20;
|
|
7091
|
+
const ARC_TEXT_BOX_MIN_WIDTH = 200;
|
|
7092
|
+
const ARC_CENTER_IMAGE_SIZE_RATIO = 0.4;
|
|
7093
|
+
const ARC_GAP_FROM_CENTER_IMAGE = 200;
|
|
7094
|
+
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7095
|
+
const getArcCenterImageRect = (spec, ctx) => {
|
|
7116
7096
|
var _a, _b, _c, _e, _f;
|
|
7117
7097
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7118
7098
|
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7119
7099
|
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
7120
7100
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7121
|
-
const baseSize = Math.min(innerWidth, innerHeight) *
|
|
7101
|
+
const baseSize = Math.min(innerWidth, innerHeight) * ARC_CENTER_IMAGE_SIZE_RATIO;
|
|
7122
7102
|
const w = Math.max((_c = (_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : baseSize, 80);
|
|
7123
7103
|
const h = Math.max((_f = (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : baseSize, 80);
|
|
7124
7104
|
const cx = startX + padding.left + innerWidth / 2;
|
|
7125
|
-
const
|
|
7105
|
+
const isDown = isDownArc(spec);
|
|
7106
|
+
const top = isDown
|
|
7107
|
+
?
|
|
7108
|
+
startY + padding.top
|
|
7109
|
+
:
|
|
7110
|
+
startY + padding.top + innerHeight - h;
|
|
7126
7111
|
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7127
7112
|
};
|
|
7128
|
-
const
|
|
7113
|
+
const getArcGeometry = (spec, ctx) => {
|
|
7129
7114
|
var _a, _b, _c, _e;
|
|
7130
7115
|
const { width, startX } = getRegionGeometry(ctx);
|
|
7131
7116
|
const blockPadding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7132
7117
|
const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);
|
|
7133
7118
|
const blockWidth = resolveBlockWidth(spec, width);
|
|
7134
7119
|
const layoutOpt = normalizeLayout(spec.layout);
|
|
7135
|
-
const
|
|
7136
|
-
const
|
|
7120
|
+
const isDown = layoutOpt.direction === 'down';
|
|
7121
|
+
const startAngle = (_b = layoutOpt.startAngle) !== null && _b !== void 0 ? _b : (isDown ? 20 : 200);
|
|
7122
|
+
const endAngle = (_c = layoutOpt.endAngle) !== null && _c !== void 0 ? _c : (isDown ? 160 : 340);
|
|
7137
7123
|
const ratio = (_e = layoutOpt.radiusRatio) !== null && _e !== void 0 ? _e : 0.88;
|
|
7138
7124
|
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7139
|
-
const centerRect =
|
|
7125
|
+
const centerRect = getArcCenterImageRect(spec, ctx);
|
|
7140
7126
|
const centerTop = centerRect.y;
|
|
7141
7127
|
const centerBottom = centerRect.y + centerRect.height;
|
|
7142
7128
|
const sinStart = Math.sin((startAngle / 180) * Math.PI);
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
cy
|
|
7149
|
-
rx,
|
|
7150
|
-
ry,
|
|
7151
|
-
startAngle,
|
|
7152
|
-
endAngle,
|
|
7153
|
-
centerTop,
|
|
7154
|
-
centerBottom
|
|
7155
|
-
};
|
|
7156
|
-
};
|
|
7157
|
-
const getDomeBlockCenter = (spec, ctx, index) => {
|
|
7158
|
-
var _a, _b, _c, _e;
|
|
7159
|
-
const arc = getDomeArcGeometry(spec, ctx);
|
|
7160
|
-
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7161
|
-
if (count <= 0) {
|
|
7162
|
-
return { x: arc.cx, y: arc.cy };
|
|
7129
|
+
let cy;
|
|
7130
|
+
let ry;
|
|
7131
|
+
if (isDown) {
|
|
7132
|
+
const denom = Math.max(1 - sinStart, 0.05);
|
|
7133
|
+
ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
|
|
7134
|
+
cy = centerTop - ry * sinStart;
|
|
7163
7135
|
}
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
7168
|
-
const nxRaw = Math.cos(angle) / arc.rx;
|
|
7169
|
-
const nyRaw = Math.sin(angle) / arc.ry;
|
|
7170
|
-
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7171
|
-
const nx = nxRaw / nLen;
|
|
7172
|
-
const ny = nyRaw / nLen;
|
|
7173
|
-
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : DOME_BLOCK_IMAGE_SIZE;
|
|
7174
|
-
const offset = imageHeight / 2;
|
|
7175
|
-
return { x: px + nx * offset, y: py + ny * offset };
|
|
7176
|
-
};
|
|
7177
|
-
const buildDomeArcMark = (spec) => {
|
|
7178
|
-
var _a;
|
|
7179
|
-
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
7180
|
-
return null;
|
|
7181
|
-
}
|
|
7182
|
-
const themeColor = getThemeColor(spec);
|
|
7183
|
-
return {
|
|
7184
|
-
type: 'group',
|
|
7185
|
-
name: 'storyline-dome-arc',
|
|
7186
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7187
|
-
children: [
|
|
7188
|
-
{
|
|
7189
|
-
type: 'path',
|
|
7190
|
-
name: 'storyline-dome-arc-path',
|
|
7191
|
-
interactive: false,
|
|
7192
|
-
style: {
|
|
7193
|
-
stroke: themeColor,
|
|
7194
|
-
lineWidth: 2,
|
|
7195
|
-
lineCap: 'round',
|
|
7196
|
-
fill: 'transparent',
|
|
7197
|
-
fillOpacity: 0,
|
|
7198
|
-
path: (_d, ctx) => {
|
|
7199
|
-
const arc = getDomeArcGeometry(spec, ctx);
|
|
7200
|
-
const span = arc.endAngle - arc.startAngle;
|
|
7201
|
-
const samples = 64;
|
|
7202
|
-
const segments = [];
|
|
7203
|
-
for (let i = 0; i <= samples; i++) {
|
|
7204
|
-
const t = i / samples;
|
|
7205
|
-
const angle = ((arc.startAngle + span * t) / 180) * Math.PI;
|
|
7206
|
-
const x = arc.cx + Math.cos(angle) * arc.rx;
|
|
7207
|
-
const y = arc.cy + Math.sin(angle) * arc.ry;
|
|
7208
|
-
segments.push(`${i === 0 ? 'M' : 'L'} ${x.toFixed(2)} ${y.toFixed(2)}`);
|
|
7209
|
-
}
|
|
7210
|
-
return segments.join(' ');
|
|
7211
|
-
}
|
|
7212
|
-
}
|
|
7213
|
-
}
|
|
7214
|
-
]
|
|
7215
|
-
};
|
|
7216
|
-
};
|
|
7217
|
-
const buildDomeCenterImageMark = (spec) => {
|
|
7218
|
-
var _a, _b, _c, _e;
|
|
7219
|
-
const visible = ((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) !== false;
|
|
7220
|
-
if (!visible) {
|
|
7221
|
-
return null;
|
|
7136
|
+
else {
|
|
7137
|
+
const denom = Math.max(1 + sinStart, 0.05);
|
|
7138
|
+
ry = (centerRect.height + ARC_GAP_FROM_CENTER_IMAGE) / denom;
|
|
7139
|
+
cy = centerBottom - ry * sinStart;
|
|
7222
7140
|
}
|
|
7223
|
-
const themeColor = getThemeColor(spec);
|
|
7224
|
-
const hasImage = !!((_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.image);
|
|
7225
|
-
const symbolGradient = {
|
|
7226
|
-
gradient: 'linear',
|
|
7227
|
-
x0: 0.5,
|
|
7228
|
-
y0: 0,
|
|
7229
|
-
x1: 0.5,
|
|
7230
|
-
y1: 1,
|
|
7231
|
-
stops: [
|
|
7232
|
-
{ offset: 0, color: withAlpha(themeColor, 0.15) },
|
|
7233
|
-
{ offset: 1, color: themeColor }
|
|
7234
|
-
]
|
|
7235
|
-
};
|
|
7236
|
-
return {
|
|
7237
|
-
type: 'group',
|
|
7238
|
-
name: 'storyline-dome-center',
|
|
7239
|
-
zIndex: vchart.LayoutZIndex.Mark,
|
|
7240
|
-
children: [
|
|
7241
|
-
{
|
|
7242
|
-
type: 'symbol',
|
|
7243
|
-
name: 'storyline-dome-center-symbol',
|
|
7244
|
-
interactive: false,
|
|
7245
|
-
style: {
|
|
7246
|
-
x: (_d, ctx) => {
|
|
7247
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7248
|
-
return r.x + r.width / 2;
|
|
7249
|
-
},
|
|
7250
|
-
y: (_d, ctx) => {
|
|
7251
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7252
|
-
return r.y + r.height / 2;
|
|
7253
|
-
},
|
|
7254
|
-
size: (_d, ctx) => {
|
|
7255
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7256
|
-
return Math.max(r.width, r.height) * 1.1;
|
|
7257
|
-
},
|
|
7258
|
-
symbolType: 'circle',
|
|
7259
|
-
fill: symbolGradient,
|
|
7260
|
-
stroke: themeColor,
|
|
7261
|
-
lineWidth: 2
|
|
7262
|
-
}
|
|
7263
|
-
},
|
|
7264
|
-
{
|
|
7265
|
-
type: 'rect',
|
|
7266
|
-
name: 'storyline-dome-center-rect',
|
|
7267
|
-
interactive: false,
|
|
7268
|
-
style: {
|
|
7269
|
-
x: (_d, ctx) => getDomeCenterImageRect(spec, ctx).x,
|
|
7270
|
-
y: (_d, ctx) => getDomeCenterImageRect(spec, ctx).y,
|
|
7271
|
-
width: (_d, ctx) => getDomeCenterImageRect(spec, ctx).width,
|
|
7272
|
-
height: (_d, ctx) => getDomeCenterImageRect(spec, ctx).height,
|
|
7273
|
-
cornerRadius: 12,
|
|
7274
|
-
fill: '#ffffff',
|
|
7275
|
-
stroke: themeColor,
|
|
7276
|
-
lineWidth: 2
|
|
7277
|
-
}
|
|
7278
|
-
},
|
|
7279
|
-
hasImage
|
|
7280
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-dome-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => getDomeCenterImageRect(spec, ctx).x, y: (_d, ctx) => getDomeCenterImageRect(spec, ctx).y, width: (_d, ctx) => getDomeCenterImageRect(spec, ctx).width, height: (_d, ctx) => getDomeCenterImageRect(spec, ctx).height, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, cornerRadius: 12, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', anchor: (_d, ctx) => {
|
|
7281
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7282
|
-
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7283
|
-
}, dx: (_d, ctx) => {
|
|
7284
|
-
var _a, _b;
|
|
7285
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7286
|
-
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7287
|
-
const w = typeof userWidth === 'number' ? userWidth : r.width;
|
|
7288
|
-
return (r.width - w) / 2;
|
|
7289
|
-
}, dy: (_d, ctx) => {
|
|
7290
|
-
var _a, _b;
|
|
7291
|
-
const r = getDomeCenterImageRect(spec, ctx);
|
|
7292
|
-
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7293
|
-
const h = typeof userHeight === 'number' ? userHeight : r.height;
|
|
7294
|
-
return (r.height - h) / 2;
|
|
7295
|
-
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7296
|
-
: null
|
|
7297
|
-
].filter(Boolean)
|
|
7298
|
-
};
|
|
7299
|
-
};
|
|
7300
|
-
const getDomeBlockMetrics = (spec) => {
|
|
7301
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7302
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 14);
|
|
7303
|
-
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(DOME_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
7304
|
-
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : DOME_CONTENT_FONT_SIZE);
|
|
7305
|
-
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : DOME_CONTENT_LINE_HEIGHT);
|
|
7306
|
-
const titleToContentGap = DOME_TITLE_TO_CONTENT_GAP;
|
|
7307
|
-
const textHeight = DOME_TEXT_BOX_HEIGHT;
|
|
7308
|
-
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7309
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : DOME_BLOCK_IMAGE_SIZE;
|
|
7310
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : DOME_BLOCK_IMAGE_SIZE;
|
|
7311
|
-
const imageBox = {
|
|
7312
|
-
x: -imageWidth / 2,
|
|
7313
|
-
y: -imageHeight / 2,
|
|
7314
|
-
width: imageWidth,
|
|
7315
|
-
height: imageHeight
|
|
7316
|
-
};
|
|
7317
|
-
const textBox = {
|
|
7318
|
-
x: -imageWidth / 2 + DOME_TEXT_LEFT_PADDING,
|
|
7319
|
-
y: imageBox.y - DOME_TEXT_GAP_FROM_IMAGE - textHeight,
|
|
7320
|
-
width: imageWidth - DOME_TEXT_LEFT_PADDING,
|
|
7321
|
-
height: textHeight
|
|
7322
|
-
};
|
|
7323
|
-
const contentBox = {
|
|
7324
|
-
x: textBox.x,
|
|
7325
|
-
y: textBox.y + titleLineHeight + titleToContentGap,
|
|
7326
|
-
width: textBox.width,
|
|
7327
|
-
height: contentHeight
|
|
7328
|
-
};
|
|
7329
|
-
return {
|
|
7330
|
-
titleFontSize,
|
|
7331
|
-
titleLineHeight,
|
|
7332
|
-
contentFontSize,
|
|
7333
|
-
contentLineHeight,
|
|
7334
|
-
imageBox,
|
|
7335
|
-
textBox,
|
|
7336
|
-
contentBox
|
|
7337
|
-
};
|
|
7338
|
-
};
|
|
7339
|
-
const buildDomeBlockMark = (spec, block, index) => {
|
|
7340
|
-
var _a, _b, _c, _e;
|
|
7341
|
-
const hasImage = !!block.image;
|
|
7342
|
-
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7343
|
-
const themeColor = getThemeColor(spec);
|
|
7344
|
-
const metrics = getDomeBlockMetrics(spec);
|
|
7345
|
-
return {
|
|
7346
|
-
type: 'group',
|
|
7347
|
-
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
7348
|
-
name: `storyline-block-${index}`,
|
|
7349
|
-
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7350
|
-
style: {
|
|
7351
|
-
x: (_d, ctx) => getDomeBlockCenter(spec, ctx, index).x,
|
|
7352
|
-
y: (_d, ctx) => getDomeBlockCenter(spec, ctx, index).y
|
|
7353
|
-
},
|
|
7354
|
-
children: [
|
|
7355
|
-
{
|
|
7356
|
-
type: 'rect',
|
|
7357
|
-
name: `storyline-block-connector-${index}`,
|
|
7358
|
-
interactive: false,
|
|
7359
|
-
style: {
|
|
7360
|
-
x: metrics.imageBox.x,
|
|
7361
|
-
y: metrics.textBox.y,
|
|
7362
|
-
width: 2,
|
|
7363
|
-
height: Math.max(metrics.imageBox.y - metrics.textBox.y, 0),
|
|
7364
|
-
fill: themeColor,
|
|
7365
|
-
fillOpacity: 0.6
|
|
7366
|
-
}
|
|
7367
|
-
},
|
|
7368
|
-
hasImage
|
|
7369
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', stroke: themeColor, lineWidth: 2 }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7370
|
-
: {
|
|
7371
|
-
type: 'rect',
|
|
7372
|
-
name: `storyline-block-image-bg-${index}`,
|
|
7373
|
-
interactive: false,
|
|
7374
|
-
style: {
|
|
7375
|
-
x: metrics.imageBox.x,
|
|
7376
|
-
y: metrics.imageBox.y,
|
|
7377
|
-
width: metrics.imageBox.width,
|
|
7378
|
-
height: metrics.imageBox.height,
|
|
7379
|
-
cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,
|
|
7380
|
-
fill: '#ffffff',
|
|
7381
|
-
stroke: themeColor,
|
|
7382
|
-
lineWidth: 2
|
|
7383
|
-
}
|
|
7384
|
-
},
|
|
7385
|
-
block.title
|
|
7386
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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', textAlign: 'left', textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7387
|
-
: null,
|
|
7388
|
-
contentText.length
|
|
7389
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: DOME_CONTENT_FONT_SIZE, lineHeight: DOME_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7390
|
-
: null
|
|
7391
|
-
].filter(Boolean)
|
|
7392
|
-
};
|
|
7393
|
-
};
|
|
7394
|
-
|
|
7395
|
-
const BOWL_BLOCK_IMAGE_SIZE = 140;
|
|
7396
|
-
const BOWL_TEXT_GAP_FROM_IMAGE = 10;
|
|
7397
|
-
const BOWL_TITLE_LINE_HEIGHT = 19;
|
|
7398
|
-
const BOWL_CONTENT_LINE_HEIGHT = 17;
|
|
7399
|
-
const BOWL_CONTENT_FONT_SIZE = 12;
|
|
7400
|
-
const BOWL_TEXT_BOX_HEIGHT = 300;
|
|
7401
|
-
const BOWL_TITLE_TO_CONTENT_GAP = 4;
|
|
7402
|
-
const BOWL_TEXT_LEFT_PADDING = 20;
|
|
7403
|
-
const BOWL_CENTER_IMAGE_SIZE_RATIO = 0.4;
|
|
7404
|
-
const BOWL_ARC_BOTTOM_GAP_FROM_CENTER_IMAGE = 300;
|
|
7405
|
-
const getBowlCenterImageRect = (spec, ctx) => {
|
|
7406
|
-
var _a, _b, _c, _e, _f;
|
|
7407
|
-
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7408
|
-
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7409
|
-
const innerWidth = Math.max(width - padding.left - padding.right, 1);
|
|
7410
|
-
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7411
|
-
const baseSize = Math.min(innerWidth, innerHeight) * BOWL_CENTER_IMAGE_SIZE_RATIO;
|
|
7412
|
-
const w = Math.max((_c = (_b = spec.centerImage) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : baseSize, 80);
|
|
7413
|
-
const h = Math.max((_f = (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.height) !== null && _f !== void 0 ? _f : baseSize, 80);
|
|
7414
|
-
const cx = startX + padding.left + innerWidth / 2;
|
|
7415
|
-
const top = startY + padding.top;
|
|
7416
|
-
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7417
|
-
};
|
|
7418
|
-
const getBowlArcGeometry = (spec, ctx) => {
|
|
7419
|
-
var _a, _b, _c, _e;
|
|
7420
|
-
const { width, startX } = getRegionGeometry(ctx);
|
|
7421
|
-
const blockPadding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7422
|
-
const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);
|
|
7423
|
-
const blockWidth = resolveBlockWidth(spec, width);
|
|
7424
|
-
const layoutOpt = normalizeLayout(spec.layout);
|
|
7425
|
-
const startAngle = (_b = layoutOpt.startAngle) !== null && _b !== void 0 ? _b : 20;
|
|
7426
|
-
const endAngle = (_c = layoutOpt.endAngle) !== null && _c !== void 0 ? _c : 160;
|
|
7427
|
-
const ratio = (_e = layoutOpt.radiusRatio) !== null && _e !== void 0 ? _e : 0.88;
|
|
7428
|
-
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7429
|
-
const centerRect = getBowlCenterImageRect(spec, ctx);
|
|
7430
|
-
const centerTop = centerRect.y;
|
|
7431
|
-
const centerBottom = centerRect.y + centerRect.height;
|
|
7432
|
-
const sinStart = Math.sin((startAngle / 180) * Math.PI);
|
|
7433
|
-
const denom = Math.max(1 - sinStart, 0.05);
|
|
7434
|
-
const ry = (centerRect.height + BOWL_ARC_BOTTOM_GAP_FROM_CENTER_IMAGE) / denom;
|
|
7435
|
-
const cy = centerTop - ry * sinStart;
|
|
7436
7141
|
return {
|
|
7437
7142
|
cx: startX + blockPadding.left + innerWidth / 2,
|
|
7438
7143
|
cy,
|
|
@@ -7444,9 +7149,9 @@
|
|
|
7444
7149
|
centerBottom
|
|
7445
7150
|
};
|
|
7446
7151
|
};
|
|
7447
|
-
const
|
|
7152
|
+
const getArcBlockCenter = (spec, ctx, index) => {
|
|
7448
7153
|
var _a, _b, _c, _e;
|
|
7449
|
-
const arc =
|
|
7154
|
+
const arc = getArcGeometry(spec, ctx);
|
|
7450
7155
|
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
7451
7156
|
if (count <= 0) {
|
|
7452
7157
|
return { x: arc.cx, y: arc.cy };
|
|
@@ -7460,11 +7165,11 @@
|
|
|
7460
7165
|
const nLen = Math.hypot(nxRaw, nyRaw) || 1;
|
|
7461
7166
|
const nx = nxRaw / nLen;
|
|
7462
7167
|
const ny = nyRaw / nLen;
|
|
7463
|
-
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e :
|
|
7168
|
+
const imageHeight = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : ARC_BLOCK_IMAGE_SIZE;
|
|
7464
7169
|
const offset = imageHeight / 2;
|
|
7465
7170
|
return { x: px + nx * offset, y: py + ny * offset };
|
|
7466
7171
|
};
|
|
7467
|
-
const
|
|
7172
|
+
const buildArcMark = (spec) => {
|
|
7468
7173
|
var _a;
|
|
7469
7174
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) !== true) {
|
|
7470
7175
|
return null;
|
|
@@ -7472,12 +7177,12 @@
|
|
|
7472
7177
|
const themeColor = getThemeColor(spec);
|
|
7473
7178
|
return {
|
|
7474
7179
|
type: 'group',
|
|
7475
|
-
name: 'storyline-
|
|
7180
|
+
name: 'storyline-arc',
|
|
7476
7181
|
zIndex: vchart.LayoutZIndex.Mark,
|
|
7477
7182
|
children: [
|
|
7478
7183
|
{
|
|
7479
7184
|
type: 'path',
|
|
7480
|
-
name: 'storyline-
|
|
7185
|
+
name: 'storyline-arc-path',
|
|
7481
7186
|
interactive: false,
|
|
7482
7187
|
style: {
|
|
7483
7188
|
stroke: themeColor,
|
|
@@ -7486,7 +7191,7 @@
|
|
|
7486
7191
|
fill: 'transparent',
|
|
7487
7192
|
fillOpacity: 0,
|
|
7488
7193
|
path: (_d, ctx) => {
|
|
7489
|
-
const arc =
|
|
7194
|
+
const arc = getArcGeometry(spec, ctx);
|
|
7490
7195
|
const span = arc.endAngle - arc.startAngle;
|
|
7491
7196
|
const samples = 64;
|
|
7492
7197
|
const segments = [];
|
|
@@ -7504,7 +7209,7 @@
|
|
|
7504
7209
|
]
|
|
7505
7210
|
};
|
|
7506
7211
|
};
|
|
7507
|
-
const
|
|
7212
|
+
const buildArcCenterImageMark = (spec) => {
|
|
7508
7213
|
var _a, _b, _c, _e;
|
|
7509
7214
|
const visible = ((_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.visible) !== false;
|
|
7510
7215
|
if (!visible) {
|
|
@@ -7525,24 +7230,24 @@
|
|
|
7525
7230
|
};
|
|
7526
7231
|
return {
|
|
7527
7232
|
type: 'group',
|
|
7528
|
-
name: 'storyline-
|
|
7233
|
+
name: 'storyline-arc-center',
|
|
7529
7234
|
zIndex: vchart.LayoutZIndex.Mark,
|
|
7530
7235
|
children: [
|
|
7531
7236
|
{
|
|
7532
7237
|
type: 'symbol',
|
|
7533
|
-
name: 'storyline-
|
|
7238
|
+
name: 'storyline-arc-center-symbol',
|
|
7534
7239
|
interactive: false,
|
|
7535
7240
|
style: {
|
|
7536
7241
|
x: (_d, ctx) => {
|
|
7537
|
-
const r =
|
|
7242
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7538
7243
|
return r.x + r.width / 2;
|
|
7539
7244
|
},
|
|
7540
7245
|
y: (_d, ctx) => {
|
|
7541
|
-
const r =
|
|
7246
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7542
7247
|
return r.y + r.height / 2;
|
|
7543
7248
|
},
|
|
7544
7249
|
size: (_d, ctx) => {
|
|
7545
|
-
const r =
|
|
7250
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7546
7251
|
return Math.max(r.width, r.height) * 1.1;
|
|
7547
7252
|
},
|
|
7548
7253
|
symbolType: 'circle',
|
|
@@ -7552,18 +7257,18 @@
|
|
|
7552
7257
|
}
|
|
7553
7258
|
},
|
|
7554
7259
|
hasImage
|
|
7555
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-
|
|
7556
|
-
const r =
|
|
7260
|
+
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => getArcCenterImageRect(spec, ctx).x, y: (_d, ctx) => getArcCenterImageRect(spec, ctx).y, width: (_d, ctx) => getArcCenterImageRect(spec, ctx).width, height: (_d, ctx) => getArcCenterImageRect(spec, ctx).height, image: (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center', anchor: (_d, ctx) => {
|
|
7261
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7557
7262
|
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7558
7263
|
}, dx: (_d, ctx) => {
|
|
7559
7264
|
var _a, _b;
|
|
7560
|
-
const r =
|
|
7265
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7561
7266
|
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7562
7267
|
const w = typeof userWidth === 'number' ? userWidth : r.width;
|
|
7563
7268
|
return (r.width - w) / 2;
|
|
7564
7269
|
}, dy: (_d, ctx) => {
|
|
7565
7270
|
var _a, _b;
|
|
7566
|
-
const r =
|
|
7271
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7567
7272
|
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7568
7273
|
const h = typeof userHeight === 'number' ? userHeight : r.height;
|
|
7569
7274
|
return (r.height - h) / 2;
|
|
@@ -7572,27 +7277,29 @@
|
|
|
7572
7277
|
].filter(Boolean)
|
|
7573
7278
|
};
|
|
7574
7279
|
};
|
|
7575
|
-
const
|
|
7280
|
+
const getArcBlockMetrics = (spec) => {
|
|
7576
7281
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7577
|
-
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c :
|
|
7578
|
-
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(
|
|
7579
|
-
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k :
|
|
7580
|
-
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o :
|
|
7581
|
-
const titleToContentGap =
|
|
7582
|
-
const textHeight =
|
|
7282
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
|
|
7283
|
+
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(ARC_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
|
|
7284
|
+
const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : ARC_CONTENT_FONT_SIZE);
|
|
7285
|
+
const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : ARC_CONTENT_LINE_HEIGHT);
|
|
7286
|
+
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7287
|
+
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7583
7288
|
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7584
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q :
|
|
7585
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s :
|
|
7289
|
+
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE;
|
|
7290
|
+
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE;
|
|
7291
|
+
const isDown = isDownArc(spec);
|
|
7586
7292
|
const imageBox = {
|
|
7587
7293
|
x: -imageWidth / 2,
|
|
7588
7294
|
y: -imageHeight / 2,
|
|
7589
7295
|
width: imageWidth,
|
|
7590
7296
|
height: imageHeight
|
|
7591
7297
|
};
|
|
7298
|
+
const textBoxWidth = Math.max(imageWidth - ARC_TEXT_LEFT_PADDING, ARC_TEXT_BOX_MIN_WIDTH);
|
|
7592
7299
|
const textBox = {
|
|
7593
|
-
x: -imageWidth / 2 +
|
|
7594
|
-
y: imageBox.y + imageHeight +
|
|
7595
|
-
width:
|
|
7300
|
+
x: -imageWidth / 2 + ARC_TEXT_LEFT_PADDING,
|
|
7301
|
+
y: isDown ? imageBox.y + imageHeight + ARC_TEXT_GAP_FROM_IMAGE : imageBox.y - ARC_TEXT_GAP_FROM_IMAGE - textHeight,
|
|
7302
|
+
width: textBoxWidth,
|
|
7596
7303
|
height: textHeight
|
|
7597
7304
|
};
|
|
7598
7305
|
const contentBox = {
|
|
@@ -7608,23 +7315,28 @@
|
|
|
7608
7315
|
contentLineHeight,
|
|
7609
7316
|
imageBox,
|
|
7610
7317
|
textBox,
|
|
7611
|
-
contentBox
|
|
7318
|
+
contentBox,
|
|
7319
|
+
isDown
|
|
7612
7320
|
};
|
|
7613
7321
|
};
|
|
7614
|
-
const
|
|
7322
|
+
const buildArcBlockMark = (spec, block, index) => {
|
|
7615
7323
|
var _a, _b, _c, _e;
|
|
7616
7324
|
const hasImage = !!block.image;
|
|
7617
7325
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7618
7326
|
const themeColor = getThemeColor(spec);
|
|
7619
|
-
const metrics =
|
|
7327
|
+
const metrics = getArcBlockMetrics(spec);
|
|
7328
|
+
const connectorY = metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y;
|
|
7329
|
+
const connectorHeight = metrics.isDown
|
|
7330
|
+
? Math.max(metrics.textBox.y + metrics.textBox.height - (metrics.imageBox.y + metrics.imageBox.height), 0)
|
|
7331
|
+
: Math.max(metrics.imageBox.y - metrics.textBox.y, 0);
|
|
7620
7332
|
return {
|
|
7621
7333
|
type: 'group',
|
|
7622
7334
|
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
7623
7335
|
name: `storyline-block-${index}`,
|
|
7624
7336
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7625
7337
|
style: {
|
|
7626
|
-
x: (_d, ctx) =>
|
|
7627
|
-
y: (_d, ctx) =>
|
|
7338
|
+
x: (_d, ctx) => getArcBlockCenter(spec, ctx, index).x,
|
|
7339
|
+
y: (_d, ctx) => getArcBlockCenter(spec, ctx, index).y
|
|
7628
7340
|
},
|
|
7629
7341
|
children: [
|
|
7630
7342
|
{
|
|
@@ -7633,15 +7345,15 @@
|
|
|
7633
7345
|
interactive: false,
|
|
7634
7346
|
style: {
|
|
7635
7347
|
x: metrics.imageBox.x,
|
|
7636
|
-
y:
|
|
7348
|
+
y: connectorY,
|
|
7637
7349
|
width: 2,
|
|
7638
|
-
height:
|
|
7350
|
+
height: connectorHeight,
|
|
7639
7351
|
fill: themeColor,
|
|
7640
7352
|
fillOpacity: 0.6
|
|
7641
7353
|
}
|
|
7642
7354
|
},
|
|
7643
7355
|
hasImage
|
|
7644
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image,
|
|
7356
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7645
7357
|
: {
|
|
7646
7358
|
type: 'rect',
|
|
7647
7359
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7658,10 +7370,10 @@
|
|
|
7658
7370
|
}
|
|
7659
7371
|
},
|
|
7660
7372
|
block.title
|
|
7661
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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', textAlign: 'left', textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7373
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false }, 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: 'left', textBaseline: 'top' }, (_c = spec.title) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7662
7374
|
: null,
|
|
7663
7375
|
contentText.length
|
|
7664
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize:
|
|
7376
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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: buildRichContent(contentText, spec), fontSize: ARC_CONTENT_FONT_SIZE, lineHeight: ARC_CONTENT_LINE_HEIGHT, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_e = spec.content) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7665
7377
|
: null
|
|
7666
7378
|
].filter(Boolean)
|
|
7667
7379
|
};
|
|
@@ -7669,8 +7381,8 @@
|
|
|
7669
7381
|
|
|
7670
7382
|
const WING_BLOCK_IMAGE_SIZE = 96;
|
|
7671
7383
|
const WING_TEXT_GAP_FROM_IMAGE = 14;
|
|
7672
|
-
const WING_TITLE_LINE_HEIGHT =
|
|
7673
|
-
const WING_TITLE_FONT_SIZE =
|
|
7384
|
+
const WING_TITLE_LINE_HEIGHT = 30;
|
|
7385
|
+
const WING_TITLE_FONT_SIZE = 22;
|
|
7674
7386
|
const WING_CONTENT_LINE_HEIGHT = 17;
|
|
7675
7387
|
const WING_CONTENT_FONT_SIZE = 12;
|
|
7676
7388
|
const WING_TEXT_BOX_WIDTH = 240;
|
|
@@ -7824,14 +7536,15 @@
|
|
|
7824
7536
|
};
|
|
7825
7537
|
};
|
|
7826
7538
|
const buildWingBlockMark = (spec, block, index) => {
|
|
7827
|
-
var _a, _b, _c, _e;
|
|
7539
|
+
var _a, _b, _c, _e, _f;
|
|
7828
7540
|
const hasImage = !!block.image;
|
|
7829
7541
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7830
7542
|
const themeColor = getThemeColor(spec);
|
|
7831
7543
|
const metrics = getWingBlockMetrics(spec, index);
|
|
7544
|
+
const showBackground = ((_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
7832
7545
|
return {
|
|
7833
7546
|
type: 'group',
|
|
7834
|
-
id: `storyline-block-${(
|
|
7547
|
+
id: `storyline-block-${(_b = block.id) !== null && _b !== void 0 ? _b : index}`,
|
|
7835
7548
|
name: `storyline-block-${index}`,
|
|
7836
7549
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7837
7550
|
style: {
|
|
@@ -7839,22 +7552,24 @@
|
|
|
7839
7552
|
y: (_d, ctx) => getWingBlockCenter(spec, ctx, index).y
|
|
7840
7553
|
},
|
|
7841
7554
|
children: [
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7555
|
+
showBackground
|
|
7556
|
+
? {
|
|
7557
|
+
type: 'symbol',
|
|
7558
|
+
name: `storyline-block-image-halo-${index}`,
|
|
7559
|
+
interactive: false,
|
|
7560
|
+
style: {
|
|
7561
|
+
x: 0,
|
|
7562
|
+
y: 0,
|
|
7563
|
+
size: Math.max(metrics.imageBox.width, metrics.imageBox.height) + 12,
|
|
7564
|
+
symbolType: 'circle',
|
|
7565
|
+
fill: withAlpha(themeColor, 0.18),
|
|
7566
|
+
stroke: themeColor,
|
|
7567
|
+
lineWidth: 1.5
|
|
7568
|
+
}
|
|
7854
7569
|
}
|
|
7855
|
-
|
|
7570
|
+
: null,
|
|
7856
7571
|
hasImage
|
|
7857
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image,
|
|
7572
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_c = spec.image) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7858
7573
|
: {
|
|
7859
7574
|
type: 'rect',
|
|
7860
7575
|
name: `storyline-block-image-bg-${index}`,
|
|
@@ -7871,10 +7586,188 @@
|
|
|
7871
7586
|
}
|
|
7872
7587
|
},
|
|
7873
7588
|
block.title
|
|
7874
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: metrics.onLeft ? metrics.textBox.x + metrics.textBox.width : metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: themeColor, textAlign: metrics.onLeft ? 'right' : 'left', textBaseline: 'top' }, (
|
|
7589
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: metrics.onLeft ? metrics.textBox.x + metrics.textBox.width : metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.onLeft ? 'right' : 'left', textBaseline: 'top' }, (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7590
|
+
: null,
|
|
7591
|
+
contentText.length
|
|
7592
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.content), { textType: 'rich', style: Object.assign({ x: metrics.onLeft ? metrics.contentBox.x + metrics.contentBox.width : metrics.contentBox.x, y: metrics.contentBox.y, width: metrics.contentBox.width, height: metrics.contentBox.height, maxLineWidth: metrics.contentBox.width, heightLimit: metrics.contentBox.height, text: buildRichContent(contentText, spec), fontSize: WING_CONTENT_FONT_SIZE, lineHeight: WING_CONTENT_LINE_HEIGHT, textAlign: metrics.onLeft ? 'right' : 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7593
|
+
: null
|
|
7594
|
+
].filter(Boolean)
|
|
7595
|
+
};
|
|
7596
|
+
};
|
|
7597
|
+
|
|
7598
|
+
const LADDER_HEADLINE_FONT_RATIO = 0.42;
|
|
7599
|
+
const LADDER_HEADLINE_FONT_MIN = 80;
|
|
7600
|
+
const LADDER_HEADLINE_FONT_MAX = 240;
|
|
7601
|
+
const LADDER_DIAGONAL_LINE_WIDTH = 2;
|
|
7602
|
+
const LADDER_DIAGONAL_DASH = [12, 8];
|
|
7603
|
+
const LADDER_BLOCK_IMAGE_SIZE = 96;
|
|
7604
|
+
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7605
|
+
const LADDER_TITLE_LINE_HEIGHT = 36;
|
|
7606
|
+
const LADDER_CONTENT_FONT_SIZE = 16;
|
|
7607
|
+
const LADDER_CONTENT_LINE_HEIGHT = 24;
|
|
7608
|
+
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7609
|
+
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7610
|
+
var _a;
|
|
7611
|
+
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7612
|
+
const padding = normalizePadding((_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding);
|
|
7613
|
+
const innerX = startX + padding.left;
|
|
7614
|
+
const innerY = startY + padding.top;
|
|
7615
|
+
const innerW = Math.max(width - padding.left - padding.right, 1);
|
|
7616
|
+
const innerH = Math.max(height - padding.top - padding.bottom, 1);
|
|
7617
|
+
const isDown = isDownLadder(spec);
|
|
7618
|
+
const x0 = innerX;
|
|
7619
|
+
const x1 = innerX + innerW;
|
|
7620
|
+
const y0 = isDown ? innerY : innerY + innerH;
|
|
7621
|
+
const y1 = isDown ? innerY + innerH : innerY;
|
|
7622
|
+
const cx = (x0 + x1) / 2;
|
|
7623
|
+
const cy = (y0 + y1) / 2;
|
|
7624
|
+
const dx = x1 - x0;
|
|
7625
|
+
const dy = y1 - y0;
|
|
7626
|
+
const angleRad = (Math.atan2(dy, dx) / Math.PI) * 180;
|
|
7627
|
+
const fontSize = Math.max(LADDER_HEADLINE_FONT_MIN, Math.min(LADDER_HEADLINE_FONT_MAX, Math.round(innerH * LADDER_HEADLINE_FONT_RATIO)));
|
|
7628
|
+
return { x0, y0, x1, y1, cx, cy, angleRad, fontSize };
|
|
7629
|
+
};
|
|
7630
|
+
const getLadderHeadlineText = (spec) => {
|
|
7631
|
+
var _a, _b;
|
|
7632
|
+
const layoutOpt = normalizeLayout(spec.layout);
|
|
7633
|
+
if (typeof layoutOpt.headline === 'string' && layoutOpt.headline.length > 0) {
|
|
7634
|
+
return layoutOpt.headline;
|
|
7635
|
+
}
|
|
7636
|
+
const title = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.text;
|
|
7637
|
+
if (typeof title === 'string' && title.length > 0) {
|
|
7638
|
+
return title;
|
|
7639
|
+
}
|
|
7640
|
+
return 'storyline';
|
|
7641
|
+
};
|
|
7642
|
+
const buildLadderDiagonalMark = (spec) => {
|
|
7643
|
+
const themeColor = getThemeColor(spec);
|
|
7644
|
+
return {
|
|
7645
|
+
type: 'group',
|
|
7646
|
+
name: 'storyline-ladder-diagonal',
|
|
7647
|
+
zIndex: vchart.LayoutZIndex.Mark - 1,
|
|
7648
|
+
children: [
|
|
7649
|
+
{
|
|
7650
|
+
type: 'path',
|
|
7651
|
+
name: 'storyline-ladder-diagonal-line',
|
|
7652
|
+
interactive: false,
|
|
7653
|
+
style: {
|
|
7654
|
+
path: (_d, ctx) => {
|
|
7655
|
+
const g = getLadderDiagonalGeometry(spec, ctx);
|
|
7656
|
+
return `M ${g.x0} ${g.y0} L ${g.x1} ${g.y1}`;
|
|
7657
|
+
},
|
|
7658
|
+
stroke: withAlpha(themeColor, 0.85),
|
|
7659
|
+
lineWidth: LADDER_DIAGONAL_LINE_WIDTH,
|
|
7660
|
+
lineDash: LADDER_DIAGONAL_DASH,
|
|
7661
|
+
fill: 'transparent'
|
|
7662
|
+
}
|
|
7663
|
+
}
|
|
7664
|
+
]
|
|
7665
|
+
};
|
|
7666
|
+
};
|
|
7667
|
+
const buildLadderHeadlineMark = (spec) => {
|
|
7668
|
+
const text = getLadderHeadlineText(spec);
|
|
7669
|
+
if (!text) {
|
|
7670
|
+
return null;
|
|
7671
|
+
}
|
|
7672
|
+
const themeColor = getThemeColor(spec);
|
|
7673
|
+
return {
|
|
7674
|
+
type: 'group',
|
|
7675
|
+
name: 'storyline-ladder-headline',
|
|
7676
|
+
zIndex: vchart.LayoutZIndex.Mark,
|
|
7677
|
+
style: {
|
|
7678
|
+
x: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cx,
|
|
7679
|
+
y: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).cy,
|
|
7680
|
+
angle: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).angleRad
|
|
7681
|
+
},
|
|
7682
|
+
children: [
|
|
7683
|
+
{
|
|
7684
|
+
type: 'text',
|
|
7685
|
+
name: 'storyline-ladder-headline-text',
|
|
7686
|
+
interactive: false,
|
|
7687
|
+
style: {
|
|
7688
|
+
x: 0,
|
|
7689
|
+
y: 0,
|
|
7690
|
+
text,
|
|
7691
|
+
fontSize: (_d, ctx) => getLadderDiagonalGeometry(spec, ctx).fontSize,
|
|
7692
|
+
fontWeight: 900,
|
|
7693
|
+
fontFamily: 'Impact, "Arial Black", sans-serif',
|
|
7694
|
+
fill: withAlpha(themeColor, 0.92),
|
|
7695
|
+
textAlign: 'center',
|
|
7696
|
+
textBaseline: 'middle'
|
|
7697
|
+
}
|
|
7698
|
+
}
|
|
7699
|
+
]
|
|
7700
|
+
};
|
|
7701
|
+
};
|
|
7702
|
+
const isOnLeft = (index) => index % 2 === 1;
|
|
7703
|
+
const getLadderBlockMetrics = (spec, ctx, index) => {
|
|
7704
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
7705
|
+
const block = getLayout(spec, ctx).blocks[index];
|
|
7706
|
+
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
7707
|
+
const imagePosition = isOnLeft(index) ? 'right' : 'left';
|
|
7708
|
+
const imageWidth = (_e = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _e !== void 0 ? _e : LADDER_BLOCK_IMAGE_SIZE;
|
|
7709
|
+
const imageHeight = (_g = (_f = spec.image) === null || _f === void 0 ? void 0 : _f.height) !== null && _g !== void 0 ? _g : LADDER_BLOCK_IMAGE_SIZE;
|
|
7710
|
+
const imageGap = (_j = (_h = spec.image) === null || _h === void 0 ? void 0 : _h.gap) !== null && _j !== void 0 ? _j : DEFAULT_IMAGE_GAP;
|
|
7711
|
+
const hasImage = !!((_l = (_k = spec.data) === null || _k === void 0 ? void 0 : _k[index]) === null || _l === void 0 ? void 0 : _l.image);
|
|
7712
|
+
const titleFontSize = Number((_p = (_o = (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style) === null || _o === void 0 ? void 0 : _o.fontSize) !== null && _p !== void 0 ? _p : LADDER_TITLE_FONT_SIZE);
|
|
7713
|
+
const titleLineHeight = Number((_s = (_r = (_q = spec.title) === null || _q === void 0 ? void 0 : _q.style) === null || _r === void 0 ? void 0 : _r.lineHeight) !== null && _s !== void 0 ? _s : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
|
|
7714
|
+
const titleHeight = ((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t[index]) === null || _u === void 0 ? void 0 : _u.title) ? titleLineHeight : 0;
|
|
7715
|
+
const blockWidth = (_v = block === null || block === void 0 ? void 0 : block.width) !== null && _v !== void 0 ? _v : resolveBlockWidth(spec, 0);
|
|
7716
|
+
const blockHeight = (_y = (_w = block === null || block === void 0 ? void 0 : block.height) !== null && _w !== void 0 ? _w : (_x = spec.block) === null || _x === void 0 ? void 0 : _x.height) !== null && _y !== void 0 ? _y : DEFAULT_BLOCK_HEIGHT;
|
|
7717
|
+
const imageBox = getImageBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7718
|
+
const textBox = getTextBox(imagePosition, blockWidth, blockHeight, padding, imageWidth, imageHeight, imageGap, hasImage);
|
|
7719
|
+
const contentGap = ((_0 = (_z = spec.data) === null || _z === void 0 ? void 0 : _z[index]) === null || _0 === void 0 ? void 0 : _0.title) ? 8 : 0;
|
|
7720
|
+
return {
|
|
7721
|
+
block: { width: blockWidth, height: blockHeight },
|
|
7722
|
+
imageBox,
|
|
7723
|
+
textBox,
|
|
7724
|
+
contentBox: {
|
|
7725
|
+
y: textBox.y + titleHeight + contentGap,
|
|
7726
|
+
height: Math.max(0, textBox.height - titleHeight - contentGap)
|
|
7727
|
+
}
|
|
7728
|
+
};
|
|
7729
|
+
};
|
|
7730
|
+
const buildLadderBlockMark = (spec, block, index) => {
|
|
7731
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7732
|
+
const hasImage = !!block.image;
|
|
7733
|
+
const onLeft = isOnLeft(index);
|
|
7734
|
+
const align = onLeft ? 'right' : 'left';
|
|
7735
|
+
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7736
|
+
const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : LADDER_TITLE_FONT_SIZE);
|
|
7737
|
+
const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.round(titleFontSize * (LADDER_TITLE_LINE_HEIGHT / LADDER_TITLE_FONT_SIZE)));
|
|
7738
|
+
const showBackground = ((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7739
|
+
const getTitleX = (ctx) => {
|
|
7740
|
+
const m = getLadderBlockMetrics(spec, ctx, index);
|
|
7741
|
+
return align === 'right' ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7742
|
+
};
|
|
7743
|
+
return {
|
|
7744
|
+
type: 'group',
|
|
7745
|
+
id: `storyline-block-${(_j = block.id) !== null && _j !== void 0 ? _j : index}`,
|
|
7746
|
+
name: `storyline-block-${index}`,
|
|
7747
|
+
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7748
|
+
style: {
|
|
7749
|
+
x: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0; },
|
|
7750
|
+
y: (_d, ctx) => { var _a, _b; return (_b = (_a = getLayout(spec, ctx).blocks[index]) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0; },
|
|
7751
|
+
width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width,
|
|
7752
|
+
height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height
|
|
7753
|
+
},
|
|
7754
|
+
children: [
|
|
7755
|
+
showBackground
|
|
7756
|
+
? {
|
|
7757
|
+
type: 'rect',
|
|
7758
|
+
name: `storyline-block-bg-${index}`,
|
|
7759
|
+
interactive: false,
|
|
7760
|
+
style: Object.assign({ x: 0, y: 0, width: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.width, height: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).block.height, cornerRadius: 8, fill: '#ffffff', stroke: '#d7dce5', lineWidth: 1, shadowBlur: 6, shadowColor: 'rgba(0, 0, 0, 0.08)' }, (_k = spec.block) === null || _k === void 0 ? void 0 : _k.style)
|
|
7761
|
+
}
|
|
7762
|
+
: null,
|
|
7763
|
+
hasImage
|
|
7764
|
+
? 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 }, (_l = spec.image) === null || _l === void 0 ? void 0 : _l.style) })
|
|
7765
|
+
: null,
|
|
7766
|
+
block.title
|
|
7767
|
+
? 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: titleFontSize, lineHeight: titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textBaseline: 'top' }, (_m = spec.title) === null || _m === void 0 ? void 0 : _m.style), { textAlign: align }) })
|
|
7875
7768
|
: null,
|
|
7876
7769
|
contentText.length
|
|
7877
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false
|
|
7770
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false }, spec.content), { textType: 'rich', 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, text: buildRichContent(contentText, spec), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, fontSize: LADDER_CONTENT_FONT_SIZE, lineHeight: LADDER_CONTENT_LINE_HEIGHT, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style), { textAlign: align }) })
|
|
7878
7771
|
: null
|
|
7879
7772
|
].filter(Boolean)
|
|
7880
7773
|
};
|
|
@@ -7899,29 +7792,68 @@
|
|
|
7899
7792
|
var _a, _b, _c, _d;
|
|
7900
7793
|
const LARGE = 100;
|
|
7901
7794
|
const SMALL = 20;
|
|
7902
|
-
const
|
|
7903
|
-
const
|
|
7904
|
-
const
|
|
7795
|
+
const TEXT_RESERVE = 280;
|
|
7796
|
+
const PORTRAIT_BOTTOM_RESERVE = 160;
|
|
7797
|
+
const arc = isArc(spec);
|
|
7798
|
+
const arcDown = arc && normalizeLayout(spec.layout).direction === 'down';
|
|
7799
|
+
const arcUp = arc && !arcDown;
|
|
7800
|
+
const portrait = isPortrait(spec);
|
|
7801
|
+
const ladder = isLadder(spec);
|
|
7802
|
+
const ladderHorizontalPadding = (() => {
|
|
7803
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7804
|
+
if (!ladder) {
|
|
7805
|
+
return 0;
|
|
7806
|
+
}
|
|
7807
|
+
const blockWidth = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.minWidth) !== null && _b !== void 0 ? _b : resolveBlockWidth(spec, 0);
|
|
7808
|
+
const imageWidth = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : 96;
|
|
7809
|
+
const imageGap = (_f = (_e = spec.image) === null || _e === void 0 ? void 0 : _e.gap) !== null && _f !== void 0 ? _f : DEFAULT_IMAGE_GAP;
|
|
7810
|
+
const innerPadding = 12 * 2;
|
|
7811
|
+
const contentWidth = Math.max(blockWidth - imageWidth - imageGap - innerPadding, DEFAULT_BLOCK_WIDTH * 0.5);
|
|
7812
|
+
return Math.round(contentWidth * 2);
|
|
7813
|
+
})();
|
|
7814
|
+
const ladderVerticalPadding = (() => {
|
|
7815
|
+
var _a, _b;
|
|
7816
|
+
if (!ladder) {
|
|
7817
|
+
return 0;
|
|
7818
|
+
}
|
|
7819
|
+
const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 132;
|
|
7820
|
+
return Math.round(blockHeight * 3);
|
|
7821
|
+
})();
|
|
7822
|
+
const defaultTop = ladder ? ladderVerticalPadding : arcDown ? LARGE : arcUp ? TEXT_RESERVE : SMALL;
|
|
7823
|
+
const defaultBottom = ladder
|
|
7824
|
+
? ladderVerticalPadding
|
|
7825
|
+
: arcDown
|
|
7826
|
+
? TEXT_RESERVE
|
|
7827
|
+
: portrait
|
|
7828
|
+
? PORTRAIT_BOTTOM_RESERVE
|
|
7829
|
+
: LARGE;
|
|
7830
|
+
const defaultLeft = ladder ? ladderHorizontalPadding : SMALL;
|
|
7831
|
+
const defaultRight = ladder ? ladderHorizontalPadding : SMALL;
|
|
7905
7832
|
const p = spec.padding;
|
|
7906
7833
|
if (p === undefined || p === null) {
|
|
7907
|
-
spec.padding = [defaultTop,
|
|
7834
|
+
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
7908
7835
|
return;
|
|
7909
7836
|
}
|
|
7910
7837
|
if (typeof p === 'number') {
|
|
7911
|
-
spec.padding =
|
|
7838
|
+
spec.padding = [
|
|
7839
|
+
Math.max(p, defaultTop),
|
|
7840
|
+
Math.max(p, defaultRight),
|
|
7841
|
+
Math.max(p, defaultBottom),
|
|
7842
|
+
Math.max(p, defaultLeft)
|
|
7843
|
+
];
|
|
7912
7844
|
return;
|
|
7913
7845
|
}
|
|
7914
7846
|
if (Array.isArray(p)) {
|
|
7915
|
-
const [t, r =
|
|
7847
|
+
const [t, r = defaultRight, b, l = defaultLeft] = p;
|
|
7916
7848
|
spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
|
|
7917
7849
|
return;
|
|
7918
7850
|
}
|
|
7919
7851
|
if (typeof p === 'object') {
|
|
7920
7852
|
spec.padding = {
|
|
7921
7853
|
top: (_a = p.top) !== null && _a !== void 0 ? _a : defaultTop,
|
|
7922
|
-
right: (_b = p.right) !== null && _b !== void 0 ? _b :
|
|
7854
|
+
right: (_b = p.right) !== null && _b !== void 0 ? _b : defaultRight,
|
|
7923
7855
|
bottom: (_c = p.bottom) !== null && _c !== void 0 ? _c : defaultBottom,
|
|
7924
|
-
left: (_d = p.left) !== null && _d !== void 0 ? _d :
|
|
7856
|
+
left: (_d = p.left) !== null && _d !== void 0 ? _d : defaultLeft
|
|
7925
7857
|
};
|
|
7926
7858
|
}
|
|
7927
7859
|
};
|
|
@@ -7935,14 +7867,9 @@
|
|
|
7935
7867
|
if (isPortrait(spec)) {
|
|
7936
7868
|
return [lineMark, ...blockMarks].filter(Boolean);
|
|
7937
7869
|
}
|
|
7938
|
-
if (
|
|
7939
|
-
const centerImageMark =
|
|
7940
|
-
const arcMark =
|
|
7941
|
-
return [centerImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
7942
|
-
}
|
|
7943
|
-
if (isBowl(spec)) {
|
|
7944
|
-
const centerImageMark = buildBowlCenterImageMark(spec);
|
|
7945
|
-
const arcMark = buildBowlArcMark(spec);
|
|
7870
|
+
if (isArc(spec)) {
|
|
7871
|
+
const centerImageMark = buildArcCenterImageMark(spec);
|
|
7872
|
+
const arcMark = buildArcMark(spec);
|
|
7946
7873
|
return [centerImageMark, arcMark, ...blockMarks].filter(Boolean);
|
|
7947
7874
|
}
|
|
7948
7875
|
if (isClock(spec)) {
|
|
@@ -7954,6 +7881,11 @@
|
|
|
7954
7881
|
const arcMark = buildWingArcMark(spec);
|
|
7955
7882
|
return [arcMark, ...blockMarks].filter(Boolean);
|
|
7956
7883
|
}
|
|
7884
|
+
if (isLadder(spec)) {
|
|
7885
|
+
const diagonalMark = buildLadderDiagonalMark(spec);
|
|
7886
|
+
const headlineMark = buildLadderHeadlineMark(spec);
|
|
7887
|
+
return [diagonalMark, headlineMark, ...blockMarks].filter(Boolean);
|
|
7888
|
+
}
|
|
7957
7889
|
return [lineMark, ...blockMarks].filter(Boolean);
|
|
7958
7890
|
};
|
|
7959
7891
|
const buildLineMark = (spec) => {
|
|
@@ -7976,11 +7908,8 @@
|
|
|
7976
7908
|
if (isPortrait(spec)) {
|
|
7977
7909
|
return buildPortraitBlockMark(spec, block, index);
|
|
7978
7910
|
}
|
|
7979
|
-
if (
|
|
7980
|
-
return
|
|
7981
|
-
}
|
|
7982
|
-
if (isBowl(spec)) {
|
|
7983
|
-
return buildBowlBlockMark(spec, block, index);
|
|
7911
|
+
if (isArc(spec)) {
|
|
7912
|
+
return buildArcBlockMark(spec, block, index);
|
|
7984
7913
|
}
|
|
7985
7914
|
if (isClock(spec)) {
|
|
7986
7915
|
return buildClockBlockMark(spec, block, index);
|
|
@@ -7988,6 +7917,9 @@
|
|
|
7988
7917
|
if (isWing(spec)) {
|
|
7989
7918
|
return buildWingBlockMark(spec, block, index);
|
|
7990
7919
|
}
|
|
7920
|
+
if (isLadder(spec)) {
|
|
7921
|
+
return buildLadderBlockMark(spec, block, index);
|
|
7922
|
+
}
|
|
7991
7923
|
return buildDefaultBlockMark(spec, block, index);
|
|
7992
7924
|
};
|
|
7993
7925
|
|