@visactor/vchart-extension 2.1.0-alpha.13 → 2.1.0-alpha.15
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 +1960 -0
- package/build/index.min.js +2 -2
- package/cjs/charts/storyline/index.d.ts +4 -0
- package/cjs/charts/storyline/index.js +22 -0
- package/cjs/charts/storyline/index.js.map +1 -0
- package/cjs/charts/storyline/interface.d.ts +59 -0
- package/cjs/charts/storyline/interface.js +6 -0
- package/cjs/charts/storyline/interface.js.map +1 -0
- package/cjs/charts/storyline/layout.d.ts +53 -0
- package/cjs/charts/storyline/layout.js +215 -0
- package/cjs/charts/storyline/layout.js.map +1 -0
- package/cjs/charts/storyline/layouts/bowl.d.ts +5 -0
- package/cjs/charts/storyline/layouts/bowl.js +286 -0
- package/cjs/charts/storyline/layouts/bowl.js.map +1 -0
- package/cjs/charts/storyline/layouts/clock.d.ts +5 -0
- package/cjs/charts/storyline/layouts/clock.js +233 -0
- package/cjs/charts/storyline/layouts/clock.js.map +1 -0
- package/cjs/charts/storyline/layouts/common.d.ts +87 -0
- package/cjs/charts/storyline/layouts/common.js +287 -0
- package/cjs/charts/storyline/layouts/common.js.map +1 -0
- package/cjs/charts/storyline/layouts/default.d.ts +4 -0
- package/cjs/charts/storyline/layouts/default.js +179 -0
- package/cjs/charts/storyline/layouts/default.js.map +1 -0
- package/cjs/charts/storyline/layouts/dome.d.ts +5 -0
- package/cjs/charts/storyline/layouts/dome.js +286 -0
- package/cjs/charts/storyline/layouts/dome.js.map +1 -0
- package/cjs/charts/storyline/layouts/landscape.d.ts +4 -0
- package/cjs/charts/storyline/layouts/landscape.js +254 -0
- package/cjs/charts/storyline/layouts/landscape.js.map +1 -0
- package/cjs/charts/storyline/layouts/portrait.d.ts +4 -0
- package/cjs/charts/storyline/layouts/portrait.js +241 -0
- package/cjs/charts/storyline/layouts/portrait.js.map +1 -0
- package/cjs/charts/storyline/storyline-transformer.d.ts +4 -0
- package/cjs/charts/storyline/storyline-transformer.js +62 -0
- package/cjs/charts/storyline/storyline-transformer.js.map +1 -0
- package/cjs/charts/storyline/storyline.d.ts +16 -0
- package/cjs/charts/storyline/storyline.js +36 -0
- package/cjs/charts/storyline/storyline.js.map +1 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +5 -5
- package/cjs/index.js.map +1 -1
- package/esm/charts/storyline/index.d.ts +4 -0
- package/esm/charts/storyline/index.js +8 -0
- package/esm/charts/storyline/index.js.map +1 -0
- package/esm/charts/storyline/interface.d.ts +59 -0
- package/esm/charts/storyline/interface.js +2 -0
- package/esm/charts/storyline/interface.js.map +1 -0
- package/esm/charts/storyline/layout.d.ts +53 -0
- package/esm/charts/storyline/layout.js +205 -0
- package/esm/charts/storyline/layout.js.map +1 -0
- package/esm/charts/storyline/layouts/bowl.d.ts +5 -0
- package/esm/charts/storyline/layouts/bowl.js +278 -0
- package/esm/charts/storyline/layouts/bowl.js.map +1 -0
- package/esm/charts/storyline/layouts/clock.d.ts +5 -0
- package/esm/charts/storyline/layouts/clock.js +227 -0
- package/esm/charts/storyline/layouts/clock.js.map +1 -0
- package/esm/charts/storyline/layouts/common.d.ts +87 -0
- package/esm/charts/storyline/layouts/common.js +255 -0
- package/esm/charts/storyline/layouts/common.js.map +1 -0
- package/esm/charts/storyline/layouts/default.d.ts +4 -0
- package/esm/charts/storyline/layouts/default.js +172 -0
- package/esm/charts/storyline/layouts/default.js.map +1 -0
- package/esm/charts/storyline/layouts/dome.d.ts +5 -0
- package/esm/charts/storyline/layouts/dome.js +278 -0
- package/esm/charts/storyline/layouts/dome.js.map +1 -0
- package/esm/charts/storyline/layouts/landscape.d.ts +4 -0
- package/esm/charts/storyline/layouts/landscape.js +250 -0
- package/esm/charts/storyline/layouts/landscape.js.map +1 -0
- package/esm/charts/storyline/layouts/portrait.d.ts +4 -0
- package/esm/charts/storyline/layouts/portrait.js +238 -0
- package/esm/charts/storyline/layouts/portrait.js.map +1 -0
- package/esm/charts/storyline/storyline-transformer.d.ts +4 -0
- package/esm/charts/storyline/storyline-transformer.js +61 -0
- package/esm/charts/storyline/storyline-transformer.js.map +1 -0
- package/esm/charts/storyline/storyline.d.ts +16 -0
- package/esm/charts/storyline/storyline.js +29 -0
- package/esm/charts/storyline/storyline.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { LayoutZIndex } from "@visactor/vchart";
|
|
2
|
+
|
|
3
|
+
import { buildRichContent, getRegionGeometry, getThemeColor, normalizeLayout, normalizePadding, omitImageLayoutSpec, resolveBlockWidth, withAlpha } from "./common";
|
|
4
|
+
|
|
5
|
+
const DOME_BLOCK_IMAGE_SIZE = 140, DOME_TEXT_GAP_FROM_IMAGE = 10, DOME_TITLE_LINE_HEIGHT = 19, DOME_CONTENT_LINE_HEIGHT = 17, DOME_CONTENT_FONT_SIZE = 12, DOME_TEXT_BOX_HEIGHT = 300, DOME_TITLE_TO_CONTENT_GAP = 4, DOME_TEXT_LEFT_PADDING = 20, DOME_CENTER_IMAGE_WIDTH_RATIO = .32, DOME_CENTER_IMAGE_HEIGHT_RATIO = .32, DOME_ARC_TOP_GAP_FROM_CENTER_IMAGE = 300, getDomeCenterImageRect = (spec, ctx) => {
|
|
6
|
+
var _a, _b, _c, _e, _f;
|
|
7
|
+
const {width: width, height: height, startX: startX, startY: startY} = getRegionGeometry(ctx), padding = normalizePadding(null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding), innerWidth = Math.max(width - padding.left - padding.right, 1), innerHeight = Math.max(height - padding.top - padding.bottom, 1), w = Math.max(null !== (_c = null === (_b = spec.centerImage) || void 0 === _b ? void 0 : _b.width) && void 0 !== _c ? _c : .32 * innerWidth, 80), h = Math.max(null !== (_f = null === (_e = spec.centerImage) || void 0 === _e ? void 0 : _e.height) && void 0 !== _f ? _f : .32 * innerHeight, 60);
|
|
8
|
+
return {
|
|
9
|
+
x: startX + padding.left + innerWidth / 2 - w / 2,
|
|
10
|
+
y: startY + padding.top + innerHeight - h,
|
|
11
|
+
width: w,
|
|
12
|
+
height: h
|
|
13
|
+
};
|
|
14
|
+
}, getDomeArcGeometry = (spec, ctx) => {
|
|
15
|
+
var _a, _b, _c, _e;
|
|
16
|
+
const {width: width, startX: startX} = getRegionGeometry(ctx), blockPadding = normalizePadding(null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding), innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1), blockWidth = resolveBlockWidth(spec, width), layoutOpt = normalizeLayout(spec.layout), startAngle = null !== (_b = layoutOpt.startAngle) && void 0 !== _b ? _b : 200, endAngle = null !== (_c = layoutOpt.endAngle) && void 0 !== _c ? _c : 340, ratio = null !== (_e = layoutOpt.radiusRatio) && void 0 !== _e ? _e : .88, rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio, centerRect = getDomeCenterImageRect(spec, ctx), centerTop = centerRect.y, centerBottom = centerRect.y + centerRect.height, sinStart = Math.sin(startAngle / 180 * Math.PI), denom = Math.max(1 + sinStart, .05), ry = (centerRect.height + 300) / denom, cy = centerBottom - ry * sinStart;
|
|
17
|
+
return {
|
|
18
|
+
cx: startX + blockPadding.left + innerWidth / 2,
|
|
19
|
+
cy: cy,
|
|
20
|
+
rx: rx,
|
|
21
|
+
ry: ry,
|
|
22
|
+
startAngle: startAngle,
|
|
23
|
+
endAngle: endAngle,
|
|
24
|
+
centerTop: centerTop,
|
|
25
|
+
centerBottom: centerBottom
|
|
26
|
+
};
|
|
27
|
+
}, getDomeBlockCenter = (spec, ctx, index) => {
|
|
28
|
+
var _a, _b, _c, _e;
|
|
29
|
+
const arc = getDomeArcGeometry(spec, ctx), count = null !== (_b = null === (_a = spec.data) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
30
|
+
if (count <= 0) return {
|
|
31
|
+
x: arc.cx,
|
|
32
|
+
y: arc.cy
|
|
33
|
+
};
|
|
34
|
+
const t = 1 === count ? .5 : index / (count - 1), angle = (arc.startAngle + (arc.endAngle - arc.startAngle) * t) / 180 * Math.PI, px = arc.cx + Math.cos(angle) * arc.rx, py = arc.cy + Math.sin(angle) * arc.ry, nxRaw = Math.cos(angle) / arc.rx, nyRaw = Math.sin(angle) / arc.ry, nLen = Math.hypot(nxRaw, nyRaw) || 1, nx = nxRaw / nLen, ny = nyRaw / nLen, offset = (null !== (_e = null === (_c = spec.image) || void 0 === _c ? void 0 : _c.height) && void 0 !== _e ? _e : 140) / 2;
|
|
35
|
+
return {
|
|
36
|
+
x: px + nx * offset,
|
|
37
|
+
y: py + ny * offset
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const buildDomeArcMark = spec => {
|
|
42
|
+
var _a;
|
|
43
|
+
if (!0 !== (null === (_a = spec.line) || void 0 === _a ? void 0 : _a.visible)) return null;
|
|
44
|
+
const themeColor = getThemeColor(spec);
|
|
45
|
+
return {
|
|
46
|
+
type: "group",
|
|
47
|
+
name: "storyline-dome-arc",
|
|
48
|
+
zIndex: LayoutZIndex.Mark,
|
|
49
|
+
children: [ {
|
|
50
|
+
type: "path",
|
|
51
|
+
name: "storyline-dome-arc-path",
|
|
52
|
+
interactive: !1,
|
|
53
|
+
style: {
|
|
54
|
+
stroke: themeColor,
|
|
55
|
+
lineWidth: 2,
|
|
56
|
+
lineCap: "round",
|
|
57
|
+
fill: "transparent",
|
|
58
|
+
fillOpacity: 0,
|
|
59
|
+
path: (_d, ctx) => {
|
|
60
|
+
const arc = getDomeArcGeometry(spec, ctx), span = arc.endAngle - arc.startAngle, segments = [];
|
|
61
|
+
for (let i = 0; i <= 64; i++) {
|
|
62
|
+
const t = i / 64, angle = (arc.startAngle + span * t) / 180 * Math.PI, x = arc.cx + Math.cos(angle) * arc.rx, y = arc.cy + Math.sin(angle) * arc.ry;
|
|
63
|
+
segments.push(`${0 === i ? "M" : "L"} ${x.toFixed(2)} ${y.toFixed(2)}`);
|
|
64
|
+
}
|
|
65
|
+
return segments.join(" ");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} ]
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const buildDomeCenterImageMark = spec => {
|
|
73
|
+
var _a, _b, _c, _e;
|
|
74
|
+
if (!(!1 !== (null === (_a = spec.centerImage) || void 0 === _a ? void 0 : _a.visible))) return null;
|
|
75
|
+
const themeColor = getThemeColor(spec), hasImage = !!(null === (_b = spec.centerImage) || void 0 === _b ? void 0 : _b.image), symbolGradient = {
|
|
76
|
+
gradient: "linear",
|
|
77
|
+
x0: .5,
|
|
78
|
+
y0: 0,
|
|
79
|
+
x1: .5,
|
|
80
|
+
y1: 1,
|
|
81
|
+
stops: [ {
|
|
82
|
+
offset: 0,
|
|
83
|
+
color: withAlpha(themeColor, .15)
|
|
84
|
+
}, {
|
|
85
|
+
offset: 1,
|
|
86
|
+
color: themeColor
|
|
87
|
+
} ]
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
type: "group",
|
|
91
|
+
name: "storyline-dome-center",
|
|
92
|
+
zIndex: LayoutZIndex.Mark,
|
|
93
|
+
children: [ {
|
|
94
|
+
type: "symbol",
|
|
95
|
+
name: "storyline-dome-center-symbol",
|
|
96
|
+
interactive: !1,
|
|
97
|
+
style: {
|
|
98
|
+
x: (_d, ctx) => {
|
|
99
|
+
const r = getDomeCenterImageRect(spec, ctx);
|
|
100
|
+
return r.x + r.width / 2;
|
|
101
|
+
},
|
|
102
|
+
y: (_d, ctx) => {
|
|
103
|
+
const r = getDomeCenterImageRect(spec, ctx);
|
|
104
|
+
return r.y + r.height / 2;
|
|
105
|
+
},
|
|
106
|
+
size: (_d, ctx) => {
|
|
107
|
+
const r = getDomeCenterImageRect(spec, ctx);
|
|
108
|
+
return 1.1 * Math.max(r.width, r.height);
|
|
109
|
+
},
|
|
110
|
+
symbolType: "circle",
|
|
111
|
+
fill: symbolGradient,
|
|
112
|
+
stroke: themeColor,
|
|
113
|
+
lineWidth: 2
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
type: "rect",
|
|
117
|
+
name: "storyline-dome-center-rect",
|
|
118
|
+
interactive: !1,
|
|
119
|
+
style: {
|
|
120
|
+
x: (_d, ctx) => getDomeCenterImageRect(spec, ctx).x,
|
|
121
|
+
y: (_d, ctx) => getDomeCenterImageRect(spec, ctx).y,
|
|
122
|
+
width: (_d, ctx) => getDomeCenterImageRect(spec, ctx).width,
|
|
123
|
+
height: (_d, ctx) => getDomeCenterImageRect(spec, ctx).height,
|
|
124
|
+
cornerRadius: 12,
|
|
125
|
+
fill: "#ffffff",
|
|
126
|
+
stroke: themeColor,
|
|
127
|
+
lineWidth: 2
|
|
128
|
+
}
|
|
129
|
+
}, hasImage ? Object.assign(Object.assign({
|
|
130
|
+
type: "image",
|
|
131
|
+
name: "storyline-dome-center-image",
|
|
132
|
+
interactive: !1
|
|
133
|
+
}, spec.centerImage), {
|
|
134
|
+
style: Object.assign({
|
|
135
|
+
x: (_d, ctx) => getDomeCenterImageRect(spec, ctx).x,
|
|
136
|
+
y: (_d, ctx) => getDomeCenterImageRect(spec, ctx).y,
|
|
137
|
+
width: (_d, ctx) => getDomeCenterImageRect(spec, ctx).width,
|
|
138
|
+
height: (_d, ctx) => getDomeCenterImageRect(spec, ctx).height,
|
|
139
|
+
image: null === (_c = spec.centerImage) || void 0 === _c ? void 0 : _c.image,
|
|
140
|
+
cornerRadius: 12,
|
|
141
|
+
repeatX: "no-repeat",
|
|
142
|
+
repeatY: "no-repeat",
|
|
143
|
+
imageMode: "cover",
|
|
144
|
+
imagePosition: "center"
|
|
145
|
+
}, null === (_e = spec.centerImage) || void 0 === _e ? void 0 : _e.style)
|
|
146
|
+
}) : null ].filter(Boolean)
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const getDomeBlockMetrics = spec => {
|
|
151
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
152
|
+
const titleFontSize = Number(null !== (_c = null === (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c : 14), titleLineHeight = Number(null !== (_g = null === (_f = null === (_e = spec.title) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.lineHeight) && void 0 !== _g ? _g : Math.max(19, Math.round(1.35 * titleFontSize))), contentFontSize = Number(null !== (_k = null === (_j = null === (_h = spec.content) || void 0 === _h ? void 0 : _h.style) || void 0 === _j ? void 0 : _j.fontSize) && void 0 !== _k ? _k : 12), contentLineHeight = Number(null !== (_o = null === (_m = null === (_l = spec.content) || void 0 === _l ? void 0 : _l.style) || void 0 === _m ? void 0 : _m.lineHeight) && void 0 !== _o ? _o : 17), contentHeight = Math.max(300 - titleLineHeight - 4, contentLineHeight), imageWidth = null !== (_q = null === (_p = spec.image) || void 0 === _p ? void 0 : _p.width) && void 0 !== _q ? _q : 140, imageHeight = null !== (_s = null === (_r = spec.image) || void 0 === _r ? void 0 : _r.height) && void 0 !== _s ? _s : 140, imageBox = {
|
|
153
|
+
x: -imageWidth / 2,
|
|
154
|
+
y: -imageHeight / 2,
|
|
155
|
+
width: imageWidth,
|
|
156
|
+
height: imageHeight
|
|
157
|
+
}, textBox = {
|
|
158
|
+
x: -imageWidth / 2 + 20,
|
|
159
|
+
y: imageBox.y - 10 - 300,
|
|
160
|
+
width: imageWidth - 20,
|
|
161
|
+
height: 300
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
titleFontSize: titleFontSize,
|
|
165
|
+
titleLineHeight: titleLineHeight,
|
|
166
|
+
contentFontSize: contentFontSize,
|
|
167
|
+
contentLineHeight: contentLineHeight,
|
|
168
|
+
imageBox: imageBox,
|
|
169
|
+
textBox: textBox,
|
|
170
|
+
contentBox: {
|
|
171
|
+
x: textBox.x,
|
|
172
|
+
y: textBox.y + titleLineHeight + 4,
|
|
173
|
+
width: textBox.width,
|
|
174
|
+
height: contentHeight
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const buildDomeBlockMark = (spec, block, index) => {
|
|
180
|
+
var _a, _b, _c, _e;
|
|
181
|
+
const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], themeColor = getThemeColor(spec), metrics = getDomeBlockMetrics(spec);
|
|
182
|
+
return {
|
|
183
|
+
type: "group",
|
|
184
|
+
id: `storyline-block-${null !== (_a = block.id) && void 0 !== _a ? _a : index}`,
|
|
185
|
+
name: `storyline-block-${index}`,
|
|
186
|
+
zIndex: LayoutZIndex.Mark + 1,
|
|
187
|
+
style: {
|
|
188
|
+
x: (_d, ctx) => getDomeBlockCenter(spec, ctx, index).x,
|
|
189
|
+
y: (_d, ctx) => getDomeBlockCenter(spec, ctx, index).y
|
|
190
|
+
},
|
|
191
|
+
children: [ {
|
|
192
|
+
type: "rect",
|
|
193
|
+
name: `storyline-block-connector-${index}`,
|
|
194
|
+
interactive: !1,
|
|
195
|
+
style: {
|
|
196
|
+
x: metrics.imageBox.x,
|
|
197
|
+
y: metrics.textBox.y,
|
|
198
|
+
width: 2,
|
|
199
|
+
height: Math.max(metrics.imageBox.y - metrics.textBox.y, 0),
|
|
200
|
+
fill: themeColor,
|
|
201
|
+
fillOpacity: .6
|
|
202
|
+
}
|
|
203
|
+
}, hasImage ? Object.assign(Object.assign({
|
|
204
|
+
type: "image",
|
|
205
|
+
name: `storyline-block-image-${index}`,
|
|
206
|
+
interactive: !1
|
|
207
|
+
}, omitImageLayoutSpec(spec.image)), {
|
|
208
|
+
style: Object.assign({
|
|
209
|
+
x: metrics.imageBox.x,
|
|
210
|
+
y: metrics.imageBox.y,
|
|
211
|
+
width: metrics.imageBox.width,
|
|
212
|
+
height: metrics.imageBox.height,
|
|
213
|
+
image: block.image,
|
|
214
|
+
cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,
|
|
215
|
+
repeatX: "no-repeat",
|
|
216
|
+
repeatY: "no-repeat",
|
|
217
|
+
imageMode: "cover",
|
|
218
|
+
imagePosition: "center",
|
|
219
|
+
stroke: themeColor,
|
|
220
|
+
lineWidth: 2
|
|
221
|
+
}, null === (_b = spec.image) || void 0 === _b ? void 0 : _b.style)
|
|
222
|
+
}) : {
|
|
223
|
+
type: "rect",
|
|
224
|
+
name: `storyline-block-image-bg-${index}`,
|
|
225
|
+
interactive: !1,
|
|
226
|
+
style: {
|
|
227
|
+
x: metrics.imageBox.x,
|
|
228
|
+
y: metrics.imageBox.y,
|
|
229
|
+
width: metrics.imageBox.width,
|
|
230
|
+
height: metrics.imageBox.height,
|
|
231
|
+
cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,
|
|
232
|
+
fill: "#ffffff",
|
|
233
|
+
stroke: themeColor,
|
|
234
|
+
lineWidth: 2
|
|
235
|
+
}
|
|
236
|
+
}, block.title ? Object.assign(Object.assign({
|
|
237
|
+
type: "text",
|
|
238
|
+
name: `storyline-block-title-${index}`,
|
|
239
|
+
interactive: !1
|
|
240
|
+
}, spec.title), {
|
|
241
|
+
style: Object.assign({
|
|
242
|
+
x: metrics.textBox.x,
|
|
243
|
+
y: metrics.textBox.y,
|
|
244
|
+
text: block.title,
|
|
245
|
+
maxLineWidth: metrics.textBox.width,
|
|
246
|
+
fontSize: metrics.titleFontSize,
|
|
247
|
+
lineHeight: metrics.titleLineHeight,
|
|
248
|
+
fontWeight: "bold",
|
|
249
|
+
fill: "#1f2430",
|
|
250
|
+
textAlign: "left",
|
|
251
|
+
textBaseline: "top"
|
|
252
|
+
}, null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style)
|
|
253
|
+
}) : null, contentText.length ? Object.assign(Object.assign({
|
|
254
|
+
type: "text",
|
|
255
|
+
name: `storyline-block-content-${index}`,
|
|
256
|
+
interactive: !1
|
|
257
|
+
}, spec.content), {
|
|
258
|
+
textType: "rich",
|
|
259
|
+
style: Object.assign({
|
|
260
|
+
x: metrics.contentBox.x,
|
|
261
|
+
y: metrics.contentBox.y,
|
|
262
|
+
width: metrics.contentBox.width,
|
|
263
|
+
height: metrics.contentBox.height,
|
|
264
|
+
maxLineWidth: metrics.contentBox.width,
|
|
265
|
+
heightLimit: metrics.contentBox.height,
|
|
266
|
+
text: buildRichContent(contentText, spec),
|
|
267
|
+
fontSize: 12,
|
|
268
|
+
lineHeight: 17,
|
|
269
|
+
textAlign: "left",
|
|
270
|
+
textBaseline: "top",
|
|
271
|
+
wordBreak: "break-word",
|
|
272
|
+
ellipsis: "...",
|
|
273
|
+
fill: "#596173"
|
|
274
|
+
}, null === (_e = spec.content) || void 0 === _e ? void 0 : _e.style)
|
|
275
|
+
}) : null ].filter(Boolean)
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
//# sourceMappingURL=dome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/charts/storyline/layouts/dome.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAIL,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACV,MAAM,UAAU,CAAC;AAIlB,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAEpC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,8BAA8B,GAAG,IAAI,CAAC;A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EACzC,QAAQ,EAAE,sBAAsB,EAChC,UAAU,EAAE,wBAAwB,EACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,KAAK,EACf,IAAI,EAAE,SAAS,IACZ,MAAA,IAAI,CAAC,OAAO,0CAAE,KAAK,IAEG;gBAC/B,CAAC,CAAC,IAAI;SACT,CAAC,MAAM,CAAC,OAAO,CAA2B;KAC5C,CAAC;AACJ,CAAC,CAAC","file":"dome.js","sourcesContent":["import type { IExtensionGroupMarkSpec } from '@visactor/vchart';\nimport { LayoutZIndex } from '@visactor/vchart';\nimport type { IStorylineBlock, IStorylineSpec } from '../interface';\nimport {\n type ICustomMarkSpec,\n type LayoutContext,\n type StorylinePoint,\n buildRichContent,\n getRegionGeometry,\n getThemeColor,\n normalizeLayout,\n normalizePadding,\n omitImageLayoutSpec,\n resolveBlockWidth,\n withAlpha\n} from './common';\n\n// dome 布局:弧形排列 + 底部 centerImage\n// image 默认为圆形,DOME_BLOCK_IMAGE_SIZE 即圆的直径\nconst DOME_BLOCK_IMAGE_SIZE = 140;\nconst DOME_TEXT_GAP_FROM_IMAGE = 10;\nconst DOME_TITLE_LINE_HEIGHT = 19;\nconst DOME_CONTENT_LINE_HEIGHT = 17;\nconst DOME_CONTENT_FONT_SIZE = 12;\n// title + content 区域总高度(默认 400px,溢出由富文本 heightLimit + ellipsis 自动截断)\nconst DOME_TEXT_BOX_HEIGHT = 300;\nconst DOME_TITLE_TO_CONTENT_GAP = 4;\n// 引导线与 title/content 之间的水平间距\nconst DOME_TEXT_LEFT_PADDING = 20;\nconst DOME_CENTER_IMAGE_WIDTH_RATIO = 0.32;\nconst DOME_CENTER_IMAGE_HEIGHT_RATIO = 0.32;\n// 弧线最高点(视觉上的顶点)距离 centerImage 顶部的距离\nconst DOME_ARC_TOP_GAP_FROM_CENTER_IMAGE = 300;\n\n/**\n * 计算 dome 布局 centerImage 的 box:水平居中、垂直贴底(位于 inner 区域底部)。\n */\nconst getDomeCenterImageRect = (spec: IStorylineSpec, ctx: LayoutContext) => {\n const { width, height, startX, startY } = getRegionGeometry(ctx);\n const padding = normalizePadding(spec.block?.padding);\n const innerWidth = Math.max(width - padding.left - padding.right, 1);\n const innerHeight = Math.max(height - padding.top - padding.bottom, 1);\n const w = Math.max(spec.centerImage?.width ?? innerWidth * DOME_CENTER_IMAGE_WIDTH_RATIO, 80);\n const h = Math.max(spec.centerImage?.height ?? innerHeight * DOME_CENTER_IMAGE_HEIGHT_RATIO, 60);\n const cx = startX + padding.left + innerWidth / 2;\n // 紧贴底部,仅保留 spec.block.padding.bottom 的留白\n const top = startY + padding.top + innerHeight - h;\n return { x: cx - w / 2, y: top, width: w, height: h };\n};\n\n/**\n * 计算 dome 弧线的几何参数:\n * - cx / rx / startAngle / endAngle 与 layout.ts 中 arcCenters 一致;\n * - cy 与 ry 由两条对齐约束反推:\n * 1) 弧线起/终点 y == centerImage 底部\n * 2) 弧线最高点 y == centerImage 顶部 - DOME_ARC_TOP_GAP_FROM_CENTER_IMAGE\n *\n * 解方程:\n * cy + ry * sin(startAngle) = centerImageBottom\n * cy - ry = centerImageTop - GAP\n * → ry = (centerImageHeight + GAP) / (1 + sin(startAngle))\n * cy = centerImageBottom - ry * sin(startAngle)\n *\n * 仅当 sin(startAngle) ∈ [-1, 0) 时(即 startAngle 在 (180°, 360°) 区间,碗形),\n * 该方程组有合理正解。\n */\nconst getDomeArcGeometry = (spec: IStorylineSpec, ctx: LayoutContext) => {\n const { width, startX } = getRegionGeometry(ctx);\n const blockPadding = normalizePadding(spec.block?.padding);\n const innerWidth = Math.max(width - blockPadding.left - blockPadding.right, 1);\n const blockWidth = resolveBlockWidth(spec, width);\n const layoutOpt = normalizeLayout(spec.layout);\n const startAngle = layoutOpt.startAngle ?? 200;\n const endAngle = layoutOpt.endAngle ?? 340;\n const ratio = layoutOpt.radiusRatio ?? 0.88;\n const rx = Math.max((innerWidth - blockWidth) / 2, 1) * ratio;\n const centerRect = getDomeCenterImageRect(spec, ctx);\n const centerTop = centerRect.y;\n const centerBottom = centerRect.y + centerRect.height;\n const sinStart = Math.sin((startAngle / 180) * Math.PI);\n // sinStart 接近 -1 时 ry → ∞;这里限制下界以防 startAngle 配置异常\n const denom = Math.max(1 + sinStart, 0.05);\n const ry = (centerRect.height + DOME_ARC_TOP_GAP_FROM_CENTER_IMAGE) / denom;\n const cy = centerBottom - ry * sinStart;\n return {\n cx: startX + blockPadding.left + innerWidth / 2,\n cy,\n rx,\n ry,\n startAngle,\n endAngle,\n // 调试/对齐用:上下两个对齐参考点\n centerTop,\n centerBottom\n };\n};\n\n/**\n * 在 do me 新弧线上按 index 采样 block 中心,与 arc 完全同步。\n * 同时让 block 沿弧线径向向外偏移 imageHeight/2,\n * 使 image 内边贴在弧线上,image + text 整体位于弧线外侧。\n */\nconst getDomeBlockCenter = (spec: IStorylineSpec, ctx: LayoutContext, index: number): StorylinePoint => {\n const arc = getDomeArcGeometry(spec, ctx);\n const count = spec.data?.length ?? 0;\n if (count <= 0) {\n return { x: arc.cx, y: arc.cy };\n }\n const t = count === 1 ? 0.5 : index / (count - 1);\n const angle = ((arc.startAngle + (arc.endAngle - arc.startAngle) * t) / 180) * Math.PI;\n const px = arc.cx + Math.cos(angle) * arc.rx;\n const py = arc.cy + Math.sin(angle) * arc.ry;\n // 椭圆在 (px,py) 处的外法向量 ∝ (cos(angle)/rx, sin(angle)/ry)\n const nxRaw = Math.cos(angle) / arc.rx;\n const nyRaw = Math.sin(angle) / arc.ry;\n const nLen = Math.hypot(nxRaw, nyRaw) || 1;\n const nx = nxRaw / nLen;\n const ny = nyRaw / nLen;\n const imageHeight = spec.image?.height ?? DOME_BLOCK_IMAGE_SIZE;\n const offset = imageHeight / 2;\n return { x: px + nx * offset, y: py + ny * offset };\n};\n\n/**\n * 贯穿所有 block 的半圆弧线 mark(path 通过沿椭圆采样实现,\n * 与 dome block 的弧形布局完全重合)\n *\n * 默认不展示,仅当用户在 spec.line.visible 显式置为 true 时才渲染。\n */\nexport const buildDomeArcMark = (spec: IStorylineSpec): IExtensionGroupMarkSpec | null => {\n if (spec.line?.visible !== true) {\n return null;\n }\n const themeColor = getThemeColor(spec);\n return {\n type: 'group' as any,\n name: 'storyline-dome-arc',\n zIndex: LayoutZIndex.Mark,\n children: [\n {\n type: 'path',\n name: 'storyline-dome-arc-path',\n interactive: false,\n style: {\n stroke: themeColor,\n lineWidth: 2,\n lineCap: 'round',\n fill: 'transparent',\n fillOpacity: 0,\n path: (_d: unknown, ctx: LayoutContext) => {\n const arc = getDomeArcGeometry(spec, ctx);\n const span = arc.endAngle - arc.startAngle;\n const samples = 64;\n const segments: string[] = [];\n for (let i = 0; i <= samples; i++) {\n const t = i / samples;\n const angle = ((arc.startAngle + span * t) / 180) * Math.PI;\n const x = arc.cx + Math.cos(angle) * arc.rx;\n const y = arc.cy + Math.sin(angle) * arc.ry;\n segments.push(`${i === 0 ? 'M' : 'L'} ${x.toFixed(2)} ${y.toFixed(2)}`);\n }\n return segments.join(' ');\n }\n }\n } as ICustomMarkSpec<'path'>\n ]\n };\n};\n\nexport const buildDomeCenterImageMark = (spec: IStorylineSpec): IExtensionGroupMarkSpec | null => {\n const visible = spec.centerImage?.visible !== false;\n if (!visible) {\n return null;\n }\n const themeColor = getThemeColor(spec);\n const hasImage = !!spec.centerImage?.image;\n // 主题色生成的线性渐变(顶部偏淡 → 底部主题色),作为 centerImage 位置的 symbol 填充\n const symbolGradient = {\n gradient: 'linear',\n x0: 0.5,\n y0: 0,\n x1: 0.5,\n y1: 1,\n stops: [\n { offset: 0, color: withAlpha(themeColor, 0.15) },\n { offset: 1, color: themeColor }\n ]\n };\n return {\n type: 'group' as any,\n name: 'storyline-dome-center',\n zIndex: LayoutZIndex.Mark,\n children: [\n // 默认 symbol:位于 centerImage 的位置,外径略大于 centerImage(填充渐变作为视觉底盘)\n {\n type: 'symbol',\n name: 'storyline-dome-center-symbol',\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => {\n const r = getDomeCenterImageRect(spec, ctx);\n return r.x + r.width / 2;\n },\n y: (_d: unknown, ctx: LayoutContext) => {\n const r = getDomeCenterImageRect(spec, ctx);\n return r.y + r.height / 2;\n },\n size: (_d: unknown, ctx: LayoutContext) => {\n const r = getDomeCenterImageRect(spec, ctx);\n // symbol 直径略大于 centerImage 较短边,形成\"圆形底盘\"\n return Math.max(r.width, r.height) * 1.1;\n },\n symbolType: 'circle',\n fill: symbolGradient,\n stroke: themeColor,\n lineWidth: 2\n }\n } as ICustomMarkSpec<'symbol'>,\n {\n type: 'rect',\n name: 'storyline-dome-center-rect',\n interactive: false,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).x,\n y: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).y,\n width: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).width,\n height: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).height,\n cornerRadius: 12,\n fill: '#ffffff',\n stroke: themeColor,\n lineWidth: 2\n }\n } as ICustomMarkSpec<'rect'>,\n hasImage\n ? ({\n type: 'image',\n name: 'storyline-dome-center-image',\n interactive: false,\n ...spec.centerImage,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).x,\n y: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).y,\n width: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).width,\n height: (_d: unknown, ctx: LayoutContext) => getDomeCenterImageRect(spec, ctx).height,\n image: spec.centerImage?.image,\n cornerRadius: 12,\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: 'cover',\n imagePosition: 'center',\n ...spec.centerImage?.style\n }\n } as ICustomMarkSpec<'image'>)\n : null\n ].filter(Boolean) as ICustomMarkSpec<any>[]\n };\n};\n\nconst getDomeBlockMetrics = (spec: IStorylineSpec) => {\n const titleFontSize = Number((spec.title?.style as any)?.fontSize ?? 14);\n const titleLineHeight = Number(\n (spec.title?.style as any)?.lineHeight ?? Math.max(DOME_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35))\n );\n const contentFontSize = Number((spec.content?.style as any)?.fontSize ?? DOME_CONTENT_FONT_SIZE);\n const contentLineHeight = Number((spec.content?.style as any)?.lineHeight ?? DOME_CONTENT_LINE_HEIGHT);\n const titleToContentGap = DOME_TITLE_TO_CONTENT_GAP;\n // text 区域总高度固定为 DOME_TEXT_BOX_HEIGHT,content 占除 title 与间距外的全部高度\n const textHeight = DOME_TEXT_BOX_HEIGHT;\n const contentHeight = Math.max(textHeight - titleLineHeight - titleToContentGap, contentLineHeight);\n\n const imageWidth = spec.image?.width ?? DOME_BLOCK_IMAGE_SIZE;\n const imageHeight = spec.image?.height ?? DOME_BLOCK_IMAGE_SIZE;\n\n // image 位于 block 中心下半部分,title/content 在 image 上方\n const imageBox = {\n x: -imageWidth / 2,\n y: -imageHeight / 2,\n width: imageWidth,\n height: imageHeight\n };\n const textBox = {\n x: -imageWidth / 2 + DOME_TEXT_LEFT_PADDING,\n y: imageBox.y - DOME_TEXT_GAP_FROM_IMAGE - textHeight,\n width: imageWidth - DOME_TEXT_LEFT_PADDING,\n height: textHeight\n };\n const contentBox = {\n x: textBox.x,\n y: textBox.y + titleLineHeight + titleToContentGap,\n width: textBox.width,\n height: contentHeight\n };\n return {\n titleFontSize,\n titleLineHeight,\n contentFontSize,\n contentLineHeight,\n imageBox,\n textBox,\n contentBox\n };\n};\n\nexport const buildDomeBlockMark = (\n spec: IStorylineSpec,\n block: IStorylineBlock,\n index: number\n): IExtensionGroupMarkSpec => {\n const hasImage = !!block.image;\n const contentText = Array.isArray(block.content) ? block.content : block.content ? [block.content] : [];\n const themeColor = getThemeColor(spec);\n const metrics = getDomeBlockMetrics(spec);\n\n return {\n type: 'group' as any,\n id: `storyline-block-${block.id ?? index}`,\n name: `storyline-block-${index}`,\n zIndex: LayoutZIndex.Mark + 1,\n style: {\n x: (_d: unknown, ctx: LayoutContext) => getDomeBlockCenter(spec, ctx, index).x,\n y: (_d: unknown, ctx: LayoutContext) => getDomeBlockCenter(spec, ctx, index).y\n },\n children: [\n // title / content 左侧的垂直引导线(贯穿 text + image 顶部,与文字保持 padding)\n {\n type: 'rect',\n name: `storyline-block-connector-${index}`,\n interactive: false,\n style: {\n x: metrics.imageBox.x,\n y: metrics.textBox.y,\n width: 2,\n height: Math.max(metrics.imageBox.y - metrics.textBox.y, 0),\n fill: themeColor,\n fillOpacity: 0.6\n }\n } as ICustomMarkSpec<'rect'>,\n hasImage\n ? ({\n type: 'image',\n name: `storyline-block-image-${index}`,\n interactive: false,\n ...omitImageLayoutSpec(spec.image),\n style: {\n x: metrics.imageBox.x,\n y: metrics.imageBox.y,\n width: metrics.imageBox.width,\n height: metrics.imageBox.height,\n image: block.image,\n // 圆形裁剪:cornerRadius = min(w,h) / 2\n cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: 'cover',\n imagePosition: 'center',\n stroke: themeColor,\n lineWidth: 2,\n ...spec.image?.style\n }\n } as ICustomMarkSpec<'image'>)\n : ({\n type: 'rect',\n name: `storyline-block-image-bg-${index}`,\n interactive: false,\n style: {\n x: metrics.imageBox.x,\n y: metrics.imageBox.y,\n width: metrics.imageBox.width,\n height: metrics.imageBox.height,\n cornerRadius: Math.min(metrics.imageBox.width, metrics.imageBox.height) / 2,\n fill: '#ffffff',\n stroke: themeColor,\n lineWidth: 2\n }\n } as ICustomMarkSpec<'rect'>),\n block.title\n ? ({\n type: 'text',\n name: `storyline-block-title-${index}`,\n interactive: false,\n ...spec.title,\n style: {\n x: metrics.textBox.x,\n y: metrics.textBox.y,\n text: block.title,\n maxLineWidth: metrics.textBox.width,\n fontSize: metrics.titleFontSize,\n lineHeight: metrics.titleLineHeight,\n fontWeight: 'bold',\n fill: '#1f2430',\n textAlign: 'left',\n textBaseline: 'top',\n ...spec.title?.style\n }\n } as ICustomMarkSpec<'text'>)\n : null,\n contentText.length\n ? ({\n type: 'text',\n name: `storyline-block-content-${index}`,\n interactive: false,\n ...spec.content,\n textType: 'rich',\n style: {\n x: metrics.contentBox.x,\n y: metrics.contentBox.y,\n width: metrics.contentBox.width,\n height: metrics.contentBox.height,\n maxLineWidth: metrics.contentBox.width,\n heightLimit: metrics.contentBox.height,\n text: buildRichContent(contentText, spec),\n fontSize: DOME_CONTENT_FONT_SIZE,\n lineHeight: DOME_CONTENT_LINE_HEIGHT,\n textAlign: 'left',\n textBaseline: 'top',\n wordBreak: 'break-word',\n ellipsis: '...',\n fill: '#596173',\n ...spec.content?.style\n }\n } as ICustomMarkSpec<'text'>)\n : null\n ].filter(Boolean) as ICustomMarkSpec<any>[]\n };\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IExtensionGroupMarkSpec } from '@visactor/vchart';
|
|
2
|
+
import type { IStorylineBlock, IStorylineSpec } from '../interface';
|
|
3
|
+
export declare const buildLandscapeConnectingCurve: (spec: IStorylineSpec) => IExtensionGroupMarkSpec | null;
|
|
4
|
+
export declare const buildLandscapeBlockMark: (spec: IStorylineSpec, block: IStorylineBlock, index: number) => IExtensionGroupMarkSpec;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { LayoutZIndex } from "@visactor/vchart";
|
|
2
|
+
|
|
3
|
+
import { DEFAULT_BLOCK_HEIGHT, buildRichContent, buildSmoothCurvePath, getLayout, getThemeColor, normalizePadding, omitImageLayoutSpec, resolveBlockWidth } from "./common";
|
|
4
|
+
|
|
5
|
+
const LANDSCAPE_IMAGE_HEIGHT_RATIO = .42, LANDSCAPE_DETACHED_GAP = 64, LANDSCAPE_CONNECTOR_ARROW_SIZE = 9, LANDSCAPE_CONNECTOR_X_RATIO = .2, LANDSCAPE_TEXT_GAP_FROM_CONNECTOR = 12, LANDSCAPE_CONTENT_LINES = 4, LANDSCAPE_TITLE_LINE_HEIGHT = 19, LANDSCAPE_CONTENT_LINE_HEIGHT = 18, LANDSCAPE_CONTENT_FONT_SIZE = 12, LANDSCAPE_TITLE_TO_CONTENT_GAP = 4, getLandscapeImageCenter = (spec, ctx, index) => {
|
|
6
|
+
var _a, _b, _c, _e;
|
|
7
|
+
const lb = getLayout(spec, ctx).blocks[index];
|
|
8
|
+
if (!lb) return null;
|
|
9
|
+
return {
|
|
10
|
+
x: null !== (_b = null === (_a = lb.center) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : lb.x + lb.width / 2,
|
|
11
|
+
y: (null !== (_e = null === (_c = lb.center) || void 0 === _c ? void 0 : _c.y) && void 0 !== _e ? _e : lb.y + lb.height / 2) + (index % 2 == 0 ? -1 : 1) * lb.height * .1
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const buildLandscapeConnectingCurve = spec => {
|
|
16
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
17
|
+
const themeColor = getThemeColor(spec), lineStyle = null !== (_b = null === (_a = spec.line) || void 0 === _a ? void 0 : _a.style) && void 0 !== _b ? _b : {}, count = null !== (_e = null === (_c = spec.data) || void 0 === _c ? void 0 : _c.length) && void 0 !== _e ? _e : 0, symbolChildren = [];
|
|
18
|
+
for (let i = 0; i < count; i++) {
|
|
19
|
+
const idx = i;
|
|
20
|
+
symbolChildren.push({
|
|
21
|
+
type: "symbol",
|
|
22
|
+
name: `storyline-landscape-curve-symbol-${idx}`,
|
|
23
|
+
interactive: !1,
|
|
24
|
+
style: {
|
|
25
|
+
symbolType: "circle",
|
|
26
|
+
size: 14,
|
|
27
|
+
fill: themeColor,
|
|
28
|
+
x: (_d, ctx) => {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
return null !== (_b = null === (_a = getLandscapeImageCenter(spec, ctx, idx)) || void 0 === _a ? void 0 : _a.x) && void 0 !== _b ? _b : 0;
|
|
31
|
+
},
|
|
32
|
+
y: (_d, ctx) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
return null !== (_b = null === (_a = getLandscapeImageCenter(spec, ctx, idx)) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
type: "group",
|
|
41
|
+
name: "storyline-landscape-curve",
|
|
42
|
+
zIndex: LayoutZIndex.Mark + 2,
|
|
43
|
+
children: [ {
|
|
44
|
+
type: "path",
|
|
45
|
+
name: "storyline-landscape-curve-path",
|
|
46
|
+
interactive: !1,
|
|
47
|
+
style: {
|
|
48
|
+
stroke: null !== (_f = lineStyle.stroke) && void 0 !== _f ? _f : themeColor,
|
|
49
|
+
lineWidth: null !== (_g = lineStyle.lineWidth) && void 0 !== _g ? _g : 4,
|
|
50
|
+
lineDash: null !== (_h = lineStyle.lineDash) && void 0 !== _h ? _h : [ 6, 5 ],
|
|
51
|
+
lineCap: "round",
|
|
52
|
+
fill: "transparent",
|
|
53
|
+
fillOpacity: 0,
|
|
54
|
+
path: (_d, ctx) => {
|
|
55
|
+
const points = [];
|
|
56
|
+
for (let i = 0; i < count; i++) {
|
|
57
|
+
const center = getLandscapeImageCenter(spec, ctx, i);
|
|
58
|
+
center && points.push(center);
|
|
59
|
+
}
|
|
60
|
+
return buildSmoothCurvePath(points);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, ...symbolChildren ]
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getLandscapeMetrics = (spec, blockWidth, blockHeight, index) => {
|
|
68
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
69
|
+
const padding = normalizePadding(null !== (_b = null === (_a = spec.block) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : 12), titleFontSize = Number(null !== (_f = null === (_e = null === (_c = spec.title) || void 0 === _c ? void 0 : _c.style) || void 0 === _e ? void 0 : _e.fontSize) && void 0 !== _f ? _f : 14), titleLineHeight = Number(null !== (_j = null === (_h = null === (_g = spec.title) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.lineHeight) && void 0 !== _j ? _j : Math.max(19, Math.round(1.35 * titleFontSize))), contentFontSize = Number(null !== (_m = null === (_l = null === (_k = spec.content) || void 0 === _k ? void 0 : _k.style) || void 0 === _l ? void 0 : _l.fontSize) && void 0 !== _m ? _m : 12), contentLineHeight = Number(null !== (_q = null === (_p = null === (_o = spec.content) || void 0 === _o ? void 0 : _o.style) || void 0 === _p ? void 0 : _p.lineHeight) && void 0 !== _q ? _q : 18), imageHeight = Math.max(null !== (_s = null === (_r = spec.image) || void 0 === _r ? void 0 : _r.height) && void 0 !== _s ? _s : Math.round(.42 * blockHeight), titleLineHeight + padding.top + padding.bottom), contentHeight = 4 * contentLineHeight, textHeight = titleLineHeight + 4 + contentHeight, textOnTop = index % 2 == 0;
|
|
70
|
+
let textBox, contentBox, imageBox, connector, groupTop, groupHeight;
|
|
71
|
+
const connectorX = 0 + .2 * blockWidth, textX = connectorX + 12, textWidth = Math.max(blockWidth - (textX - 0), 0);
|
|
72
|
+
if (textOnTop) {
|
|
73
|
+
const imageY = 0, textY = imageY - 64 - textHeight;
|
|
74
|
+
imageBox = {
|
|
75
|
+
x: 0,
|
|
76
|
+
y: imageY,
|
|
77
|
+
width: blockWidth,
|
|
78
|
+
height: imageHeight
|
|
79
|
+
}, textBox = {
|
|
80
|
+
x: textX,
|
|
81
|
+
y: textY,
|
|
82
|
+
width: textWidth,
|
|
83
|
+
height: textHeight
|
|
84
|
+
}, contentBox = {
|
|
85
|
+
x: textX,
|
|
86
|
+
y: textY + titleLineHeight + 4,
|
|
87
|
+
width: textWidth,
|
|
88
|
+
height: contentHeight
|
|
89
|
+
}, connector = {
|
|
90
|
+
x1: connectorX,
|
|
91
|
+
y1: imageY,
|
|
92
|
+
x2: connectorX,
|
|
93
|
+
y2: textY + titleLineHeight / 2
|
|
94
|
+
}, groupTop = textY, groupHeight = imageHeight - groupTop;
|
|
95
|
+
} else {
|
|
96
|
+
const imageY = 0, textY = imageY + imageHeight + 64;
|
|
97
|
+
imageBox = {
|
|
98
|
+
x: 0,
|
|
99
|
+
y: imageY,
|
|
100
|
+
width: blockWidth,
|
|
101
|
+
height: imageHeight
|
|
102
|
+
}, textBox = {
|
|
103
|
+
x: textX,
|
|
104
|
+
y: textY,
|
|
105
|
+
width: textWidth,
|
|
106
|
+
height: textHeight
|
|
107
|
+
}, contentBox = {
|
|
108
|
+
x: textX,
|
|
109
|
+
y: textY + titleLineHeight + 4,
|
|
110
|
+
width: textWidth,
|
|
111
|
+
height: contentHeight
|
|
112
|
+
}, connector = {
|
|
113
|
+
x1: connectorX,
|
|
114
|
+
y1: imageY + imageHeight,
|
|
115
|
+
x2: connectorX,
|
|
116
|
+
y2: textY + textHeight
|
|
117
|
+
}, groupTop = imageY, groupHeight = textY + textHeight - imageY;
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
padding: padding,
|
|
121
|
+
titleFontSize: titleFontSize,
|
|
122
|
+
titleLineHeight: titleLineHeight,
|
|
123
|
+
contentFontSize: contentFontSize,
|
|
124
|
+
contentLineHeight: contentLineHeight,
|
|
125
|
+
contentHeight: contentHeight,
|
|
126
|
+
blockWidth: blockWidth,
|
|
127
|
+
imageBox: imageBox,
|
|
128
|
+
textBox: textBox,
|
|
129
|
+
contentBox: contentBox,
|
|
130
|
+
connector: connector,
|
|
131
|
+
textOnTop: textOnTop,
|
|
132
|
+
groupTop: groupTop,
|
|
133
|
+
groupHeight: groupHeight
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const buildLandscapeBlockMark = (spec, block, index) => {
|
|
138
|
+
var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
139
|
+
const hasImage = !!block.image, contentText = Array.isArray(block.content) ? block.content : block.content ? [ block.content ] : [], titleFontSize = Number(null !== (_c = null === (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize) && void 0 !== _c ? _c : 14), titleLineHeight = Number(null !== (_g = null === (_f = null === (_e = spec.title) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.lineHeight) && void 0 !== _g ? _g : Math.round(1.35 * titleFontSize)), getMetrics = ctx => {
|
|
140
|
+
var _a, _b, _c, _e;
|
|
141
|
+
const layoutBlock = getLayout(spec, ctx).blocks[index], w = null !== (_a = null == layoutBlock ? void 0 : layoutBlock.width) && void 0 !== _a ? _a : resolveBlockWidth(spec, 0), h = null !== (_e = null !== (_b = null == layoutBlock ? void 0 : layoutBlock.height) && void 0 !== _b ? _b : null === (_c = spec.block) || void 0 === _c ? void 0 : _c.height) && void 0 !== _e ? _e : DEFAULT_BLOCK_HEIGHT;
|
|
142
|
+
return getLandscapeMetrics(spec, w, h, index);
|
|
143
|
+
}, blockStyle = null !== (_j = null === (_h = spec.block) || void 0 === _h ? void 0 : _h.style) && void 0 !== _j ? _j : {}, lineStyle = null !== (_l = null === (_k = spec.line) || void 0 === _k ? void 0 : _k.style) && void 0 !== _l ? _l : {}, themeColor = getThemeColor(spec), connectorStroke = null !== (_m = lineStyle.stroke) && void 0 !== _m ? _m : themeColor, connectorLineWidth = null !== (_o = lineStyle.lineWidth) && void 0 !== _o ? _o : 2, connectorDash = null !== (_p = lineStyle.lineDash) && void 0 !== _p ? _p : [ 4, 4 ];
|
|
144
|
+
return {
|
|
145
|
+
type: "group",
|
|
146
|
+
id: `storyline-block-${null !== (_q = block.id) && void 0 !== _q ? _q : index}`,
|
|
147
|
+
name: `storyline-block-${index}`,
|
|
148
|
+
zIndex: LayoutZIndex.Mark + 1,
|
|
149
|
+
style: {
|
|
150
|
+
x: (_d, ctx) => {
|
|
151
|
+
var _a;
|
|
152
|
+
const lb = getLayout(spec, ctx).blocks[index];
|
|
153
|
+
return null !== (_a = null == lb ? void 0 : lb.x) && void 0 !== _a ? _a : 0;
|
|
154
|
+
},
|
|
155
|
+
y: (_d, ctx) => {
|
|
156
|
+
var _a, _b, _c, _e, _f, _g, _h;
|
|
157
|
+
const lb = getLayout(spec, ctx).blocks[index], m = getMetrics(ctx), cy = null !== (_b = null === (_a = null == lb ? void 0 : lb.center) || void 0 === _a ? void 0 : _a.y) && void 0 !== _b ? _b : (null !== (_c = null == lb ? void 0 : lb.y) && void 0 !== _c ? _c : 0) + (null !== (_e = null == lb ? void 0 : lb.height) && void 0 !== _e ? _e : 0) / 2, blockH = null !== (_h = null !== (_f = null == lb ? void 0 : lb.height) && void 0 !== _f ? _f : null === (_g = spec.block) || void 0 === _g ? void 0 : _g.height) && void 0 !== _h ? _h : DEFAULT_BLOCK_HEIGHT, stagger = (index % 2 == 0 ? -1 : 1) * blockH * .1;
|
|
158
|
+
return cy - m.imageBox.height / 2 + stagger;
|
|
159
|
+
},
|
|
160
|
+
width: (_d, ctx) => getMetrics(ctx).blockWidth,
|
|
161
|
+
height: (_d, ctx) => getMetrics(ctx).groupHeight
|
|
162
|
+
},
|
|
163
|
+
children: [ {
|
|
164
|
+
type: "rect",
|
|
165
|
+
name: `storyline-block-image-bg-${index}`,
|
|
166
|
+
interactive: !1,
|
|
167
|
+
style: Object.assign({
|
|
168
|
+
x: (_d, ctx) => getMetrics(ctx).imageBox.x,
|
|
169
|
+
y: (_d, ctx) => getMetrics(ctx).imageBox.y,
|
|
170
|
+
width: (_d, ctx) => getMetrics(ctx).imageBox.width,
|
|
171
|
+
height: (_d, ctx) => getMetrics(ctx).imageBox.height,
|
|
172
|
+
cornerRadius: 8,
|
|
173
|
+
fill: "#ffffff",
|
|
174
|
+
stroke: themeColor,
|
|
175
|
+
lineWidth: 2
|
|
176
|
+
}, blockStyle)
|
|
177
|
+
}, hasImage ? Object.assign(Object.assign({
|
|
178
|
+
type: "image",
|
|
179
|
+
name: `storyline-block-image-${index}`,
|
|
180
|
+
interactive: !1
|
|
181
|
+
}, omitImageLayoutSpec(spec.image)), {
|
|
182
|
+
style: Object.assign({
|
|
183
|
+
x: (_d, ctx) => getMetrics(ctx).imageBox.x,
|
|
184
|
+
y: (_d, ctx) => getMetrics(ctx).imageBox.y,
|
|
185
|
+
width: (_d, ctx) => getMetrics(ctx).imageBox.width,
|
|
186
|
+
height: (_d, ctx) => getMetrics(ctx).imageBox.height,
|
|
187
|
+
image: block.image,
|
|
188
|
+
cornerRadius: 8,
|
|
189
|
+
repeatX: "no-repeat",
|
|
190
|
+
repeatY: "no-repeat",
|
|
191
|
+
imageMode: "cover",
|
|
192
|
+
imagePosition: "center"
|
|
193
|
+
}, null === (_r = spec.image) || void 0 === _r ? void 0 : _r.style)
|
|
194
|
+
}) : null, {
|
|
195
|
+
type: "path",
|
|
196
|
+
name: `storyline-block-connector-${index}`,
|
|
197
|
+
interactive: !1,
|
|
198
|
+
style: {
|
|
199
|
+
stroke: connectorStroke,
|
|
200
|
+
lineWidth: connectorLineWidth,
|
|
201
|
+
lineDash: connectorDash,
|
|
202
|
+
fill: connectorStroke,
|
|
203
|
+
path: (_d, ctx) => {
|
|
204
|
+
const m = getMetrics(ctx), x = m.connector.x1, y0 = m.connector.y1, y1 = m.connector.y2, baseY = y1 - 9 * (y1 < y0 ? -1 : 1);
|
|
205
|
+
return `${`M ${x} ${y0} L ${x} ${baseY}`} ${`M ${x - 4.5} ${baseY} L ${x + 4.5} ${baseY} L ${x} ${y1} Z`}`;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, block.title ? Object.assign(Object.assign({
|
|
209
|
+
type: "text",
|
|
210
|
+
name: `storyline-block-title-${index}`,
|
|
211
|
+
interactive: !1
|
|
212
|
+
}, spec.title), {
|
|
213
|
+
style: Object.assign({
|
|
214
|
+
x: (_d, ctx) => getMetrics(ctx).textBox.x,
|
|
215
|
+
y: (_d, ctx) => getMetrics(ctx).textBox.y,
|
|
216
|
+
text: block.title,
|
|
217
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).textBox.width,
|
|
218
|
+
fontSize: titleFontSize,
|
|
219
|
+
lineHeight: titleLineHeight,
|
|
220
|
+
fontWeight: "bold",
|
|
221
|
+
fill: "#1f2430",
|
|
222
|
+
textAlign: "left",
|
|
223
|
+
textBaseline: "top"
|
|
224
|
+
}, null === (_s = spec.title) || void 0 === _s ? void 0 : _s.style)
|
|
225
|
+
}) : null, contentText.length ? Object.assign(Object.assign({
|
|
226
|
+
type: "text",
|
|
227
|
+
name: `storyline-block-content-${index}`,
|
|
228
|
+
interactive: !1
|
|
229
|
+
}, spec.content), {
|
|
230
|
+
textType: "rich",
|
|
231
|
+
style: Object.assign({
|
|
232
|
+
x: (_d, ctx) => getMetrics(ctx).contentBox.x,
|
|
233
|
+
y: (_d, ctx) => getMetrics(ctx).contentBox.y,
|
|
234
|
+
width: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
235
|
+
height: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
236
|
+
maxLineWidth: (_d, ctx) => getMetrics(ctx).contentBox.width,
|
|
237
|
+
heightLimit: (_d, ctx) => getMetrics(ctx).contentBox.height,
|
|
238
|
+
text: buildRichContent(contentText, spec),
|
|
239
|
+
fontSize: 12,
|
|
240
|
+
lineHeight: 18,
|
|
241
|
+
textAlign: "left",
|
|
242
|
+
textBaseline: "top",
|
|
243
|
+
wordBreak: "break-word",
|
|
244
|
+
ellipsis: "...",
|
|
245
|
+
fill: "#596173"
|
|
246
|
+
}, null === (_t = spec.content) || void 0 === _t ? void 0 : _t.style)
|
|
247
|
+
}) : null ].filter(Boolean)
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=landscape.js.map
|