@visactor/vchart-extension 2.1.0-alpha.19 → 2.1.0-alpha.20
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 +458 -216
- package/build/index.min.js +2 -2
- package/cjs/charts/axis-3d/index.js +1 -2
- package/cjs/charts/axis-3d/linear-axis.js +2 -1
- package/cjs/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/chart.js +1 -1
- package/cjs/charts/bar-3d/constant.js +1 -1
- package/cjs/charts/bar-3d/index.js +1 -1
- package/cjs/charts/bar-3d/interface.js +1 -1
- package/cjs/charts/bar-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/bar-3d/series.js +1 -1
- package/cjs/charts/bar-3d/theme.js +1 -1
- package/cjs/charts/candlestick/candlestick-transformer.js +1 -1
- package/cjs/charts/candlestick/candlestick.js +2 -1
- package/cjs/charts/candlestick/index.js +1 -1
- package/cjs/charts/candlestick/interface.js +1 -1
- package/cjs/charts/candlestick/util.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/cjs/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/cjs/charts/combination-candlestick/constant.js +1 -1
- package/cjs/charts/combination-candlestick/index.js +1 -1
- package/cjs/charts/combination-candlestick/interface.js +1 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +2 -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 +1 -1
- package/cjs/charts/storyline/interface.d.ts +2 -0
- package/cjs/charts/storyline/interface.js.map +1 -1
- package/cjs/charts/storyline/layout.d.ts +6 -1
- package/cjs/charts/storyline/layout.js +8 -2
- package/cjs/charts/storyline/layout.js.map +1 -1
- package/cjs/charts/storyline/layouts/arc.js +86 -54
- package/cjs/charts/storyline/layouts/arc.js.map +1 -1
- package/cjs/charts/storyline/layouts/clock.js +25 -23
- package/cjs/charts/storyline/layouts/clock.js.map +1 -1
- package/cjs/charts/storyline/layouts/common.d.ts +11 -2
- package/cjs/charts/storyline/layouts/common.js +21 -19
- package/cjs/charts/storyline/layouts/common.js.map +1 -1
- package/cjs/charts/storyline/layouts/default.js +12 -10
- package/cjs/charts/storyline/layouts/default.js.map +1 -1
- package/cjs/charts/storyline/layouts/ladder.js +8 -6
- package/cjs/charts/storyline/layouts/ladder.js.map +1 -1
- package/cjs/charts/storyline/layouts/landscape.js +9 -7
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -1
- package/cjs/charts/storyline/layouts/portrait.d.ts +7 -0
- package/cjs/charts/storyline/layouts/portrait.js +81 -25
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -1
- package/cjs/charts/storyline/layouts/wing.js +109 -52
- package/cjs/charts/storyline/layouts/wing.js.map +1 -1
- package/cjs/charts/storyline/storyline-transformer.js +21 -8
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/bar-regression-line/index.js +1 -1
- package/cjs/components/bar-regression-line/type.js +1 -1
- package/cjs/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/cjs/components/extension-mark-sync-state/index.js +1 -1
- package/cjs/components/extension-mark-sync-state/type.js +1 -1
- package/cjs/components/histogram-regression-line/index.js +1 -1
- package/cjs/components/histogram-regression-line/type.js +1 -2
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/regression-line/index.js +1 -1
- package/cjs/components/regression-line/regression-line.js +1 -1
- package/cjs/components/regression-line/type.js +1 -1
- package/cjs/components/scatter-regression-line/index.js +1 -1
- package/cjs/components/scatter-regression-line/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -1
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +1 -2
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/axis-3d/index.js +1 -2
- package/esm/charts/axis-3d/linear-axis.js +2 -1
- package/esm/charts/bar-3d/chart-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/chart.js +1 -1
- package/esm/charts/bar-3d/constant.js +1 -1
- package/esm/charts/bar-3d/index.js +1 -1
- package/esm/charts/bar-3d/interface.js +1 -1
- package/esm/charts/bar-3d/series-spec-transformer.js +1 -1
- package/esm/charts/bar-3d/series.js +1 -1
- package/esm/charts/bar-3d/theme.js +1 -1
- package/esm/charts/candlestick/candlestick-transformer.js +1 -1
- package/esm/charts/candlestick/candlestick.js +2 -1
- package/esm/charts/candlestick/index.js +1 -1
- package/esm/charts/candlestick/interface.js +1 -1
- package/esm/charts/candlestick/util.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick-transformer.js +1 -1
- package/esm/charts/combination-candlestick/combination-candlestick.js +1 -1
- package/esm/charts/combination-candlestick/constant.js +1 -1
- package/esm/charts/combination-candlestick/index.js +1 -1
- package/esm/charts/combination-candlestick/interface.js +1 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +2 -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 +1 -1
- package/esm/charts/storyline/interface.d.ts +2 -0
- package/esm/charts/storyline/interface.js.map +1 -1
- package/esm/charts/storyline/layout.d.ts +6 -1
- package/esm/charts/storyline/layout.js +8 -2
- package/esm/charts/storyline/layout.js.map +1 -1
- package/esm/charts/storyline/layouts/arc.js +86 -52
- package/esm/charts/storyline/layouts/arc.js.map +1 -1
- package/esm/charts/storyline/layouts/clock.js +25 -23
- package/esm/charts/storyline/layouts/clock.js.map +1 -1
- package/esm/charts/storyline/layouts/common.d.ts +11 -2
- package/esm/charts/storyline/layouts/common.js +20 -19
- package/esm/charts/storyline/layouts/common.js.map +1 -1
- package/esm/charts/storyline/layouts/default.js +12 -10
- package/esm/charts/storyline/layouts/default.js.map +1 -1
- package/esm/charts/storyline/layouts/ladder.js +8 -6
- package/esm/charts/storyline/layouts/ladder.js.map +1 -1
- package/esm/charts/storyline/layouts/landscape.js +9 -7
- package/esm/charts/storyline/layouts/landscape.js.map +1 -1
- package/esm/charts/storyline/layouts/portrait.d.ts +7 -0
- package/esm/charts/storyline/layouts/portrait.js +83 -20
- package/esm/charts/storyline/layouts/portrait.js.map +1 -1
- package/esm/charts/storyline/layouts/wing.js +109 -51
- package/esm/charts/storyline/layouts/wing.js.map +1 -1
- package/esm/charts/storyline/storyline-transformer.js +22 -10
- package/esm/charts/storyline/storyline-transformer.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/bar-regression-line/index.js +1 -1
- package/esm/components/bar-regression-line/type.js +1 -1
- package/esm/components/extension-mark-sync-state/extension-mark-sync-state.js +1 -1
- package/esm/components/extension-mark-sync-state/index.js +1 -1
- package/esm/components/extension-mark-sync-state/type.js +1 -1
- package/esm/components/histogram-regression-line/index.js +1 -1
- package/esm/components/histogram-regression-line/type.js +1 -2
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/regression-line/index.js +1 -1
- package/esm/components/regression-line/regression-line.js +1 -1
- package/esm/components/regression-line/type.js +1 -1
- package/esm/components/scatter-regression-line/index.js +1 -1
- package/esm/components/scatter-regression-line/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -1
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +1 -2
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +4 -4
package/build/index.js
CHANGED
|
@@ -5825,7 +5825,7 @@
|
|
|
5825
5825
|
const DEFAULT_LAYOUT = 'landscape';
|
|
5826
5826
|
const DEFAULT_PADDING = 24;
|
|
5827
5827
|
const normalizePadding = (padding) => {
|
|
5828
|
-
var _a, _b, _c, _d;
|
|
5828
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5829
5829
|
if (Array.isArray(padding)) {
|
|
5830
5830
|
return {
|
|
5831
5831
|
top: (_a = padding[0]) !== null && _a !== void 0 ? _a : 0,
|
|
@@ -5834,7 +5834,15 @@
|
|
|
5834
5834
|
left: (_d = padding[3]) !== null && _d !== void 0 ? _d : 0
|
|
5835
5835
|
};
|
|
5836
5836
|
}
|
|
5837
|
-
|
|
5837
|
+
if (padding && typeof padding === 'object' && 'top' in padding) {
|
|
5838
|
+
return {
|
|
5839
|
+
top: (_e = padding.top) !== null && _e !== void 0 ? _e : 0,
|
|
5840
|
+
right: (_f = padding.right) !== null && _f !== void 0 ? _f : 0,
|
|
5841
|
+
bottom: (_g = padding.bottom) !== null && _g !== void 0 ? _g : 0,
|
|
5842
|
+
left: (_h = padding.left) !== null && _h !== void 0 ? _h : 0
|
|
5843
|
+
};
|
|
5844
|
+
}
|
|
5845
|
+
const value = (_j = padding) !== null && _j !== void 0 ? _j : DEFAULT_PADDING;
|
|
5838
5846
|
return { top: value, right: value, bottom: value, left: value };
|
|
5839
5847
|
};
|
|
5840
5848
|
const normalizeLayout = (layout) => {
|
|
@@ -6114,27 +6122,27 @@
|
|
|
6114
6122
|
const maxWidth = (_g = (_f = spec.block) === null || _f === void 0 ? void 0 : _f.maxWidth) !== null && _g !== void 0 ? _g : Math.max(minWidth, 320);
|
|
6115
6123
|
return Math.max(minWidth, Math.min(maxWidth, Math.round(viewWidth * ratio)));
|
|
6116
6124
|
};
|
|
6117
|
-
const getRegionGeometry = (ctx) => {
|
|
6118
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6125
|
+
const getRegionGeometry = (ctx, spec) => {
|
|
6126
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
6119
6127
|
const region = (_c = (_b = (_a = ctx.chart) === null || _a === void 0 ? void 0 : _a.getAllRegions) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c[0];
|
|
6120
6128
|
const regionRect = (_d = region === null || region === void 0 ? void 0 : region.getLayoutRect) === null || _d === void 0 ? void 0 : _d.call(region);
|
|
6121
6129
|
const regionStart = (_e = region === null || region === void 0 ? void 0 : region.getLayoutStartPoint) === null || _e === void 0 ? void 0 : _e.call(region);
|
|
6122
6130
|
const chartRect = (_g = (_f = ctx.chart) === null || _f === void 0 ? void 0 : _f.getLayoutRect) === null || _g === void 0 ? void 0 : _g.call(_f);
|
|
6123
6131
|
const bounds = (_h = ctx.getLayoutBounds) === null || _h === void 0 ? void 0 : _h.call(ctx);
|
|
6124
|
-
const width = Math.max((_m = (_k = (_j = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _j !== void 0 ? _j : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _k !== void 0 ? _k : (_l = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _l === void 0 ? void 0 : _l.call(bounds)) !== null && _m !== void 0 ? _m : 0, 1);
|
|
6125
|
-
const height = Math.max((
|
|
6132
|
+
const width = Math.max((_o = (_m = (_k = (_j = regionRect === null || regionRect === void 0 ? void 0 : regionRect.width) !== null && _j !== void 0 ? _j : chartRect === null || chartRect === void 0 ? void 0 : chartRect.width) !== null && _k !== void 0 ? _k : (_l = bounds === null || bounds === void 0 ? void 0 : bounds.width) === null || _l === void 0 ? void 0 : _l.call(bounds)) !== null && _m !== void 0 ? _m : spec === null || spec === void 0 ? void 0 : spec.width) !== null && _o !== void 0 ? _o : 0, 1);
|
|
6133
|
+
const height = Math.max((_t = (_s = (_q = (_p = regionRect === null || regionRect === void 0 ? void 0 : regionRect.height) !== null && _p !== void 0 ? _p : chartRect === null || chartRect === void 0 ? void 0 : chartRect.height) !== null && _q !== void 0 ? _q : (_r = bounds === null || bounds === void 0 ? void 0 : bounds.height) === null || _r === void 0 ? void 0 : _r.call(bounds)) !== null && _s !== void 0 ? _s : spec === null || spec === void 0 ? void 0 : spec.height) !== null && _t !== void 0 ? _t : 0, 1);
|
|
6126
6134
|
return {
|
|
6127
6135
|
width,
|
|
6128
6136
|
height,
|
|
6129
|
-
startX: (
|
|
6130
|
-
startY: (
|
|
6137
|
+
startX: (_u = regionStart === null || regionStart === void 0 ? void 0 : regionStart.x) !== null && _u !== void 0 ? _u : 0,
|
|
6138
|
+
startY: (_v = regionStart === null || regionStart === void 0 ? void 0 : regionStart.y) !== null && _v !== void 0 ? _v : 0
|
|
6131
6139
|
};
|
|
6132
6140
|
};
|
|
6133
6141
|
const getLayout = (spec, ctx) => {
|
|
6134
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
6135
|
-
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
6142
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6143
|
+
const { width, height, startX, startY } = getRegionGeometry(ctx, spec);
|
|
6136
6144
|
let blockWidth = resolveBlockWidth(spec, width);
|
|
6137
|
-
let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : DEFAULT_BLOCK_HEIGHT;
|
|
6145
|
+
let blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : (isLandscape(spec) ? 320 : DEFAULT_BLOCK_HEIGHT);
|
|
6138
6146
|
if (isLandscape(spec) && !((_c = spec.block) === null || _c === void 0 ? void 0 : _c.width)) {
|
|
6139
6147
|
const count = (_e = (_d = spec.data) === null || _d === void 0 ? void 0 : _d.length) !== null && _e !== void 0 ? _e : 0;
|
|
6140
6148
|
if (count > 0) {
|
|
@@ -6150,21 +6158,21 @@
|
|
|
6150
6158
|
if (isPortrait(spec) && !((_g = spec.block) === null || _g === void 0 ? void 0 : _g.height)) {
|
|
6151
6159
|
const count = (_j = (_h = spec.data) === null || _h === void 0 ? void 0 : _h.length) !== null && _j !== void 0 ? _j : 0;
|
|
6152
6160
|
if (count > 0) {
|
|
6153
|
-
const padding = normalizePadding((_k = spec.
|
|
6161
|
+
const padding = normalizePadding((_l = (_k = spec.layout) === null || _k === void 0 ? void 0 : _k.padding) !== null && _l !== void 0 ? _l : (_m = spec.block) === null || _m === void 0 ? void 0 : _m.padding);
|
|
6154
6162
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
6155
|
-
blockHeight = Math.max(
|
|
6163
|
+
blockHeight = Math.max(120, Math.floor(innerHeight / (count + 1)));
|
|
6156
6164
|
}
|
|
6157
6165
|
}
|
|
6158
|
-
const result = computeStorylineLayout((
|
|
6166
|
+
const result = computeStorylineLayout((_o = spec.data) !== null && _o !== void 0 ? _o : [], {
|
|
6159
6167
|
layout: spec.layout,
|
|
6160
6168
|
viewBox: { width, height },
|
|
6161
6169
|
block: {
|
|
6162
6170
|
width: blockWidth,
|
|
6163
6171
|
height: blockHeight
|
|
6164
6172
|
},
|
|
6165
|
-
gap: (
|
|
6166
|
-
padding: (
|
|
6167
|
-
lineDistance: (
|
|
6173
|
+
gap: (_q = (_p = spec.block) === null || _p === void 0 ? void 0 : _p.gap) !== null && _q !== void 0 ? _q : DEFAULT_BLOCK_GAP,
|
|
6174
|
+
padding: (_r = spec.block) === null || _r === void 0 ? void 0 : _r.padding,
|
|
6175
|
+
lineDistance: (_s = spec.line) === null || _s === void 0 ? void 0 : _s.distance
|
|
6168
6176
|
});
|
|
6169
6177
|
if (!startX && !startY) {
|
|
6170
6178
|
return result;
|
|
@@ -6174,11 +6182,12 @@
|
|
|
6174
6182
|
y: block.center.y + startY
|
|
6175
6183
|
} }))), links: result.links.map(link => (Object.assign(Object.assign({}, link), { start: { x: link.start.x + startX, y: link.start.y + startY }, end: { x: link.end.x + startX, y: link.end.y + startY }, points: link.points.map(point => ({ x: point.x + startX, y: point.y + startY })) }))) });
|
|
6176
6184
|
};
|
|
6177
|
-
const buildRichContent = (contentText, spec) => {
|
|
6178
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6179
|
-
const fontSize = Number((
|
|
6180
|
-
const lineHeight = Number((
|
|
6181
|
-
const fill = (_j = (
|
|
6185
|
+
const buildRichContent = (contentText, spec, overrides) => {
|
|
6186
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
6187
|
+
const fontSize = Number((_d = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fontSize) !== null && _a !== void 0 ? _a : (_c = (_b = spec.content) === null || _b === void 0 ? void 0 : _b.style) === null || _c === void 0 ? void 0 : _c.fontSize) !== null && _d !== void 0 ? _d : 18);
|
|
6188
|
+
const lineHeight = Number((_h = (_e = overrides === null || overrides === void 0 ? void 0 : overrides.lineHeight) !== null && _e !== void 0 ? _e : (_g = (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) === null || _g === void 0 ? void 0 : _g.lineHeight) !== null && _h !== void 0 ? _h : 26);
|
|
6189
|
+
const fill = (_m = (_j = overrides === null || overrides === void 0 ? void 0 : overrides.fill) !== null && _j !== void 0 ? _j : (_l = (_k = spec.content) === null || _k === void 0 ? void 0 : _k.style) === null || _l === void 0 ? void 0 : _l.fill) !== null && _m !== void 0 ? _m : '#596173';
|
|
6190
|
+
const align = (_o = overrides === null || overrides === void 0 ? void 0 : overrides.align) !== null && _o !== void 0 ? _o : 'left';
|
|
6182
6191
|
return {
|
|
6183
6192
|
type: 'rich',
|
|
6184
6193
|
text: contentText.reduce((result, paragraph, index) => {
|
|
@@ -6187,7 +6196,8 @@
|
|
|
6187
6196
|
text: `${paragraph}${suffix}`,
|
|
6188
6197
|
fontSize,
|
|
6189
6198
|
lineHeight,
|
|
6190
|
-
fill
|
|
6199
|
+
fill,
|
|
6200
|
+
align
|
|
6191
6201
|
});
|
|
6192
6202
|
return result;
|
|
6193
6203
|
}, [])
|
|
@@ -6280,20 +6290,20 @@
|
|
|
6280
6290
|
return d;
|
|
6281
6291
|
};
|
|
6282
6292
|
|
|
6283
|
-
const CLOCK_CENTER_RADIUS_RATIO = 0.
|
|
6284
|
-
const CLOCK_CENTER_IMAGE_INSET_RATIO = 0.
|
|
6285
|
-
const CLOCK_ORBIT_RATIO = 0.
|
|
6286
|
-
const CLOCK_DOT_RATIO = 0.
|
|
6287
|
-
const CLOCK_TEXT_INNER_RATIO = 0.
|
|
6288
|
-
const CLOCK_TEXT_MAX_WIDTH =
|
|
6289
|
-
const CLOCK_DOT_DIAMETER_RATIO = 0.
|
|
6293
|
+
const CLOCK_CENTER_RADIUS_RATIO = 0.6;
|
|
6294
|
+
const CLOCK_CENTER_IMAGE_INSET_RATIO = 0.9;
|
|
6295
|
+
const CLOCK_ORBIT_RATIO = 0.68;
|
|
6296
|
+
const CLOCK_DOT_RATIO = 0.68;
|
|
6297
|
+
const CLOCK_TEXT_INNER_RATIO = 0.92;
|
|
6298
|
+
const CLOCK_TEXT_MAX_WIDTH = 280;
|
|
6299
|
+
const CLOCK_DOT_DIAMETER_RATIO = 0.32;
|
|
6290
6300
|
const CLOCK_LEAD_LINE_GAP = 6;
|
|
6291
6301
|
const CLOCK_TEXT_GAP_FROM_LEAD = 8;
|
|
6292
6302
|
const CLOCK_ORBIT_DASH = [4, 4];
|
|
6293
|
-
const CLOCK_TITLE_FONT_SIZE =
|
|
6294
|
-
const CLOCK_TITLE_LINE_HEIGHT =
|
|
6295
|
-
const CLOCK_CONTENT_FONT_SIZE =
|
|
6296
|
-
const CLOCK_CONTENT_LINE_HEIGHT =
|
|
6303
|
+
const CLOCK_TITLE_FONT_SIZE = 22;
|
|
6304
|
+
const CLOCK_TITLE_LINE_HEIGHT = 28;
|
|
6305
|
+
const CLOCK_CONTENT_FONT_SIZE = 16;
|
|
6306
|
+
const CLOCK_CONTENT_LINE_HEIGHT = 22;
|
|
6297
6307
|
const getClockGeometry = (spec, ctx) => {
|
|
6298
6308
|
var _a, _b, _c;
|
|
6299
6309
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
@@ -6302,7 +6312,11 @@
|
|
|
6302
6312
|
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
6303
6313
|
const cx = startX + padding.left + innerWidth / 2;
|
|
6304
6314
|
const cy = startY + padding.top + innerHeight / 2;
|
|
6305
|
-
const
|
|
6315
|
+
const textReserveX = CLOCK_TEXT_MAX_WIDTH;
|
|
6316
|
+
const textReserveY = 4 + CLOCK_CONTENT_LINE_HEIGHT * 4;
|
|
6317
|
+
const rMaxX = (innerWidth / 2 - textReserveX) / CLOCK_TEXT_INNER_RATIO;
|
|
6318
|
+
const rMaxY = (innerHeight / 2 - textReserveY) / CLOCK_TEXT_INNER_RATIO;
|
|
6319
|
+
const R = Math.max(Math.min(rMaxX, rMaxY), 1);
|
|
6306
6320
|
const count = (_c = (_b = spec.data) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
6307
6321
|
const step = count > 0 ? (Math.PI * 2) / count : 0;
|
|
6308
6322
|
return { cx, cy, R, count, step };
|
|
@@ -6352,7 +6366,7 @@
|
|
|
6352
6366
|
}, y: (_d, ctx) => {
|
|
6353
6367
|
const g = getClockGeometry(spec, ctx);
|
|
6354
6368
|
return g.cy - g.R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO;
|
|
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) => {
|
|
6369
|
+
}, 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', cornerRadius: (_d, ctx) => getClockGeometry(spec, ctx).R * CLOCK_CENTER_RADIUS_RATIO * CLOCK_CENTER_IMAGE_INSET_RATIO, anchor: (_d, ctx) => {
|
|
6356
6370
|
const g = getClockGeometry(spec, ctx);
|
|
6357
6371
|
return [g.cx, g.cy];
|
|
6358
6372
|
}, dx: (_d, ctx) => {
|
|
@@ -6493,7 +6507,8 @@
|
|
|
6493
6507
|
repeatX: 'no-repeat',
|
|
6494
6508
|
repeatY: 'no-repeat',
|
|
6495
6509
|
imageMode: 'cover',
|
|
6496
|
-
imagePosition: 'center'
|
|
6510
|
+
imagePosition: 'center',
|
|
6511
|
+
cornerRadius: (_d, ctx) => getClockDotCenter(spec, ctx, index).diameter / 2
|
|
6497
6512
|
}
|
|
6498
6513
|
}
|
|
6499
6514
|
: {
|
|
@@ -6579,7 +6594,7 @@
|
|
|
6579
6594
|
};
|
|
6580
6595
|
};
|
|
6581
6596
|
const buildDefaultBlockMark = (spec, block, index) => {
|
|
6582
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
6597
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
6583
6598
|
const hasImage = !!block.image;
|
|
6584
6599
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
6585
6600
|
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);
|
|
@@ -6596,20 +6611,26 @@
|
|
|
6596
6611
|
height: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).block.height
|
|
6597
6612
|
},
|
|
6598
6613
|
children: [
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6614
|
+
((_h = spec.block) === null || _h === void 0 ? void 0 : _h.showBackground) === true
|
|
6615
|
+
? {
|
|
6616
|
+
type: 'rect',
|
|
6617
|
+
name: `storyline-block-bg-${index}`,
|
|
6618
|
+
interactive: false,
|
|
6619
|
+
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)' }, (_j = spec.block) === null || _j === void 0 ? void 0 : _j.style)
|
|
6620
|
+
}
|
|
6621
|
+
: null,
|
|
6605
6622
|
hasImage
|
|
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 }, (
|
|
6623
|
+
? 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 }, (_k = spec.image) === null || _k === void 0 ? void 0 : _k.style) })
|
|
6607
6624
|
: null,
|
|
6608
6625
|
block.title
|
|
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' }, (
|
|
6626
|
+
? 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' }, (_l = spec.title) === null || _l === void 0 ? void 0 : _l.style) })
|
|
6610
6627
|
: null,
|
|
6611
6628
|
contentText.length
|
|
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
|
|
6629
|
+
? 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, {
|
|
6630
|
+
fontSize: 18,
|
|
6631
|
+
lineHeight: 26,
|
|
6632
|
+
fill: '#596173'
|
|
6633
|
+
}), maxLineWidth: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_datum, ctx) => getDefaultBlockMetrics(spec, ctx, index).contentBox.height, textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_m = spec.content) === null || _m === void 0 ? void 0 : _m.style) })
|
|
6613
6634
|
: null
|
|
6614
6635
|
].filter(Boolean)
|
|
6615
6636
|
};
|
|
@@ -6659,10 +6680,10 @@
|
|
|
6659
6680
|
const LANDSCAPE_CONNECTOR_ARROW_SIZE = 9;
|
|
6660
6681
|
const LANDSCAPE_CONNECTOR_X_RATIO = 0.2;
|
|
6661
6682
|
const LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12;
|
|
6662
|
-
const LANDSCAPE_CONTENT_LINES =
|
|
6663
|
-
const LANDSCAPE_TITLE_LINE_HEIGHT =
|
|
6664
|
-
const LANDSCAPE_CONTENT_LINE_HEIGHT =
|
|
6665
|
-
const LANDSCAPE_CONTENT_FONT_SIZE =
|
|
6683
|
+
const LANDSCAPE_CONTENT_LINES = 10;
|
|
6684
|
+
const LANDSCAPE_TITLE_LINE_HEIGHT = 34;
|
|
6685
|
+
const LANDSCAPE_CONTENT_LINE_HEIGHT = 26;
|
|
6686
|
+
const LANDSCAPE_CONTENT_FONT_SIZE = 18;
|
|
6666
6687
|
const LANDSCAPE_TITLE_TO_CONTENT_GAP = 4;
|
|
6667
6688
|
const getLandscapeImageCenter = (spec, ctx, index) => {
|
|
6668
6689
|
var _a, _b, _c, _e;
|
|
@@ -6732,13 +6753,16 @@
|
|
|
6732
6753
|
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6733
6754
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
6734
6755
|
const padding = normalizePadding((_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.padding) !== null && _b !== void 0 ? _b : 12);
|
|
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 :
|
|
6756
|
+
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 : 26);
|
|
6736
6757
|
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)));
|
|
6737
6758
|
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);
|
|
6738
6759
|
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);
|
|
6739
6760
|
const imageHeight = Math.max((_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : Math.round(blockHeight * LANDSCAPE_IMAGE_HEIGHT_RATIO), titleLineHeight + padding.top + padding.bottom);
|
|
6740
6761
|
const connectorGap = LANDSCAPE_DETACHED_GAP;
|
|
6741
|
-
const
|
|
6762
|
+
const canvasHeight = spec.height;
|
|
6763
|
+
const contentHeight = canvasHeight
|
|
6764
|
+
? Math.max(contentLineHeight * 2, Math.round(canvasHeight / 4))
|
|
6765
|
+
: LANDSCAPE_CONTENT_LINES * contentLineHeight;
|
|
6742
6766
|
const titleToContentGap = LANDSCAPE_TITLE_TO_CONTENT_GAP;
|
|
6743
6767
|
const textHeight = titleLineHeight + titleToContentGap + contentHeight;
|
|
6744
6768
|
const textOnTop = index % 2 === 0;
|
|
@@ -6807,7 +6831,7 @@
|
|
|
6807
6831
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
6808
6832
|
const hasImage = !!block.image;
|
|
6809
6833
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
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 :
|
|
6834
|
+
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 : 26);
|
|
6811
6835
|
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));
|
|
6812
6836
|
const getMetrics = (ctx) => {
|
|
6813
6837
|
var _a, _b, _c, _e;
|
|
@@ -6839,7 +6863,7 @@
|
|
|
6839
6863
|
const m = getMetrics(ctx);
|
|
6840
6864
|
const cy = (_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : ((_c = lb === null || lb === void 0 ? void 0 : lb.y) !== null && _c !== void 0 ? _c : 0) + ((_e = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _e !== void 0 ? _e : 0) / 2;
|
|
6841
6865
|
const blockH = (_h = (_f = lb === null || lb === void 0 ? void 0 : lb.height) !== null && _f !== void 0 ? _f : (_g = spec.block) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : DEFAULT_BLOCK_HEIGHT;
|
|
6842
|
-
const stagger =
|
|
6866
|
+
const stagger = m.textOnTop ? blockH * 0.1 : -blockH * 0.1;
|
|
6843
6867
|
return cy - m.imageBox.height / 2 + stagger;
|
|
6844
6868
|
},
|
|
6845
6869
|
width: (_d, ctx) => getMetrics(ctx).blockWidth,
|
|
@@ -6882,25 +6906,32 @@
|
|
|
6882
6906
|
? 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) })
|
|
6883
6907
|
: null,
|
|
6884
6908
|
contentText.length
|
|
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
|
|
6909
|
+
? 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, {
|
|
6910
|
+
fontSize: LANDSCAPE_CONTENT_FONT_SIZE,
|
|
6911
|
+
lineHeight: LANDSCAPE_CONTENT_LINE_HEIGHT,
|
|
6912
|
+
fill: '#596173'
|
|
6913
|
+
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_t = spec.content) === null || _t === void 0 ? void 0 : _t.style) })
|
|
6886
6914
|
: null
|
|
6887
6915
|
].filter(Boolean)
|
|
6888
6916
|
};
|
|
6889
6917
|
};
|
|
6890
6918
|
|
|
6891
|
-
const PORTRAIT_AXIS_WIDTH =
|
|
6919
|
+
const PORTRAIT_AXIS_WIDTH = 96;
|
|
6892
6920
|
const PORTRAIT_AXIS_PADDING = 50;
|
|
6893
|
-
const
|
|
6894
|
-
const
|
|
6921
|
+
const PORTRAIT_MARKER_FONT_SIZE = 40;
|
|
6922
|
+
const PORTRAIT_MARKER_LINE_HEIGHT = 28;
|
|
6923
|
+
const PORTRAIT_MARKER_AXIS_PADDING = 6;
|
|
6924
|
+
const PORTRAIT_IMAGE_HEIGHT_RATIO = 0.6;
|
|
6925
|
+
const PORTRAIT_CONTENT_HEIGHT_RATIO = 1;
|
|
6895
6926
|
const PORTRAIT_IMAGE_GAP_FROM_AXIS = 24;
|
|
6896
6927
|
const PORTRAIT_SHADOW_OFFSET_X = 24;
|
|
6897
6928
|
const PORTRAIT_SHADOW_OFFSET_Y = 16;
|
|
6898
6929
|
const PORTRAIT_SHADOW_SCALE = 1;
|
|
6899
6930
|
const PORTRAIT_TEXT_GAP_FROM_IMAGE = 8;
|
|
6900
6931
|
const PORTRAIT_CONTENT_LINES = 3;
|
|
6901
|
-
const PORTRAIT_TITLE_LINE_HEIGHT =
|
|
6902
|
-
const PORTRAIT_CONTENT_LINE_HEIGHT =
|
|
6903
|
-
const PORTRAIT_CONTENT_FONT_SIZE =
|
|
6932
|
+
const PORTRAIT_TITLE_LINE_HEIGHT = 34;
|
|
6933
|
+
const PORTRAIT_CONTENT_LINE_HEIGHT = 26;
|
|
6934
|
+
const PORTRAIT_CONTENT_FONT_SIZE = 18;
|
|
6904
6935
|
const PORTRAIT_TITLE_TO_CONTENT_GAP = 4;
|
|
6905
6936
|
const getPortraitAxisRect = (spec, ctx) => {
|
|
6906
6937
|
const blocks = getLayout(spec, ctx).blocks;
|
|
@@ -6920,7 +6951,7 @@
|
|
|
6920
6951
|
};
|
|
6921
6952
|
};
|
|
6922
6953
|
const buildPortraitAxisMark = (spec) => {
|
|
6923
|
-
var _a, _b, _c, _e, _f, _g;
|
|
6954
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
6924
6955
|
const themeColor = getThemeColor(spec);
|
|
6925
6956
|
const lineStyle = (_b = (_a = spec.line) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
6926
6957
|
const defaultFill = {
|
|
@@ -6934,6 +6965,43 @@
|
|
|
6934
6965
|
{ offset: 1, color: withAlpha(themeColor, 1) }
|
|
6935
6966
|
]
|
|
6936
6967
|
};
|
|
6968
|
+
const markerFontSize = Number((_f = (_e = (_c = spec.marker) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.fontSize) !== null && _f !== void 0 ? _f : PORTRAIT_MARKER_FONT_SIZE);
|
|
6969
|
+
const markerLineHeight = Number((_j = (_h = (_g = spec.marker) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.lineHeight) !== null && _j !== void 0 ? _j : PORTRAIT_MARKER_LINE_HEIGHT);
|
|
6970
|
+
const markerVisible = ((_k = spec.marker) === null || _k === void 0 ? void 0 : _k.visible) !== false;
|
|
6971
|
+
const markerMarks = markerVisible
|
|
6972
|
+
? ((_l = spec.data) !== null && _l !== void 0 ? _l : [])
|
|
6973
|
+
.map((block, index) => {
|
|
6974
|
+
var _a;
|
|
6975
|
+
if (!block.marker) {
|
|
6976
|
+
return null;
|
|
6977
|
+
}
|
|
6978
|
+
const onLeft = index % 2 === 0;
|
|
6979
|
+
const axisHalf = PORTRAIT_AXIS_WIDTH / 2;
|
|
6980
|
+
const markerOffsetX = onLeft
|
|
6981
|
+
? -axisHalf + PORTRAIT_MARKER_AXIS_PADDING
|
|
6982
|
+
: axisHalf - PORTRAIT_MARKER_AXIS_PADDING;
|
|
6983
|
+
const markerTextAlign = onLeft ? 'left' : 'right';
|
|
6984
|
+
return Object.assign(Object.assign({ type: 'text', textType: 'rich', name: `storyline-portrait-marker-${index}`, interactive: false }, spec.marker), { style: Object.assign({ x: (_d, ctx) => {
|
|
6985
|
+
var _a, _b;
|
|
6986
|
+
const lb = getLayout(spec, ctx).blocks[index];
|
|
6987
|
+
return ((_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : 0) + markerOffsetX;
|
|
6988
|
+
}, y: (_d, ctx) => {
|
|
6989
|
+
var _a, _b;
|
|
6990
|
+
const lb = getLayout(spec, ctx).blocks[index];
|
|
6991
|
+
return (_b = (_a = lb === null || lb === void 0 ? void 0 : lb.center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : 0;
|
|
6992
|
+
}, text: {
|
|
6993
|
+
type: 'rich',
|
|
6994
|
+
text: block.marker.split('').map((char, i, arr) => ({
|
|
6995
|
+
text: char + (i < arr.length - 1 ? '\n' : ''),
|
|
6996
|
+
fontSize: markerFontSize,
|
|
6997
|
+
lineHeight: markerLineHeight,
|
|
6998
|
+
fill: '#fff',
|
|
6999
|
+
align: markerTextAlign
|
|
7000
|
+
}))
|
|
7001
|
+
}, fontWeight: 'bold', lineJoin: 'round', shadowColor: 'rgba(0, 0, 0, 0.3)', shadowBlur: 8, shadowOffsetX: 0, shadowOffsetY: 5, textAlign: markerTextAlign, textBaseline: 'middle' }, (_a = spec.marker) === null || _a === void 0 ? void 0 : _a.style) });
|
|
7002
|
+
})
|
|
7003
|
+
.filter(Boolean)
|
|
7004
|
+
: [];
|
|
6937
7005
|
return {
|
|
6938
7006
|
type: 'group',
|
|
6939
7007
|
name: 'storyline-portrait-axis',
|
|
@@ -6944,30 +7012,31 @@
|
|
|
6944
7012
|
name: 'storyline-portrait-axis-rect',
|
|
6945
7013
|
interactive: false,
|
|
6946
7014
|
style: {
|
|
6947
|
-
fill: (
|
|
6948
|
-
stroke: (
|
|
6949
|
-
lineWidth: (
|
|
6950
|
-
cornerRadius: (
|
|
7015
|
+
fill: (_m = lineStyle.fill) !== null && _m !== void 0 ? _m : defaultFill,
|
|
7016
|
+
stroke: (_o = lineStyle.stroke) !== null && _o !== void 0 ? _o : false,
|
|
7017
|
+
lineWidth: (_p = lineStyle.lineWidth) !== null && _p !== void 0 ? _p : 0,
|
|
7018
|
+
cornerRadius: (_q = lineStyle.cornerRadius) !== null && _q !== void 0 ? _q : 0,
|
|
6951
7019
|
x: (_d, ctx) => getPortraitAxisRect(spec, ctx).x,
|
|
6952
7020
|
y: (_d, ctx) => getPortraitAxisRect(spec, ctx).y,
|
|
6953
7021
|
width: (_d, ctx) => getPortraitAxisRect(spec, ctx).width,
|
|
6954
7022
|
height: (_d, ctx) => getPortraitAxisRect(spec, ctx).height
|
|
6955
7023
|
}
|
|
6956
|
-
}
|
|
7024
|
+
},
|
|
7025
|
+
...markerMarks
|
|
6957
7026
|
]
|
|
6958
7027
|
};
|
|
6959
7028
|
};
|
|
6960
7029
|
const getPortraitMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
6961
7030
|
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
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 :
|
|
7031
|
+
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 : 26);
|
|
6963
7032
|
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)));
|
|
6964
7033
|
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);
|
|
6965
7034
|
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);
|
|
6966
7035
|
const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
|
|
6967
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q :
|
|
6968
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s :
|
|
7036
|
+
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : Math.max(blockWidth, 80);
|
|
7037
|
+
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : Math.round(blockHeight * PORTRAIT_IMAGE_HEIGHT_RATIO);
|
|
6969
7038
|
const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
|
|
6970
|
-
const contentHeight = Math.max(minContentHeight, blockHeight
|
|
7039
|
+
const contentHeight = Math.max(minContentHeight, Math.round(blockHeight * PORTRAIT_CONTENT_HEIGHT_RATIO));
|
|
6971
7040
|
const textHeight = titleLineHeight + titleToContentGap + contentHeight;
|
|
6972
7041
|
const onLeft = index % 2 === 0;
|
|
6973
7042
|
const axisHalf = PORTRAIT_AXIS_WIDTH / 2;
|
|
@@ -7014,9 +7083,8 @@
|
|
|
7014
7083
|
const hasImage = !!block.image;
|
|
7015
7084
|
const hasSubImage = !!block.subImage;
|
|
7016
7085
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7017
|
-
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 :
|
|
7086
|
+
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 : 26);
|
|
7018
7087
|
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)));
|
|
7019
|
-
const showBackground = ((_h = spec.image) === null || _h === void 0 ? void 0 : _h.showBackground) === true;
|
|
7020
7088
|
const getMetrics = (ctx) => {
|
|
7021
7089
|
var _a, _b, _c, _e;
|
|
7022
7090
|
const lb = getLayout(spec, ctx).blocks[index];
|
|
@@ -7025,10 +7093,10 @@
|
|
|
7025
7093
|
return getPortraitMetrics(spec, w, h, index);
|
|
7026
7094
|
};
|
|
7027
7095
|
const themeColor = getThemeColor(spec);
|
|
7028
|
-
const blockStyle = (
|
|
7096
|
+
const blockStyle = (_j = (_h = spec.block) === null || _h === void 0 ? void 0 : _h.style) !== null && _j !== void 0 ? _j : {};
|
|
7029
7097
|
return {
|
|
7030
7098
|
type: 'group',
|
|
7031
|
-
id: `storyline-block-${(
|
|
7099
|
+
id: `storyline-block-${(_k = block.id) !== null && _k !== void 0 ? _k : index}`,
|
|
7032
7100
|
name: `storyline-block-${index}`,
|
|
7033
7101
|
zIndex: vchart.LayoutZIndex.Mark + 1,
|
|
7034
7102
|
style: {
|
|
@@ -7044,7 +7112,7 @@
|
|
|
7044
7112
|
}
|
|
7045
7113
|
},
|
|
7046
7114
|
children: [
|
|
7047
|
-
hasSubImage
|
|
7115
|
+
hasSubImage
|
|
7048
7116
|
? {
|
|
7049
7117
|
type: 'image',
|
|
7050
7118
|
name: `storyline-block-shadow-image-${index}`,
|
|
@@ -7062,12 +7130,14 @@
|
|
|
7062
7130
|
}
|
|
7063
7131
|
}
|
|
7064
7132
|
: null,
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7133
|
+
((_l = spec.image) === null || _l === void 0 ? void 0 : _l.showBackground) === true
|
|
7134
|
+
? {
|
|
7135
|
+
type: 'rect',
|
|
7136
|
+
name: `storyline-block-image-bg-${index}`,
|
|
7137
|
+
interactive: false,
|
|
7138
|
+
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)
|
|
7139
|
+
}
|
|
7140
|
+
: null,
|
|
7071
7141
|
hasImage
|
|
7072
7142
|
? 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) })
|
|
7073
7143
|
: null,
|
|
@@ -7075,53 +7145,55 @@
|
|
|
7075
7145
|
? 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) })
|
|
7076
7146
|
: null,
|
|
7077
7147
|
contentText.length
|
|
7078
|
-
? 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
|
|
7148
|
+
? 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, {
|
|
7149
|
+
fontSize: PORTRAIT_CONTENT_FONT_SIZE,
|
|
7150
|
+
lineHeight: PORTRAIT_CONTENT_LINE_HEIGHT,
|
|
7151
|
+
fill: '#596173'
|
|
7152
|
+
}), textAlign: 'left', textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_p = spec.content) === null || _p === void 0 ? void 0 : _p.style) })
|
|
7079
7153
|
: null
|
|
7080
7154
|
].filter(Boolean)
|
|
7081
7155
|
};
|
|
7082
7156
|
};
|
|
7083
7157
|
|
|
7084
|
-
const ARC_BLOCK_IMAGE_SIZE =
|
|
7158
|
+
const ARC_BLOCK_IMAGE_SIZE = 240;
|
|
7159
|
+
const ARC_BLOCK_IMAGE_BORDER = 3;
|
|
7160
|
+
const ARC_BLOCK_IMAGE_HALO_PADDING = 6;
|
|
7085
7161
|
const ARC_TEXT_GAP_FROM_IMAGE = 10;
|
|
7086
|
-
const
|
|
7087
|
-
const
|
|
7088
|
-
const
|
|
7162
|
+
const ARC_TITLE_FONT_SIZE = 32;
|
|
7163
|
+
const ARC_TITLE_LINE_HEIGHT = 34;
|
|
7164
|
+
const ARC_CONTENT_LINE_HEIGHT = 26;
|
|
7165
|
+
const ARC_CONTENT_FONT_SIZE = 20;
|
|
7089
7166
|
const ARC_TEXT_BOX_HEIGHT = 240;
|
|
7090
7167
|
const ARC_TITLE_TO_CONTENT_GAP = 4;
|
|
7091
|
-
const
|
|
7092
|
-
const ARC_TEXT_BOX_MIN_WIDTH =
|
|
7093
|
-
const ARC_CENTER_IMAGE_SIZE_RATIO = 0.
|
|
7168
|
+
const ARC_TEXT_PADDING = 20;
|
|
7169
|
+
const ARC_TEXT_BOX_MIN_WIDTH = 240;
|
|
7170
|
+
const ARC_CENTER_IMAGE_SIZE_RATIO = 0.55;
|
|
7171
|
+
const ARC_CENTER_IMAGE_TO_SYMBOL_RATIO = 0.8;
|
|
7094
7172
|
const ARC_GAP_FROM_CENTER_IMAGE = 200;
|
|
7095
7173
|
const isDownArc = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7096
7174
|
const getArcCenterImageRect = (spec, ctx) => {
|
|
7097
|
-
var _a, _b, _c, _e
|
|
7175
|
+
var _a, _b, _c, _e;
|
|
7098
7176
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7099
|
-
const
|
|
7100
|
-
const
|
|
7101
|
-
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7177
|
+
const innerWidth = Math.max(width, 1);
|
|
7178
|
+
const innerHeight = Math.max(height, 1);
|
|
7102
7179
|
const baseSize = Math.min(innerWidth, innerHeight) * ARC_CENTER_IMAGE_SIZE_RATIO;
|
|
7103
|
-
const w = Math.max((
|
|
7104
|
-
const h = Math.max((
|
|
7105
|
-
const cx = startX +
|
|
7180
|
+
const w = Math.max((_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : baseSize, 80);
|
|
7181
|
+
const h = Math.max((_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.height) !== null && _e !== void 0 ? _e : baseSize, 80);
|
|
7182
|
+
const cx = startX + innerWidth / 2;
|
|
7106
7183
|
const isDown = isDownArc(spec);
|
|
7107
|
-
const top = isDown
|
|
7108
|
-
?
|
|
7109
|
-
startY + padding.top
|
|
7110
|
-
:
|
|
7111
|
-
startY + padding.top + innerHeight - h;
|
|
7184
|
+
const top = isDown ? startY : startY + innerHeight - h;
|
|
7112
7185
|
return { x: cx - w / 2, y: top, width: w, height: h };
|
|
7113
7186
|
};
|
|
7114
7187
|
const getArcGeometry = (spec, ctx) => {
|
|
7115
|
-
var _a, _b, _c
|
|
7188
|
+
var _a, _b, _c;
|
|
7116
7189
|
const { width, startX } = getRegionGeometry(ctx);
|
|
7117
|
-
const
|
|
7118
|
-
const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);
|
|
7190
|
+
const innerWidth = Math.max(width, 1);
|
|
7119
7191
|
const blockWidth = resolveBlockWidth(spec, width);
|
|
7120
7192
|
const layoutOpt = normalizeLayout(spec.layout);
|
|
7121
7193
|
const isDown = layoutOpt.direction === 'down';
|
|
7122
|
-
const startAngle = (
|
|
7123
|
-
const endAngle = (
|
|
7124
|
-
const ratio = (
|
|
7194
|
+
const startAngle = (_a = layoutOpt.startAngle) !== null && _a !== void 0 ? _a : (isDown ? 20 : 200);
|
|
7195
|
+
const endAngle = (_b = layoutOpt.endAngle) !== null && _b !== void 0 ? _b : (isDown ? 160 : 340);
|
|
7196
|
+
const ratio = (_c = layoutOpt.radiusRatio) !== null && _c !== void 0 ? _c : 0.88;
|
|
7125
7197
|
const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;
|
|
7126
7198
|
const centerRect = getArcCenterImageRect(spec, ctx);
|
|
7127
7199
|
const centerTop = centerRect.y;
|
|
@@ -7140,7 +7212,7 @@
|
|
|
7140
7212
|
cy = centerBottom - ry * sinStart;
|
|
7141
7213
|
}
|
|
7142
7214
|
return {
|
|
7143
|
-
cx: startX +
|
|
7215
|
+
cx: startX + innerWidth / 2,
|
|
7144
7216
|
cy,
|
|
7145
7217
|
rx,
|
|
7146
7218
|
ry,
|
|
@@ -7249,56 +7321,93 @@
|
|
|
7249
7321
|
},
|
|
7250
7322
|
size: (_d, ctx) => {
|
|
7251
7323
|
const r = getArcCenterImageRect(spec, ctx);
|
|
7252
|
-
return Math.max(r.width, r.height)
|
|
7324
|
+
return Math.max(r.width, r.height);
|
|
7253
7325
|
},
|
|
7254
7326
|
symbolType: 'circle',
|
|
7255
|
-
fill: symbolGradient,
|
|
7327
|
+
fill: hasImage ? symbolGradient : '#ffffff',
|
|
7256
7328
|
stroke: themeColor,
|
|
7257
7329
|
lineWidth: 2
|
|
7258
7330
|
}
|
|
7259
7331
|
},
|
|
7260
7332
|
hasImage
|
|
7261
|
-
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) =>
|
|
7333
|
+
? Object.assign(Object.assign({ type: 'image', name: 'storyline-arc-center-image', interactive: false }, spec.centerImage), { style: Object.assign({ x: (_d, ctx) => {
|
|
7334
|
+
var _a, _b;
|
|
7262
7335
|
const r = getArcCenterImageRect(spec, ctx);
|
|
7263
|
-
|
|
7264
|
-
|
|
7336
|
+
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7337
|
+
const w = typeof userWidth === 'number'
|
|
7338
|
+
? userWidth
|
|
7339
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7340
|
+
return r.x + (r.width - w) / 2;
|
|
7341
|
+
}, y: (_d, ctx) => {
|
|
7342
|
+
var _a, _b;
|
|
7343
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7344
|
+
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7345
|
+
const h = typeof userHeight === 'number'
|
|
7346
|
+
? userHeight
|
|
7347
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7348
|
+
return r.y + (r.height - h) / 2;
|
|
7349
|
+
}, width: (_d, ctx) => {
|
|
7265
7350
|
var _a, _b;
|
|
7266
7351
|
const r = getArcCenterImageRect(spec, ctx);
|
|
7267
7352
|
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7353
|
+
return typeof userWidth === 'number'
|
|
7354
|
+
? userWidth
|
|
7355
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7356
|
+
}, height: (_d, ctx) => {
|
|
7271
7357
|
var _a, _b;
|
|
7272
7358
|
const r = getArcCenterImageRect(spec, ctx);
|
|
7273
7359
|
const userHeight = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.height;
|
|
7274
|
-
|
|
7275
|
-
|
|
7360
|
+
return typeof userHeight === 'number'
|
|
7361
|
+
? userHeight
|
|
7362
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7363
|
+
}, cornerRadius: (_d, ctx) => {
|
|
7364
|
+
var _a, _b, _c, _e;
|
|
7365
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7366
|
+
const userWidth = (_b = (_a = spec.centerImage) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.width;
|
|
7367
|
+
const userHeight = (_e = (_c = spec.centerImage) === null || _c === void 0 ? void 0 : _c.style) === null || _e === void 0 ? void 0 : _e.height;
|
|
7368
|
+
const w = typeof userWidth === 'number'
|
|
7369
|
+
? userWidth
|
|
7370
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7371
|
+
const h = typeof userHeight === 'number'
|
|
7372
|
+
? userHeight
|
|
7373
|
+
: Math.max(r.width, r.height) * ARC_CENTER_IMAGE_TO_SYMBOL_RATIO;
|
|
7374
|
+
return Math.max(w, h) / 2;
|
|
7375
|
+
}, 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) => {
|
|
7376
|
+
const r = getArcCenterImageRect(spec, ctx);
|
|
7377
|
+
return [r.x + r.width / 2, r.y + r.height / 2];
|
|
7276
7378
|
} }, (_e = spec.centerImage) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7277
7379
|
: null
|
|
7278
7380
|
].filter(Boolean)
|
|
7279
7381
|
};
|
|
7280
7382
|
};
|
|
7281
|
-
const getArcBlockMetrics = (spec) => {
|
|
7282
|
-
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
7283
|
-
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 :
|
|
7383
|
+
const getArcBlockMetrics = (spec, index = 0) => {
|
|
7384
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7385
|
+
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 : ARC_TITLE_FONT_SIZE);
|
|
7284
7386
|
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)));
|
|
7285
7387
|
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);
|
|
7286
7388
|
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);
|
|
7287
7389
|
const titleToContentGap = ARC_TITLE_TO_CONTENT_GAP;
|
|
7288
7390
|
const textHeight = ARC_TEXT_BOX_HEIGHT;
|
|
7289
7391
|
const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);
|
|
7290
|
-
const
|
|
7291
|
-
const
|
|
7392
|
+
const imageDiameter = Math.max((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : ARC_BLOCK_IMAGE_SIZE, (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : ARC_BLOCK_IMAGE_SIZE);
|
|
7393
|
+
const imageWidth = imageDiameter;
|
|
7394
|
+
const imageHeight = imageDiameter;
|
|
7292
7395
|
const isDown = isDownArc(spec);
|
|
7396
|
+
const count = Math.max((_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0, 1);
|
|
7397
|
+
const canvasWidth = Number((_v = spec.width) !== null && _v !== void 0 ? _v : imageWidth * count);
|
|
7398
|
+
const defaultTextWidth = Math.round(canvasWidth / (count + 1));
|
|
7399
|
+
const textBoxWidth = Math.max(Number((_x = (_w = spec.block) === null || _w === void 0 ? void 0 : _w.width) !== null && _x !== void 0 ? _x : defaultTextWidth), ARC_TEXT_BOX_MIN_WIDTH);
|
|
7400
|
+
const isLeftSide = index < count / 2;
|
|
7401
|
+
const textAlign = isLeftSide ? 'right' : 'left';
|
|
7293
7402
|
const imageBox = {
|
|
7294
7403
|
x: -imageWidth / 2,
|
|
7295
7404
|
y: -imageHeight / 2,
|
|
7296
7405
|
width: imageWidth,
|
|
7297
7406
|
height: imageHeight
|
|
7298
7407
|
};
|
|
7299
|
-
const
|
|
7408
|
+
const textBoxX = isLeftSide ? -ARC_TEXT_PADDING : ARC_TEXT_PADDING;
|
|
7300
7409
|
const textBox = {
|
|
7301
|
-
x:
|
|
7410
|
+
x: textBoxX,
|
|
7302
7411
|
y: isDown ? imageBox.y + imageHeight + ARC_TEXT_GAP_FROM_IMAGE : imageBox.y - ARC_TEXT_GAP_FROM_IMAGE - textHeight,
|
|
7303
7412
|
width: textBoxWidth,
|
|
7304
7413
|
height: textHeight
|
|
@@ -7317,19 +7426,21 @@
|
|
|
7317
7426
|
imageBox,
|
|
7318
7427
|
textBox,
|
|
7319
7428
|
contentBox,
|
|
7320
|
-
isDown
|
|
7429
|
+
isDown,
|
|
7430
|
+
textAlign
|
|
7321
7431
|
};
|
|
7322
7432
|
};
|
|
7323
7433
|
const buildArcBlockMark = (spec, block, index) => {
|
|
7324
|
-
var _a, _b, _c, _e;
|
|
7434
|
+
var _a, _b, _c, _e, _f;
|
|
7325
7435
|
const hasImage = !!block.image;
|
|
7326
7436
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7327
7437
|
const themeColor = getThemeColor(spec);
|
|
7328
|
-
const metrics = getArcBlockMetrics(spec);
|
|
7438
|
+
const metrics = getArcBlockMetrics(spec, index);
|
|
7329
7439
|
const connectorY = metrics.isDown ? metrics.imageBox.y + metrics.imageBox.height : metrics.textBox.y;
|
|
7330
7440
|
const connectorHeight = metrics.isDown
|
|
7331
7441
|
? Math.max(metrics.textBox.y + metrics.textBox.height - (metrics.imageBox.y + metrics.imageBox.height), 0)
|
|
7332
7442
|
: Math.max(metrics.imageBox.y - metrics.textBox.y, 0);
|
|
7443
|
+
const connectorX = -1;
|
|
7333
7444
|
return {
|
|
7334
7445
|
type: 'group',
|
|
7335
7446
|
id: `storyline-block-${(_a = block.id) !== null && _a !== void 0 ? _a : index}`,
|
|
@@ -7344,8 +7455,9 @@
|
|
|
7344
7455
|
type: 'rect',
|
|
7345
7456
|
name: `storyline-block-connector-${index}`,
|
|
7346
7457
|
interactive: false,
|
|
7458
|
+
zIndex: vchart.LayoutZIndex.Mark + 2,
|
|
7347
7459
|
style: {
|
|
7348
|
-
x:
|
|
7460
|
+
x: connectorX,
|
|
7349
7461
|
y: connectorY,
|
|
7350
7462
|
width: 2,
|
|
7351
7463
|
height: connectorHeight,
|
|
@@ -7354,34 +7466,55 @@
|
|
|
7354
7466
|
}
|
|
7355
7467
|
},
|
|
7356
7468
|
hasImage
|
|
7357
|
-
? 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) })
|
|
7469
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 3 }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: metrics.imageBox.x, y: metrics.imageBox.y, width: metrics.imageBox.width, height: metrics.imageBox.height, cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_b = spec.image) === null || _b === void 0 ? void 0 : _b.style) })
|
|
7358
7470
|
: {
|
|
7359
|
-
type: '
|
|
7471
|
+
type: 'symbol',
|
|
7360
7472
|
name: `storyline-block-image-bg-${index}`,
|
|
7361
7473
|
interactive: false,
|
|
7474
|
+
zIndex: vchart.LayoutZIndex.Mark + 3,
|
|
7362
7475
|
style: {
|
|
7363
|
-
x:
|
|
7364
|
-
y:
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,
|
|
7476
|
+
x: 0,
|
|
7477
|
+
y: 0,
|
|
7478
|
+
size: Math.min(metrics.imageBox.width, metrics.imageBox.height),
|
|
7479
|
+
symbolType: 'circle',
|
|
7368
7480
|
fill: '#ffffff',
|
|
7369
7481
|
stroke: themeColor,
|
|
7370
7482
|
lineWidth: 2
|
|
7371
7483
|
}
|
|
7372
7484
|
},
|
|
7485
|
+
((_c = spec.image) === null || _c === void 0 ? void 0 : _c.showBackground) === true
|
|
7486
|
+
? {
|
|
7487
|
+
type: 'symbol',
|
|
7488
|
+
name: `storyline-block-image-halo-${index}`,
|
|
7489
|
+
interactive: false,
|
|
7490
|
+
zIndex: vchart.LayoutZIndex.Mark + 3,
|
|
7491
|
+
style: {
|
|
7492
|
+
x: 0,
|
|
7493
|
+
y: 0,
|
|
7494
|
+
size: Math.min(metrics.imageBox.width, metrics.imageBox.height) + ARC_BLOCK_IMAGE_HALO_PADDING * 2,
|
|
7495
|
+
symbolType: 'circle',
|
|
7496
|
+
fill: 'transparent',
|
|
7497
|
+
stroke: themeColor,
|
|
7498
|
+
lineWidth: ARC_BLOCK_IMAGE_BORDER
|
|
7499
|
+
}
|
|
7500
|
+
}
|
|
7501
|
+
: null,
|
|
7373
7502
|
block.title
|
|
7374
|
-
? 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:
|
|
7503
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 5 }, spec.title), { style: Object.assign({ x: metrics.textBox.x, y: metrics.textBox.y, text: block.title, maxLineWidth: metrics.textBox.width, fontSize: metrics.titleFontSize, lineHeight: metrics.titleLineHeight, fontWeight: 'bold', fill: '#1f2430', stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: metrics.textAlign, textBaseline: 'top' }, (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7375
7504
|
: null,
|
|
7376
7505
|
contentText.length
|
|
7377
|
-
? 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
|
|
7506
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-content-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 4 }, 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, {
|
|
7507
|
+
fontSize: metrics.contentFontSize,
|
|
7508
|
+
lineHeight: metrics.contentLineHeight,
|
|
7509
|
+
fill: '#596173',
|
|
7510
|
+
align: metrics.textAlign
|
|
7511
|
+
}), textAlign: metrics.textAlign, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7378
7512
|
: null
|
|
7379
7513
|
].filter(Boolean)
|
|
7380
7514
|
};
|
|
7381
7515
|
};
|
|
7382
7516
|
|
|
7383
|
-
const WING_BLOCK_IMAGE_SIZE =
|
|
7384
|
-
const WING_TEXT_GAP_FROM_IMAGE = 14;
|
|
7517
|
+
const WING_BLOCK_IMAGE_SIZE = 160;
|
|
7385
7518
|
const WING_TITLE_LINE_HEIGHT = 30;
|
|
7386
7519
|
const WING_TITLE_FONT_SIZE = 22;
|
|
7387
7520
|
const WING_CONTENT_LINE_HEIGHT = 17;
|
|
@@ -7394,22 +7527,21 @@
|
|
|
7394
7527
|
return (_a = normalizeLayout(spec.layout).direction) !== null && _a !== void 0 ? _a : 'left';
|
|
7395
7528
|
};
|
|
7396
7529
|
const getWingArcGeometry = (spec, ctx) => {
|
|
7397
|
-
var _a, _b, _c
|
|
7530
|
+
var _a, _b, _c;
|
|
7398
7531
|
const { width, height, startX, startY } = getRegionGeometry(ctx);
|
|
7399
|
-
const
|
|
7400
|
-
const
|
|
7401
|
-
const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
|
|
7532
|
+
const innerWidth = Math.max(width, 1);
|
|
7533
|
+
const innerHeight = Math.max(height, 1);
|
|
7402
7534
|
const layoutOpt = normalizeLayout(spec.layout);
|
|
7403
7535
|
const direction = getWingDirection(spec);
|
|
7404
7536
|
const defaultStart = direction === 'right' ? 110 : -70;
|
|
7405
7537
|
const defaultEnd = direction === 'right' ? 250 : 70;
|
|
7406
|
-
const startAngle = (
|
|
7407
|
-
const endAngle = (
|
|
7408
|
-
const ratio = (
|
|
7538
|
+
const startAngle = (_a = layoutOpt.startAngle) !== null && _a !== void 0 ? _a : defaultStart;
|
|
7539
|
+
const endAngle = (_b = layoutOpt.endAngle) !== null && _b !== void 0 ? _b : defaultEnd;
|
|
7540
|
+
const ratio = (_c = layoutOpt.radiusRatio) !== null && _c !== void 0 ? _c : 0.92;
|
|
7409
7541
|
const ry = (innerHeight / 2) * ratio;
|
|
7410
7542
|
const rx = innerWidth * 0.6 * ratio;
|
|
7411
|
-
const cx = direction === 'right' ? startX +
|
|
7412
|
-
const cy = startY +
|
|
7543
|
+
const cx = direction === 'right' ? startX + innerWidth - rx * 0.1 : startX + rx * 0.1;
|
|
7544
|
+
const cy = startY + innerHeight / 2;
|
|
7413
7545
|
return { cx, cy, rx, ry, startAngle, endAngle };
|
|
7414
7546
|
};
|
|
7415
7547
|
const getWingBlockCenter = (spec, ctx, index) => {
|
|
@@ -7426,10 +7558,6 @@
|
|
|
7426
7558
|
y: arc.cy + Math.sin(angle) * arc.ry
|
|
7427
7559
|
};
|
|
7428
7560
|
};
|
|
7429
|
-
const isTextOnLeft = (spec, index) => {
|
|
7430
|
-
const direction = getWingDirection(spec);
|
|
7431
|
-
return direction === 'right' ? index % 2 === 1 : index % 2 === 0;
|
|
7432
|
-
};
|
|
7433
7561
|
const buildWingArcMark = (spec) => {
|
|
7434
7562
|
var _a, _b, _c, _e, _f, _g, _h, _j;
|
|
7435
7563
|
if (((_a = spec.line) === null || _a === void 0 ? void 0 : _a.visible) === false) {
|
|
@@ -7437,8 +7565,8 @@
|
|
|
7437
7565
|
}
|
|
7438
7566
|
const themeColor = getThemeColor(spec);
|
|
7439
7567
|
const lineStyle = ((_c = (_b = spec.line) === null || _b === void 0 ? void 0 : _b.style) !== null && _c !== void 0 ? _c : {});
|
|
7440
|
-
const startWidth = Math.max(Number((_e = lineStyle.startWidth) !== null && _e !== void 0 ? _e :
|
|
7441
|
-
const endWidth = Math.max(Number((_g = (_f = lineStyle.endWidth) !== null && _f !== void 0 ? _f : lineStyle.lineWidth) !== null && _g !== void 0 ? _g :
|
|
7568
|
+
const startWidth = Math.max(Number((_e = lineStyle.startWidth) !== null && _e !== void 0 ? _e : 50), 0.5);
|
|
7569
|
+
const endWidth = Math.max(Number((_g = (_f = lineStyle.endWidth) !== null && _f !== void 0 ? _f : lineStyle.lineWidth) !== null && _g !== void 0 ? _g : 350), startWidth);
|
|
7442
7570
|
return {
|
|
7443
7571
|
type: 'group',
|
|
7444
7572
|
name: 'storyline-wing-arc',
|
|
@@ -7495,45 +7623,86 @@
|
|
|
7495
7623
|
]
|
|
7496
7624
|
};
|
|
7497
7625
|
};
|
|
7498
|
-
const
|
|
7499
|
-
|
|
7626
|
+
const WING_TEXT_IMAGE_GAP = 120;
|
|
7627
|
+
const getWingBlockMetrics = (spec, ctx, index) => {
|
|
7628
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
7500
7629
|
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 : WING_TITLE_FONT_SIZE);
|
|
7501
7630
|
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(WING_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.3)));
|
|
7502
7631
|
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 : WING_CONTENT_FONT_SIZE);
|
|
7503
7632
|
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 : WING_CONTENT_LINE_HEIGHT);
|
|
7504
7633
|
const titleToContentGap = WING_TITLE_TO_CONTENT_GAP;
|
|
7505
7634
|
const textHeight = WING_TEXT_BOX_HEIGHT;
|
|
7506
|
-
const contentHeight =
|
|
7507
|
-
const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : WING_BLOCK_IMAGE_SIZE;
|
|
7508
|
-
const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : WING_BLOCK_IMAGE_SIZE;
|
|
7635
|
+
const contentHeight = 100000;
|
|
7636
|
+
const imageWidth = Number((_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : WING_BLOCK_IMAGE_SIZE);
|
|
7637
|
+
const imageHeight = Number((_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : WING_BLOCK_IMAGE_SIZE);
|
|
7509
7638
|
const imageBox = {
|
|
7510
7639
|
x: -imageWidth / 2,
|
|
7511
7640
|
y: -imageHeight / 2,
|
|
7512
7641
|
width: imageWidth,
|
|
7513
7642
|
height: imageHeight
|
|
7514
7643
|
};
|
|
7515
|
-
const
|
|
7644
|
+
const direction = getWingDirection(spec);
|
|
7645
|
+
const count = (_u = (_t = spec.data) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0;
|
|
7646
|
+
const isSpecialBelow = (direction === 'right' && count > 0 && index === count - 1) || (direction === 'left' && index === 0);
|
|
7647
|
+
const isVerticalLayout = isSpecialBelow;
|
|
7516
7648
|
const textWidth = WING_TEXT_BOX_WIDTH;
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
width: textWidth,
|
|
7526
|
-
|
|
7527
|
-
|
|
7649
|
+
let textBox;
|
|
7650
|
+
let contentBox;
|
|
7651
|
+
let connectorBox;
|
|
7652
|
+
let onLeft;
|
|
7653
|
+
let verticalAlign;
|
|
7654
|
+
if (isVerticalLayout) {
|
|
7655
|
+
const textX = -textWidth / 2;
|
|
7656
|
+
const textY = imageHeight / 2 + WING_TEXT_IMAGE_GAP;
|
|
7657
|
+
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7658
|
+
contentBox = {
|
|
7659
|
+
x: textX,
|
|
7660
|
+
y: textY + titleLineHeight + titleToContentGap,
|
|
7661
|
+
width: textWidth,
|
|
7662
|
+
height: contentHeight
|
|
7663
|
+
};
|
|
7664
|
+
connectorBox = {
|
|
7665
|
+
x: -1,
|
|
7666
|
+
y: imageHeight / 2,
|
|
7667
|
+
width: 2,
|
|
7668
|
+
height: WING_TEXT_IMAGE_GAP
|
|
7669
|
+
};
|
|
7670
|
+
onLeft = false;
|
|
7671
|
+
verticalAlign = 'below';
|
|
7672
|
+
}
|
|
7673
|
+
else {
|
|
7674
|
+
const textOnLeft = direction === 'right';
|
|
7675
|
+
const textX = textOnLeft ? -imageWidth / 2 - WING_TEXT_IMAGE_GAP - textWidth : imageWidth / 2 + WING_TEXT_IMAGE_GAP;
|
|
7676
|
+
const textY = -textHeight / 2;
|
|
7677
|
+
textBox = { x: textX, y: textY, width: textWidth, height: textHeight };
|
|
7678
|
+
contentBox = {
|
|
7679
|
+
x: textX,
|
|
7680
|
+
y: textY + titleLineHeight + titleToContentGap,
|
|
7681
|
+
width: textWidth,
|
|
7682
|
+
height: contentHeight
|
|
7683
|
+
};
|
|
7684
|
+
const imageEdgeX = textOnLeft ? -imageWidth / 2 : imageWidth / 2;
|
|
7685
|
+
const textEdgeX = textOnLeft ? textX + textWidth : textX;
|
|
7686
|
+
connectorBox = {
|
|
7687
|
+
x: Math.min(imageEdgeX, textEdgeX),
|
|
7688
|
+
y: 0,
|
|
7689
|
+
width: Math.abs(textEdgeX - imageEdgeX),
|
|
7690
|
+
height: 2
|
|
7691
|
+
};
|
|
7692
|
+
onLeft = textOnLeft;
|
|
7693
|
+
verticalAlign = null;
|
|
7694
|
+
}
|
|
7528
7695
|
return {
|
|
7529
7696
|
onLeft,
|
|
7697
|
+
verticalAlign,
|
|
7530
7698
|
titleFontSize,
|
|
7531
7699
|
titleLineHeight,
|
|
7532
7700
|
contentFontSize,
|
|
7533
7701
|
contentLineHeight,
|
|
7534
7702
|
imageBox,
|
|
7535
7703
|
textBox,
|
|
7536
|
-
contentBox
|
|
7704
|
+
contentBox,
|
|
7705
|
+
connectorBox
|
|
7537
7706
|
};
|
|
7538
7707
|
};
|
|
7539
7708
|
const buildWingBlockMark = (spec, block, index) => {
|
|
@@ -7541,7 +7710,6 @@
|
|
|
7541
7710
|
const hasImage = !!block.image;
|
|
7542
7711
|
const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];
|
|
7543
7712
|
const themeColor = getThemeColor(spec);
|
|
7544
|
-
const metrics = getWingBlockMetrics(spec, index);
|
|
7545
7713
|
const showBackground = ((_a = spec.image) === null || _a === void 0 ? void 0 : _a.showBackground) === true;
|
|
7546
7714
|
return {
|
|
7547
7715
|
type: 'group',
|
|
@@ -7553,6 +7721,20 @@
|
|
|
7553
7721
|
y: (_d, ctx) => getWingBlockCenter(spec, ctx, index).y
|
|
7554
7722
|
},
|
|
7555
7723
|
children: [
|
|
7724
|
+
{
|
|
7725
|
+
type: 'rect',
|
|
7726
|
+
name: `storyline-block-connector-${index}`,
|
|
7727
|
+
interactive: false,
|
|
7728
|
+
zIndex: vchart.LayoutZIndex.Mark + 2,
|
|
7729
|
+
style: {
|
|
7730
|
+
x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).connectorBox.x,
|
|
7731
|
+
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).connectorBox.y,
|
|
7732
|
+
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).connectorBox.width,
|
|
7733
|
+
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).connectorBox.height,
|
|
7734
|
+
fill: themeColor,
|
|
7735
|
+
opacity: 0.6
|
|
7736
|
+
}
|
|
7737
|
+
},
|
|
7556
7738
|
showBackground
|
|
7557
7739
|
? {
|
|
7558
7740
|
type: 'symbol',
|
|
@@ -7561,7 +7743,7 @@
|
|
|
7561
7743
|
style: {
|
|
7562
7744
|
x: 0,
|
|
7563
7745
|
y: 0,
|
|
7564
|
-
size: Math.max(
|
|
7746
|
+
size: (_d, ctx) => Math.max(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) + 12,
|
|
7565
7747
|
symbolType: 'circle',
|
|
7566
7748
|
fill: withAlpha(themeColor, 0.18),
|
|
7567
7749
|
stroke: themeColor,
|
|
@@ -7570,27 +7752,51 @@
|
|
|
7570
7752
|
}
|
|
7571
7753
|
: null,
|
|
7572
7754
|
hasImage
|
|
7573
|
-
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x:
|
|
7755
|
+
? Object.assign(Object.assign({ type: 'image', name: `storyline-block-image-${index}`, interactive: false }, omitImageLayoutSpec(spec.image)), { style: Object.assign({ x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height, cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2, image: block.image, repeatX: 'no-repeat', repeatY: 'no-repeat', imageMode: 'cover', imagePosition: 'center' }, (_c = spec.image) === null || _c === void 0 ? void 0 : _c.style) })
|
|
7574
7756
|
: {
|
|
7575
7757
|
type: 'rect',
|
|
7576
7758
|
name: `storyline-block-image-bg-${index}`,
|
|
7577
7759
|
interactive: false,
|
|
7578
7760
|
style: {
|
|
7579
|
-
x:
|
|
7580
|
-
y:
|
|
7581
|
-
width:
|
|
7582
|
-
height:
|
|
7583
|
-
cornerRadius: Math.min(
|
|
7761
|
+
x: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.x,
|
|
7762
|
+
y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.y,
|
|
7763
|
+
width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.width,
|
|
7764
|
+
height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).imageBox.height,
|
|
7765
|
+
cornerRadius: (_d, ctx) => Math.min(getWingBlockMetrics(spec, ctx, index).imageBox.width, getWingBlockMetrics(spec, ctx, index).imageBox.height) / 2,
|
|
7584
7766
|
fill: '#ffffff',
|
|
7585
7767
|
stroke: themeColor,
|
|
7586
7768
|
lineWidth: 2
|
|
7587
7769
|
}
|
|
7588
7770
|
},
|
|
7589
7771
|
block.title
|
|
7590
|
-
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x:
|
|
7772
|
+
? Object.assign(Object.assign({ type: 'text', name: `storyline-block-title-${index}`, interactive: false, zIndex: vchart.LayoutZIndex.Mark + 10 }, spec.title), { style: Object.assign({ x: (_d, ctx) => {
|
|
7773
|
+
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7774
|
+
if (m.verticalAlign) {
|
|
7775
|
+
return m.textBox.x + m.textBox.width / 2;
|
|
7776
|
+
}
|
|
7777
|
+
return m.onLeft ? m.textBox.x + m.textBox.width : m.textBox.x;
|
|
7778
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.y, text: block.title, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).textBox.width, fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).titleLineHeight, fontWeight: 'bold', fill: themeColor, stroke: '#fff', lineWidth: 5, lineJoin: 'round', textAlign: (_d, ctx) => {
|
|
7779
|
+
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7780
|
+
if (m.verticalAlign) {
|
|
7781
|
+
return 'center';
|
|
7782
|
+
}
|
|
7783
|
+
return m.onLeft ? 'right' : 'left';
|
|
7784
|
+
}, textBaseline: 'top' }, (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) })
|
|
7591
7785
|
: null,
|
|
7592
7786
|
contentText.length
|
|
7593
|
-
? 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:
|
|
7787
|
+
? 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: (_d, ctx) => {
|
|
7788
|
+
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7789
|
+
if (m.verticalAlign) {
|
|
7790
|
+
return m.contentBox.x + m.contentBox.width / 2;
|
|
7791
|
+
}
|
|
7792
|
+
return m.onLeft ? m.contentBox.x + m.contentBox.width : m.contentBox.x;
|
|
7793
|
+
}, y: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.y, width: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, height: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, maxLineWidth: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.width, heightLimit: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentBox.height, text: buildRichContent(contentText, spec), fontSize: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentFontSize, lineHeight: (_d, ctx) => getWingBlockMetrics(spec, ctx, index).contentLineHeight, textAlign: (_d, ctx) => {
|
|
7794
|
+
const m = getWingBlockMetrics(spec, ctx, index);
|
|
7795
|
+
if (m.verticalAlign) {
|
|
7796
|
+
return 'center';
|
|
7797
|
+
}
|
|
7798
|
+
return m.onLeft ? 'right' : 'left';
|
|
7799
|
+
}, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#1f2430' }, (_f = spec.content) === null || _f === void 0 ? void 0 : _f.style) })
|
|
7594
7800
|
: null
|
|
7595
7801
|
].filter(Boolean)
|
|
7596
7802
|
};
|
|
@@ -7601,11 +7807,11 @@
|
|
|
7601
7807
|
const LADDER_HEADLINE_FONT_MAX = 240;
|
|
7602
7808
|
const LADDER_DIAGONAL_LINE_WIDTH = 2;
|
|
7603
7809
|
const LADDER_DIAGONAL_DASH = [12, 8];
|
|
7604
|
-
const LADDER_BLOCK_IMAGE_SIZE =
|
|
7810
|
+
const LADDER_BLOCK_IMAGE_SIZE = 100;
|
|
7605
7811
|
const LADDER_TITLE_FONT_SIZE = 28;
|
|
7606
|
-
const LADDER_TITLE_LINE_HEIGHT =
|
|
7607
|
-
const LADDER_CONTENT_FONT_SIZE =
|
|
7608
|
-
const LADDER_CONTENT_LINE_HEIGHT =
|
|
7812
|
+
const LADDER_TITLE_LINE_HEIGHT = 26;
|
|
7813
|
+
const LADDER_CONTENT_FONT_SIZE = 18;
|
|
7814
|
+
const LADDER_CONTENT_LINE_HEIGHT = 26;
|
|
7609
7815
|
const isDownLadder = (spec) => normalizeLayout(spec.layout).direction === 'down';
|
|
7610
7816
|
const getLadderDiagonalGeometry = (spec, ctx) => {
|
|
7611
7817
|
var _a;
|
|
@@ -7768,7 +7974,11 @@
|
|
|
7768
7974
|
? 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 }) })
|
|
7769
7975
|
: null,
|
|
7770
7976
|
contentText.length
|
|
7771
|
-
? 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
|
|
7977
|
+
? 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, {
|
|
7978
|
+
fontSize: LADDER_CONTENT_FONT_SIZE,
|
|
7979
|
+
lineHeight: LADDER_CONTENT_LINE_HEIGHT,
|
|
7980
|
+
align: align
|
|
7981
|
+
}), maxLineWidth: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).textBox.width, heightLimit: (_d, ctx) => getLadderBlockMetrics(spec, ctx, index).contentBox.height, textBaseline: 'top', wordBreak: 'break-word', ellipsis: '...', fill: '#596173' }, (_o = spec.content) === null || _o === void 0 ? void 0 : _o.style), { textAlign: align }) })
|
|
7772
7982
|
: null
|
|
7773
7983
|
].filter(Boolean)
|
|
7774
7984
|
};
|
|
@@ -7794,12 +8004,33 @@
|
|
|
7794
8004
|
const LARGE = 100;
|
|
7795
8005
|
const SMALL = 20;
|
|
7796
8006
|
const TEXT_RESERVE = 280;
|
|
7797
|
-
const PORTRAIT_BOTTOM_RESERVE = 160;
|
|
7798
8007
|
const arc = isArc(spec);
|
|
7799
8008
|
const arcDown = arc && normalizeLayout(spec.layout).direction === 'down';
|
|
7800
8009
|
const arcUp = arc && !arcDown;
|
|
7801
8010
|
const portrait = isPortrait(spec);
|
|
7802
8011
|
const ladder = isLadder(spec);
|
|
8012
|
+
const wing = isWing(spec);
|
|
8013
|
+
const clock = isClock(spec);
|
|
8014
|
+
const portraitBottomReserve = (() => {
|
|
8015
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
8016
|
+
if (!portrait) {
|
|
8017
|
+
return 0;
|
|
8018
|
+
}
|
|
8019
|
+
const count = (_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
8020
|
+
const canvasHeight = spec.height;
|
|
8021
|
+
if (!count || !canvasHeight) {
|
|
8022
|
+
return LARGE;
|
|
8023
|
+
}
|
|
8024
|
+
const slotHeight = canvasHeight / (count + 1);
|
|
8025
|
+
const imageHeight = (_d = (_c = spec.image) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : slotHeight * PORTRAIT_IMAGE_HEIGHT_RATIO;
|
|
8026
|
+
const contentHeight = slotHeight * PORTRAIT_CONTENT_HEIGHT_RATIO;
|
|
8027
|
+
const titleFontSize = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.fontSize) !== null && _g !== void 0 ? _g : 26);
|
|
8028
|
+
const titleLineHeight = Number((_k = (_j = (_h = spec.title) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.lineHeight) !== null && _k !== void 0 ? _k : Math.round(titleFontSize * 1.35));
|
|
8029
|
+
const textGap = 8;
|
|
8030
|
+
const titleToContentGap = 4;
|
|
8031
|
+
const breath = 16;
|
|
8032
|
+
return Math.max(LARGE, Math.round(imageHeight / 2 + textGap + titleLineHeight + titleToContentGap + contentHeight + breath));
|
|
8033
|
+
})();
|
|
7803
8034
|
const ladderHorizontalPadding = (() => {
|
|
7804
8035
|
var _a, _b, _c, _d, _e, _f;
|
|
7805
8036
|
if (!ladder) {
|
|
@@ -7810,42 +8041,53 @@
|
|
|
7810
8041
|
const imageGap = (_f = (_e = spec.image) === null || _e === void 0 ? void 0 : _e.gap) !== null && _f !== void 0 ? _f : DEFAULT_IMAGE_GAP;
|
|
7811
8042
|
const innerPadding = 12 * 2;
|
|
7812
8043
|
const contentWidth = Math.max(blockWidth - imageWidth - imageGap - innerPadding, DEFAULT_BLOCK_WIDTH * 0.5);
|
|
7813
|
-
|
|
8044
|
+
const ideal = Math.round(contentWidth * 2);
|
|
8045
|
+
const canvasWidth = spec.width;
|
|
8046
|
+
const cap = canvasWidth ? Math.floor(canvasWidth * 0.3) : ideal;
|
|
8047
|
+
return Math.min(ideal, cap);
|
|
7814
8048
|
})();
|
|
7815
8049
|
const ladderVerticalPadding = (() => {
|
|
7816
8050
|
var _a, _b;
|
|
7817
8051
|
if (!ladder) {
|
|
7818
8052
|
return 0;
|
|
7819
8053
|
}
|
|
7820
|
-
const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b :
|
|
7821
|
-
const
|
|
7822
|
-
const
|
|
7823
|
-
|
|
8054
|
+
const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 132;
|
|
8055
|
+
const ideal = Math.round(blockHeight * 3);
|
|
8056
|
+
const canvasHeight = spec.height;
|
|
8057
|
+
const cap = canvasHeight ? Math.floor(canvasHeight * 0.3) : ideal;
|
|
8058
|
+
return Math.min(ideal, cap);
|
|
7824
8059
|
})();
|
|
7825
|
-
const defaultTop = ladder ? ladderVerticalPadding : arcDown ?
|
|
7826
|
-
const defaultBottom =
|
|
7827
|
-
?
|
|
7828
|
-
:
|
|
7829
|
-
?
|
|
7830
|
-
:
|
|
7831
|
-
?
|
|
7832
|
-
:
|
|
7833
|
-
|
|
7834
|
-
|
|
8060
|
+
const defaultTop = clock ? 40 : ladder ? ladderVerticalPadding : arcDown ? 0 : arcUp ? TEXT_RESERVE : SMALL;
|
|
8061
|
+
const defaultBottom = clock
|
|
8062
|
+
? 60
|
|
8063
|
+
: portrait
|
|
8064
|
+
? portraitBottomReserve
|
|
8065
|
+
: wing
|
|
8066
|
+
? 300
|
|
8067
|
+
: arcUp
|
|
8068
|
+
? 0
|
|
8069
|
+
: arcDown
|
|
8070
|
+
? TEXT_RESERVE
|
|
8071
|
+
: LARGE;
|
|
8072
|
+
const arcHorizontalPadding = (() => {
|
|
8073
|
+
var _a, _b;
|
|
8074
|
+
if (!arc) {
|
|
8075
|
+
return SMALL;
|
|
8076
|
+
}
|
|
8077
|
+
const count = Math.max((_b = (_a = spec.data) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0, 1);
|
|
8078
|
+
const canvasWidth = spec.width;
|
|
8079
|
+
if (!canvasWidth) {
|
|
8080
|
+
return SMALL;
|
|
8081
|
+
}
|
|
8082
|
+
return Math.round(canvasWidth / (count + 1));
|
|
8083
|
+
})();
|
|
8084
|
+
const defaultLeft = clock ? 40 : ladder ? ladderHorizontalPadding : arcHorizontalPadding;
|
|
8085
|
+
const defaultRight = clock ? 40 : ladder ? ladderHorizontalPadding : arcHorizontalPadding;
|
|
7835
8086
|
const p = spec.padding;
|
|
7836
|
-
if (p
|
|
8087
|
+
if (p == null) {
|
|
7837
8088
|
spec.padding = [defaultTop, defaultRight, defaultBottom, defaultLeft];
|
|
7838
8089
|
return;
|
|
7839
8090
|
}
|
|
7840
|
-
if (typeof p === 'number') {
|
|
7841
|
-
spec.padding = [
|
|
7842
|
-
Math.max(p, defaultTop),
|
|
7843
|
-
Math.max(p, defaultRight),
|
|
7844
|
-
Math.max(p, defaultBottom),
|
|
7845
|
-
Math.max(p, defaultLeft)
|
|
7846
|
-
];
|
|
7847
|
-
return;
|
|
7848
|
-
}
|
|
7849
8091
|
if (Array.isArray(p)) {
|
|
7850
8092
|
const [t, r = defaultRight, b, l = defaultLeft] = p;
|
|
7851
8093
|
spec.padding = [t !== null && t !== void 0 ? t : defaultTop, r, b !== null && b !== void 0 ? b : defaultBottom, l];
|