pptxtojson 1.3.2 → 1.5.0
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/README.md +8 -5
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/rollup.config.js +5 -0
- package/src/fill.js +4 -2
- package/src/pptxtojson.js +20 -1
- package/src/shapePath.js +4635 -0
- package/src/utils.js +4 -1
package/src/shapePath.js
ADDED
|
@@ -0,0 +1,4635 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
|
|
3
|
+
import { RATIO_EMUs_Points } from './constants'
|
|
4
|
+
import { getTextByPathList } from './utils'
|
|
5
|
+
|
|
6
|
+
function shapePie(H, w, adj1, adj2, isClose) {
|
|
7
|
+
const pieVal = parseInt(adj2)
|
|
8
|
+
const piAngle = parseInt(adj1)
|
|
9
|
+
const size = parseInt(H)
|
|
10
|
+
const radius = size / 2
|
|
11
|
+
|
|
12
|
+
let value = pieVal - piAngle
|
|
13
|
+
if (value < 0) value = 360 + value
|
|
14
|
+
value = Math.min(Math.max(value, 0), 360)
|
|
15
|
+
|
|
16
|
+
const x = Math.cos((2 * Math.PI) / (360 / value))
|
|
17
|
+
const y = Math.sin((2 * Math.PI) / (360 / value))
|
|
18
|
+
|
|
19
|
+
let longArc, d
|
|
20
|
+
if (isClose) {
|
|
21
|
+
longArc = (value <= 180) ? 0 : 1
|
|
22
|
+
d = `M${radius},${radius} L${radius},0 A${radius},${radius} 0 ${longArc},1 ${radius + y * radius},${radius - x * radius} z`
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
longArc = (value <= 180) ? 0 : 1
|
|
26
|
+
const radius1 = radius
|
|
27
|
+
const radius2 = w / 2
|
|
28
|
+
d = `M${radius1},0 A${radius2},${radius1} 0 ${longArc},1 ${radius2 + y * radius2},${radius1 - x * radius1}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return d
|
|
32
|
+
}
|
|
33
|
+
function shapeGear(h, points) {
|
|
34
|
+
const innerRadius = h
|
|
35
|
+
const outerRadius = 1.5 * innerRadius
|
|
36
|
+
const cx = outerRadius
|
|
37
|
+
const cy = outerRadius
|
|
38
|
+
const notches = points
|
|
39
|
+
const radiusO = outerRadius
|
|
40
|
+
const radiusI = innerRadius
|
|
41
|
+
const taperO = 50
|
|
42
|
+
const taperI = 35
|
|
43
|
+
const pi2 = 2 * Math.PI
|
|
44
|
+
const angle = pi2 / (notches * 2)
|
|
45
|
+
const taperAI = angle * taperI * 0.005
|
|
46
|
+
const taperAO = angle * taperO * 0.005
|
|
47
|
+
|
|
48
|
+
let a = angle
|
|
49
|
+
let toggle = false
|
|
50
|
+
|
|
51
|
+
let d = ' M' + (cx + radiusO * Math.cos(taperAO)) + ' ' + (cy + radiusO * Math.sin(taperAO))
|
|
52
|
+
|
|
53
|
+
for (; a <= pi2 + angle; a += angle) {
|
|
54
|
+
if (toggle) {
|
|
55
|
+
d += ' L' + (cx + radiusI * Math.cos(a - taperAI)) + ',' + (cy + radiusI * Math.sin(a - taperAI))
|
|
56
|
+
d += ' L' + (cx + radiusO * Math.cos(a + taperAO)) + ',' + (cy + radiusO * Math.sin(a + taperAO))
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
d += ' L' + (cx + radiusO * Math.cos(a - taperAO)) + ',' + (cy + radiusO * Math.sin(a - taperAO))
|
|
60
|
+
d += ' L' + (cx + radiusI * Math.cos(a + taperAI)) + ',' + (cy + radiusI * Math.sin(a + taperAI))
|
|
61
|
+
}
|
|
62
|
+
toggle = !toggle
|
|
63
|
+
}
|
|
64
|
+
d += ' '
|
|
65
|
+
return d
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function shapeArc(cX, cY, rX, rY, stAng, endAng, isClose) {
|
|
69
|
+
let dData = ''
|
|
70
|
+
const increment = (endAng >= stAng) ? 1 : -1
|
|
71
|
+
let angle = stAng
|
|
72
|
+
|
|
73
|
+
const condition = (a) => (increment > 0 ? a <= endAng : a >= endAng)
|
|
74
|
+
|
|
75
|
+
while (condition(angle)) {
|
|
76
|
+
const radians = angle * (Math.PI / 180)
|
|
77
|
+
const x = cX + Math.cos(radians) * rX
|
|
78
|
+
const y = cY + Math.sin(radians) * rY
|
|
79
|
+
if (angle === stAng) {
|
|
80
|
+
dData = ` M${x} ${y}`
|
|
81
|
+
}
|
|
82
|
+
dData += ` L${x} ${y}`
|
|
83
|
+
angle += increment
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (isClose) {
|
|
87
|
+
dData += ' z'
|
|
88
|
+
}
|
|
89
|
+
return dData
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function shapeSnipRoundRect(w, h, adj1, adj2, shapeType, adjType) {
|
|
93
|
+
let adjA, adjB, adjC, adjD
|
|
94
|
+
|
|
95
|
+
switch (adjType) {
|
|
96
|
+
case 'cornr1':
|
|
97
|
+
adjA = 0
|
|
98
|
+
adjB = 0
|
|
99
|
+
adjC = 0
|
|
100
|
+
adjD = adj1
|
|
101
|
+
break
|
|
102
|
+
case 'cornr2':
|
|
103
|
+
adjA = adj1
|
|
104
|
+
adjB = adj2
|
|
105
|
+
adjC = adj2
|
|
106
|
+
adjD = adj1
|
|
107
|
+
break
|
|
108
|
+
case 'cornrAll':
|
|
109
|
+
adjA = adj1
|
|
110
|
+
adjB = adj1
|
|
111
|
+
adjC = adj1
|
|
112
|
+
adjD = adj1
|
|
113
|
+
break
|
|
114
|
+
case 'diag':
|
|
115
|
+
adjA = adj1
|
|
116
|
+
adjB = adj2
|
|
117
|
+
adjC = adj1
|
|
118
|
+
adjD = adj2
|
|
119
|
+
break
|
|
120
|
+
default:
|
|
121
|
+
adjA = adjB = adjC = adjD = 0
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (shapeType === 'round') {
|
|
125
|
+
return `M0,${h / 2 + (1 - adjB) * (h / 2)} Q0,${h} ${adjB * (w / 2)},${h} L${w / 2 + (1 - adjC) * (w / 2)},${h} Q${w},${h} ${w},${h / 2 + (h / 2) * (1 - adjC)} L${w},${(h / 2) * adjD} Q${w},0 ${w / 2 + (w / 2) * (1 - adjD)},0 L${(w / 2) * adjA},0 Q0,0 0,${(h / 2) * (adjA)} z`
|
|
126
|
+
}
|
|
127
|
+
else if (shapeType === 'snip') {
|
|
128
|
+
return `M0,${adjA * (h / 2)} L0,${h / 2 + (h / 2) * (1 - adjB)} L${adjB * (w / 2)},${h} L${w / 2 + (w / 2) * (1 - adjC)},${h} L${w},${h / 2 + (h / 2) * (1 - adjC)} L${w},${adjD * (h / 2)} L${w / 2 + (w / 2) * (1 - adjD)},0 L${(w / 2) * adjA},0 z`
|
|
129
|
+
}
|
|
130
|
+
return ''
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function getShapePath(shapType, w, h, node) {
|
|
134
|
+
let pathData = ''
|
|
135
|
+
|
|
136
|
+
switch (shapType) {
|
|
137
|
+
case 'rect':
|
|
138
|
+
case 'actionButtonBlank':
|
|
139
|
+
pathData = `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z`
|
|
140
|
+
break
|
|
141
|
+
case 'flowChartPredefinedProcess':
|
|
142
|
+
pathData = `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z M ${w * (1 / 8)} 0 L ${w * (1 / 8)} ${h} M ${w * (7 / 8)} 0 L ${w * (7 / 8)} ${h}`
|
|
143
|
+
break
|
|
144
|
+
case 'flowChartInternalStorage':
|
|
145
|
+
pathData = `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z M ${w * (1 / 8)} 0 L ${w * (1 / 8)} ${h} M 0 ${h * (1 / 8)} L ${w} ${h * (1 / 8)}`
|
|
146
|
+
break
|
|
147
|
+
case 'flowChartCollate':
|
|
148
|
+
pathData = `M 0,0 L ${w},0 L 0,${h} L ${w},${h} z`
|
|
149
|
+
break
|
|
150
|
+
case 'flowChartDocument':
|
|
151
|
+
{
|
|
152
|
+
const x1 = w * 10800 / 21600
|
|
153
|
+
const y1 = h * 17322 / 21600
|
|
154
|
+
const y2 = h * 20172 / 21600
|
|
155
|
+
const y3 = h * 23922 / 21600
|
|
156
|
+
pathData = `M 0,0 L ${w},0 L ${w},${y1} C ${x1},${y1} ${x1},${y3} 0,${y2} z`
|
|
157
|
+
}
|
|
158
|
+
break
|
|
159
|
+
case 'flowChartMultidocument':
|
|
160
|
+
{
|
|
161
|
+
const y1 = h * 18022 / 21600
|
|
162
|
+
const y2 = h * 3675 / 21600
|
|
163
|
+
const y3 = h * 23542 / 21600
|
|
164
|
+
const y4 = h * 1815 / 21600
|
|
165
|
+
const y5 = h * 16252 / 21600
|
|
166
|
+
const y6 = h * 16352 / 21600
|
|
167
|
+
const y7 = h * 14392 / 21600
|
|
168
|
+
const y8 = h * 20782 / 21600
|
|
169
|
+
const y9 = h * 14467 / 21600
|
|
170
|
+
const x1 = w * 1532 / 21600
|
|
171
|
+
const x2 = w * 20000 / 21600
|
|
172
|
+
const x3 = w * 9298 / 21600
|
|
173
|
+
const x4 = w * 19298 / 21600
|
|
174
|
+
const x5 = w * 18595 / 21600
|
|
175
|
+
const x6 = w * 2972 / 21600
|
|
176
|
+
const x7 = w * 20800 / 21600
|
|
177
|
+
pathData = `M 0,${y2} L ${x5},${y2} L ${x5},${y1} C ${x3},${y1} ${x3},${y3} 0,${y8} z M ${x1},${y2} L ${x1},${y4} L ${x2},${y4} L ${x2},${y5} C ${x4},${y5} ${x5},${y6} ${x5},${y6} M ${x6},${y4} L ${x6},0 L ${w},0 L ${w},${y7} C ${x7},${y7} ${x2},${y9} ${x2},${y9}`
|
|
178
|
+
}
|
|
179
|
+
break
|
|
180
|
+
case 'actionButtonBackPrevious':
|
|
181
|
+
{
|
|
182
|
+
const hc = w / 2,
|
|
183
|
+
vc = h / 2,
|
|
184
|
+
ss = Math.min(w, h)
|
|
185
|
+
const dx2 = ss * 3 / 8
|
|
186
|
+
const g9 = vc - dx2
|
|
187
|
+
const g10 = vc + dx2
|
|
188
|
+
const g11 = hc - dx2
|
|
189
|
+
const g12 = hc + dx2
|
|
190
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${g11},${vc} L ${g12},${g9} L ${g12},${g10} z`
|
|
191
|
+
}
|
|
192
|
+
break
|
|
193
|
+
case 'actionButtonBeginning':
|
|
194
|
+
{
|
|
195
|
+
const hc = w / 2,
|
|
196
|
+
vc = h / 2,
|
|
197
|
+
ss = Math.min(w, h)
|
|
198
|
+
const dx2 = ss * 3 / 8
|
|
199
|
+
const g9 = vc - dx2
|
|
200
|
+
const g10 = vc + dx2
|
|
201
|
+
const g11 = hc - dx2
|
|
202
|
+
const g12 = hc + dx2
|
|
203
|
+
const g13 = ss * 3 / 4
|
|
204
|
+
const g14 = g13 / 8
|
|
205
|
+
const g15 = g13 / 4
|
|
206
|
+
const g16 = g11 + g14
|
|
207
|
+
const g17 = g11 + g15
|
|
208
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${g17},${vc} L ${g12},${g9} L ${g12},${g10} z M ${g16},${g9} L ${g11},${g9} L ${g11},${g10} L ${g16},${g10} z`
|
|
209
|
+
}
|
|
210
|
+
break
|
|
211
|
+
case 'actionButtonDocument':
|
|
212
|
+
{
|
|
213
|
+
const hc = w / 2,
|
|
214
|
+
vc = h / 2,
|
|
215
|
+
ss = Math.min(w, h)
|
|
216
|
+
const dx2 = ss * 3 / 8
|
|
217
|
+
const g9 = vc - dx2
|
|
218
|
+
const g10 = vc + dx2
|
|
219
|
+
const dx1 = ss * 9 / 32
|
|
220
|
+
const g11 = hc - dx1
|
|
221
|
+
const g12 = hc + dx1
|
|
222
|
+
const g13 = ss * 3 / 16
|
|
223
|
+
const g14 = g12 - g13
|
|
224
|
+
const g15 = g9 + g13
|
|
225
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${g11},${g9} L ${g14},${g9} L ${g12},${g15} L ${g12},${g10} L ${g11},${g10} z M ${g14},${g9} L ${g14},${g15} L ${g12},${g15} z`
|
|
226
|
+
}
|
|
227
|
+
break
|
|
228
|
+
case 'actionButtonEnd':
|
|
229
|
+
{
|
|
230
|
+
const hc = w / 2,
|
|
231
|
+
vc = h / 2,
|
|
232
|
+
ss = Math.min(w, h)
|
|
233
|
+
const dx2 = ss * 3 / 8
|
|
234
|
+
const g9 = vc - dx2
|
|
235
|
+
const g10 = vc + dx2
|
|
236
|
+
const g11 = hc - dx2
|
|
237
|
+
const g12 = hc + dx2
|
|
238
|
+
const g13 = ss * 3 / 4
|
|
239
|
+
const g14 = g13 * 3 / 4
|
|
240
|
+
const g15 = g13 * 7 / 8
|
|
241
|
+
const g16 = g11 + g14
|
|
242
|
+
const g17 = g11 + g15
|
|
243
|
+
pathData = `M 0,${h} L ${w},${h} L ${w},0 L 0,0 z M ${g17},${g9} L ${g12},${g9} L ${g12},${g10} L ${g17},${g10} z M ${g16},${vc} L ${g11},${g9} L ${g11},${g10} z`
|
|
244
|
+
}
|
|
245
|
+
break
|
|
246
|
+
case 'actionButtonForwardNext':
|
|
247
|
+
{
|
|
248
|
+
const hc = w / 2,
|
|
249
|
+
vc = h / 2,
|
|
250
|
+
ss = Math.min(w, h)
|
|
251
|
+
const dx2 = ss * 3 / 8
|
|
252
|
+
const g9 = vc - dx2
|
|
253
|
+
const g10 = vc + dx2
|
|
254
|
+
const g11 = hc - dx2
|
|
255
|
+
const g12 = hc + dx2
|
|
256
|
+
pathData = `M 0,${h} L ${w},${h} L ${w},0 L 0,0 z M ${g12},${vc} L ${g11},${g9} L ${g11},${g10} z`
|
|
257
|
+
}
|
|
258
|
+
break
|
|
259
|
+
case 'actionButtonHelp':
|
|
260
|
+
{
|
|
261
|
+
const hc = w / 2,
|
|
262
|
+
vc = h / 2,
|
|
263
|
+
ss = Math.min(w, h)
|
|
264
|
+
const dx2 = ss * 3 / 8
|
|
265
|
+
const g9 = vc - dx2
|
|
266
|
+
const g11 = hc - dx2
|
|
267
|
+
const g13 = ss * 3 / 4
|
|
268
|
+
const g14 = g13 / 7
|
|
269
|
+
const g15 = g13 * 3 / 14
|
|
270
|
+
const g16 = g13 * 2 / 7
|
|
271
|
+
const g19 = g13 * 3 / 7
|
|
272
|
+
const g20 = g13 * 4 / 7
|
|
273
|
+
const g21 = g13 * 17 / 28
|
|
274
|
+
const g23 = g13 * 21 / 28
|
|
275
|
+
const g24 = g13 * 11 / 14
|
|
276
|
+
const g27 = g9 + g16
|
|
277
|
+
const g29 = g9 + g21
|
|
278
|
+
const g30 = g9 + g23
|
|
279
|
+
const g31 = g9 + g24
|
|
280
|
+
const g33 = g11 + g15
|
|
281
|
+
const g36 = g11 + g19
|
|
282
|
+
const g37 = g11 + g20
|
|
283
|
+
const g41 = g13 / 14
|
|
284
|
+
const g42 = g13 * 3 / 28
|
|
285
|
+
const cX1 = g33 + g16
|
|
286
|
+
const cX2 = g36 + g14
|
|
287
|
+
const cY3 = g31 + g42
|
|
288
|
+
const cX4 = (g37 + g36 + g16) / 2
|
|
289
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${g33},${g27} ${shapeArc(cX1, g27, g16, g16, 180, 360, false).replace('M', 'L')} ${shapeArc(cX4, g27, g14, g15, 0, 90, false).replace('M', 'L')} ${shapeArc(cX4, g29, g41, g42, 270, 180, false).replace('M', 'L')} L ${g37},${g30} L ${g36},${g30} L ${g36},${g29} ${shapeArc(cX2, g29, g14, g15, 180, 270, false).replace('M', 'L')} ${shapeArc(g37, g27, g41, g42, 90, 0, false).replace('M', 'L')} ${shapeArc(cX1, g27, g14, g14, 0, -180, false).replace('M', 'L')} z M ${hc},${g31} ${shapeArc(hc, cY3, g42, g42, 270, 630, false).replace('M', 'L')} z`
|
|
290
|
+
}
|
|
291
|
+
break
|
|
292
|
+
case 'actionButtonHome':
|
|
293
|
+
{
|
|
294
|
+
const hc = w / 2,
|
|
295
|
+
vc = h / 2,
|
|
296
|
+
ss = Math.min(w, h)
|
|
297
|
+
const dx2 = ss * 3 / 8
|
|
298
|
+
const g9 = vc - dx2
|
|
299
|
+
const g10 = vc + dx2
|
|
300
|
+
const g11 = hc - dx2
|
|
301
|
+
const g12 = hc + dx2
|
|
302
|
+
const g13 = ss * 3 / 4
|
|
303
|
+
const g14 = g13 / 16
|
|
304
|
+
const g15 = g13 / 8
|
|
305
|
+
const g16 = g13 * 3 / 16
|
|
306
|
+
const g17 = g13 * 5 / 16
|
|
307
|
+
const g18 = g13 * 7 / 16
|
|
308
|
+
const g19 = g13 * 9 / 16
|
|
309
|
+
const g20 = g13 * 11 / 16
|
|
310
|
+
const g21 = g13 * 3 / 4
|
|
311
|
+
const g22 = g13 * 13 / 16
|
|
312
|
+
const g23 = g13 * 7 / 8
|
|
313
|
+
const g24 = g9 + g14
|
|
314
|
+
const g25 = g9 + g16
|
|
315
|
+
const g26 = g9 + g17
|
|
316
|
+
const g27 = g9 + g21
|
|
317
|
+
const g28 = g11 + g15
|
|
318
|
+
const g29 = g11 + g18
|
|
319
|
+
const g30 = g11 + g19
|
|
320
|
+
const g31 = g11 + g20
|
|
321
|
+
const g32 = g11 + g22
|
|
322
|
+
const g33 = g11 + g23
|
|
323
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${hc},${g9} L ${g11},${vc} L ${g28},${vc} L ${g28},${g10} L ${g33},${g10} L ${g33},${vc} L ${g12},${vc} L ${g32},${g26} L ${g32},${g24} L ${g31},${g24} L ${g31},${g25} z M ${g29},${g27} L ${g30},${g27} L ${g30},${g10} L ${g29},${g10} z`
|
|
324
|
+
}
|
|
325
|
+
break
|
|
326
|
+
case 'actionButtonInformation':
|
|
327
|
+
{
|
|
328
|
+
const hc = w / 2,
|
|
329
|
+
vc = h / 2,
|
|
330
|
+
ss = Math.min(w, h)
|
|
331
|
+
const dx2 = ss * 3 / 8
|
|
332
|
+
const g9 = vc - dx2
|
|
333
|
+
const g11 = hc - dx2
|
|
334
|
+
const g13 = ss * 3 / 4
|
|
335
|
+
const g14 = g13 / 32
|
|
336
|
+
const g17 = g13 * 5 / 16
|
|
337
|
+
const g18 = g13 * 3 / 8
|
|
338
|
+
const g19 = g13 * 13 / 32
|
|
339
|
+
const g20 = g13 * 19 / 32
|
|
340
|
+
const g22 = g13 * 11 / 16
|
|
341
|
+
const g23 = g13 * 13 / 16
|
|
342
|
+
const g24 = g13 * 7 / 8
|
|
343
|
+
const g25 = g9 + g14
|
|
344
|
+
const g28 = g9 + g17
|
|
345
|
+
const g29 = g9 + g18
|
|
346
|
+
const g30 = g9 + g23
|
|
347
|
+
const g31 = g9 + g24
|
|
348
|
+
const g32 = g11 + g17
|
|
349
|
+
const g34 = g11 + g19
|
|
350
|
+
const g35 = g11 + g20
|
|
351
|
+
const g37 = g11 + g22
|
|
352
|
+
const g38 = g13 * 3 / 32
|
|
353
|
+
const cY1 = g9 + dx2
|
|
354
|
+
const cY2 = g25 + g38
|
|
355
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${hc},${g9} ${shapeArc(hc, cY1, dx2, dx2, 270, 630, false).replace('M', 'L')} z M ${hc},${g25} ${shapeArc(hc, cY2, g38, g38, 270, 630, false).replace('M', 'L')} M ${g32},${g28} L ${g35},${g28} L ${g35},${g30} L ${g37},${g30} L ${g37},${g31} L ${g32},${g31} L ${g32},${g30} L ${g34},${g30} L ${g34},${g29} L ${g32},${g29} z`
|
|
356
|
+
}
|
|
357
|
+
break
|
|
358
|
+
case 'actionButtonMovie':
|
|
359
|
+
{
|
|
360
|
+
const hc = w / 2,
|
|
361
|
+
vc = h / 2,
|
|
362
|
+
ss = Math.min(w, h)
|
|
363
|
+
const g11 = hc - (ss * 3 / 8)
|
|
364
|
+
const g9 = vc - (ss * 3 / 8)
|
|
365
|
+
const g12 = hc + (ss * 3 / 8)
|
|
366
|
+
const g13 = ss * 3 / 4
|
|
367
|
+
const g14 = g13 * 1455 / 21600
|
|
368
|
+
const g15 = g13 * 1905 / 21600
|
|
369
|
+
const g16 = g13 * 2325 / 21600
|
|
370
|
+
const g17 = g13 * 16155 / 21600
|
|
371
|
+
const g18 = g13 * 17010 / 21600
|
|
372
|
+
const g19 = g13 * 19335 / 21600
|
|
373
|
+
const g20 = g13 * 19725 / 21600
|
|
374
|
+
const g21 = g13 * 20595 / 21600
|
|
375
|
+
const g22 = g13 * 5280 / 21600
|
|
376
|
+
const g23 = g13 * 5730 / 21600
|
|
377
|
+
const g24 = g13 * 6630 / 21600
|
|
378
|
+
const g25 = g13 * 7492 / 21600
|
|
379
|
+
const g26 = g13 * 9067 / 21600
|
|
380
|
+
const g27 = g13 * 9555 / 21600
|
|
381
|
+
const g28 = g13 * 13342 / 21600
|
|
382
|
+
const g29 = g13 * 14580 / 21600
|
|
383
|
+
const g30 = g13 * 15592 / 21600
|
|
384
|
+
const g31 = g11 + g14
|
|
385
|
+
const g32 = g11 + g15
|
|
386
|
+
const g33 = g11 + g16
|
|
387
|
+
const g34 = g11 + g17
|
|
388
|
+
const g35 = g11 + g18
|
|
389
|
+
const g36 = g11 + g19
|
|
390
|
+
const g37 = g11 + g20
|
|
391
|
+
const g38 = g11 + g21
|
|
392
|
+
const g39 = g9 + g22
|
|
393
|
+
const g40 = g9 + g23
|
|
394
|
+
const g41 = g9 + g24
|
|
395
|
+
const g42 = g9 + g25
|
|
396
|
+
const g43 = g9 + g26
|
|
397
|
+
const g44 = g9 + g27
|
|
398
|
+
const g45 = g9 + g28
|
|
399
|
+
const g46 = g9 + g29
|
|
400
|
+
const g47 = g9 + g30
|
|
401
|
+
pathData = `M 0,${h} L ${w},${h} L ${w},0 L 0,0 z M ${g11},${g39} L ${g11},${g44} L ${g31},${g44} L ${g32},${g43} L ${g33},${g43} L ${g33},${g47} L ${g35},${g47} L ${g35},${g45} L ${g36},${g45} L ${g38},${g46} L ${g12},${g46} L ${g12},${g41} L ${g38},${g41} L ${g37},${g42} L ${g35},${g42} L ${g35},${g41} L ${g34},${g40} L ${g32},${g40} L ${g31},${g39} z`
|
|
402
|
+
}
|
|
403
|
+
break
|
|
404
|
+
case 'actionButtonReturn':
|
|
405
|
+
{
|
|
406
|
+
const hc = w / 2,
|
|
407
|
+
vc = h / 2,
|
|
408
|
+
ss = Math.min(w, h)
|
|
409
|
+
const dx2 = ss * 3 / 8
|
|
410
|
+
const g9 = vc - dx2
|
|
411
|
+
const g10 = vc + dx2
|
|
412
|
+
const g11 = hc - dx2
|
|
413
|
+
const g12 = hc + dx2
|
|
414
|
+
const g13 = ss * 3 / 4
|
|
415
|
+
const g14 = g13 * 7 / 8
|
|
416
|
+
const g15 = g13 * 3 / 4
|
|
417
|
+
const g16 = g13 * 5 / 8
|
|
418
|
+
const g17 = g13 * 3 / 8
|
|
419
|
+
const g18 = g13 / 4
|
|
420
|
+
const g19 = g9 + g15
|
|
421
|
+
const g20 = g9 + g16
|
|
422
|
+
const g21 = g9 + g18
|
|
423
|
+
const g22 = g11 + g14
|
|
424
|
+
const g23 = g11 + g15
|
|
425
|
+
const g24 = g11 + g16
|
|
426
|
+
const g25 = g11 + g17
|
|
427
|
+
const g26 = g11 + g18
|
|
428
|
+
const g27 = g13 / 8
|
|
429
|
+
const cX1 = g24 - g27
|
|
430
|
+
const cY2 = g19 - g27
|
|
431
|
+
const cX3 = g11 + g17
|
|
432
|
+
const cY4 = g10 - g17
|
|
433
|
+
pathData = `M 0,${h} L ${w},${h} L ${w},0 L 0,0 z M ${g12},${g21} L ${g23},${g9} L ${hc},${g21} L ${g24},${g21} L ${g24},${g20} ${shapeArc(cX1, g20, g27, g27, 0, 90, false).replace('M', 'L')} L ${g25},${g19} ${shapeArc(g25, cY2, g27, g27, 90, 180, false).replace('M', 'L')} L ${g26},${g21} L ${g11},${g21} L ${g11},${g20} ${shapeArc(cX3, g20, g17, g17, 180, 90, false).replace('M', 'L')} L ${hc},${g10} ${shapeArc(hc, cY4, g17, g17, 90, 0, false).replace('M', 'L')} L ${g22},${g21} z`
|
|
434
|
+
}
|
|
435
|
+
break
|
|
436
|
+
case 'actionButtonSound':
|
|
437
|
+
{
|
|
438
|
+
const hc = w / 2,
|
|
439
|
+
vc = h / 2,
|
|
440
|
+
ss = Math.min(w, h)
|
|
441
|
+
const dx2 = ss * 3 / 8
|
|
442
|
+
const g9 = vc - dx2
|
|
443
|
+
const g10 = vc + dx2
|
|
444
|
+
const g11 = hc - dx2
|
|
445
|
+
const g12 = hc + dx2
|
|
446
|
+
const g13 = ss * 3 / 4
|
|
447
|
+
const g14 = g13 / 8
|
|
448
|
+
const g15 = g13 * 5 / 16
|
|
449
|
+
const g16 = g13 * 5 / 8
|
|
450
|
+
const g17 = g13 * 11 / 16
|
|
451
|
+
const g18 = g13 * 3 / 4
|
|
452
|
+
const g19 = g13 * 7 / 8
|
|
453
|
+
const g20 = g9 + g14
|
|
454
|
+
const g21 = g9 + g15
|
|
455
|
+
const g22 = g9 + g17
|
|
456
|
+
const g23 = g9 + g19
|
|
457
|
+
const g24 = g11 + g15
|
|
458
|
+
const g25 = g11 + g16
|
|
459
|
+
const g26 = g11 + g18
|
|
460
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${g11},${g21} L ${g24},${g21} L ${g25},${g9} L ${g25},${g10} L ${g24},${g22} L ${g11},${g22} z M ${g26},${g21} L ${g12},${g20} M ${g26},${vc} L ${g12},${vc} M ${g26},${g22} L ${g12},${g23}`
|
|
461
|
+
}
|
|
462
|
+
break
|
|
463
|
+
case 'irregularSeal1':
|
|
464
|
+
pathData = `M ${w * 10800 / 21600},${h * 5800 / 21600} L ${w * 14522 / 21600},0 L ${w * 14155 / 21600},${h * 5325 / 21600} L ${w * 18380 / 21600},${h * 4457 / 21600} L ${w * 16702 / 21600},${h * 7315 / 21600} L ${w * 21097 / 21600},${h * 8137 / 21600} L ${w * 17607 / 21600},${h * 10475 / 21600} L ${w},${h * 13290 / 21600} L ${w * 16837 / 21600},${h * 12942 / 21600} L ${w * 18145 / 21600},${h * 18095 / 21600} L ${w * 14020 / 21600},${h * 14457 / 21600} L ${w * 13247 / 21600},${h * 19737 / 21600} L ${w * 10532 / 21600},${h * 14935 / 21600} L ${w * 8485 / 21600},${h} L ${w * 7715 / 21600},${h * 15627 / 21600} L ${w * 4762 / 21600},${h * 17617 / 21600} L ${w * 5667 / 21600},${h * 13937 / 21600} L ${w * 135 / 21600},${h * 14587 / 21600} L ${w * 3722 / 21600},${h * 11775 / 21600} L 0,${h * 8615 / 21600} L ${w * 4627 / 21600},${h * 7617 / 21600} L ${w * 370 / 21600},${h * 2295 / 21600} L ${w * 7312 / 21600},${h * 6320 / 21600} L ${w * 8352 / 21600},${h * 2295 / 21600} z`
|
|
465
|
+
break
|
|
466
|
+
case 'irregularSeal2':
|
|
467
|
+
pathData = `M ${w * 11462 / 21600},${h * 4342 / 21600} L ${w * 14790 / 21600},0 L ${w * 14525 / 21600},${h * 5777 / 21600} L ${w * 18007 / 21600},${h * 3172 / 21600} L ${w * 16380 / 21600},${h * 6532 / 21600} L ${w},${h * 6645 / 21600} L ${w * 16985 / 21600},${h * 9402 / 21600} L ${w * 18270 / 21600},${h * 11290 / 21600} L ${w * 16380 / 21600},${h * 12310 / 21600} L ${w * 18877 / 21600},${h * 15632 / 21600} L ${w * 14640 / 21600},${h * 14350 / 21600} L ${w * 14942 / 21600},${h * 17370 / 21600} L ${w * 12180 / 21600},${h * 15935 / 21600} L ${w * 11612 / 21600},${h * 18842 / 21600} L ${w * 9872 / 21600},${h * 17370 / 21600} L ${w * 8700 / 21600},${h * 19712 / 21600} L ${w * 7527 / 21600},${h * 18125 / 21600} L ${w * 4917 / 21600},${h} L ${w * 4805 / 21600},${h * 18240 / 21600} L ${w * 1285 / 21600},${h * 17825 / 21600} L ${w * 3330 / 21600},${h * 15370 / 21600} L 0,${h * 12877 / 21600} L ${w * 3935 / 21600},${h * 11592 / 21600} L ${w * 1172 / 21600},${h * 8270 / 21600} L ${w * 5372 / 21600},${h * 7817 / 21600} L ${w * 4502 / 21600},${h * 3625 / 21600} L ${w * 8550 / 21600},${h * 6382 / 21600} L ${w * 9722 / 21600},${h * 1887 / 21600} z`
|
|
468
|
+
break
|
|
469
|
+
case 'flowChartTerminator':
|
|
470
|
+
{
|
|
471
|
+
const cd2 = 180,
|
|
472
|
+
cd4 = 90,
|
|
473
|
+
c3d4 = 270
|
|
474
|
+
const x1 = w * 3475 / 21600
|
|
475
|
+
const x2 = w * 18125 / 21600
|
|
476
|
+
const y1 = h * 10800 / 21600
|
|
477
|
+
pathData = `M ${x1},0 L ${x2},0 ${shapeArc(x2, h / 2, x1, y1, c3d4, c3d4 + cd2, false).replace('M', 'L')} L ${x1},${h} ${shapeArc(x1, h / 2, x1, y1, cd4, cd4 + cd2, false).replace('M', 'L')} z`
|
|
478
|
+
}
|
|
479
|
+
break
|
|
480
|
+
case 'flowChartPunchedTape':
|
|
481
|
+
{
|
|
482
|
+
const cd2 = 180
|
|
483
|
+
const x1 = w * 5 / 20
|
|
484
|
+
const y1 = h * 2 / 20
|
|
485
|
+
const y2 = h * 18 / 20
|
|
486
|
+
pathData = `M 0,${y1} ${shapeArc(x1, y1, x1, y1, cd2, 0, false).replace('M', 'L')} ${shapeArc(w * (3 / 4), y1, x1, y1, cd2, 360, false).replace('M', 'L')} L ${w},${y2} ${shapeArc(w * (3 / 4), y2, x1, y1, 0, -cd2, false).replace('M', 'L')} ${shapeArc(x1, y2, x1, y1, 0, cd2, false).replace('M', 'L')} z`
|
|
487
|
+
}
|
|
488
|
+
break
|
|
489
|
+
case 'flowChartOnlineStorage':
|
|
490
|
+
{
|
|
491
|
+
const c3d4 = 270,
|
|
492
|
+
cd4 = 90
|
|
493
|
+
const x1 = w * 1 / 6
|
|
494
|
+
const y1 = h * 3 / 6
|
|
495
|
+
pathData = `M ${x1},0 L ${w},0 ${shapeArc(w, h / 2, x1, y1, c3d4, 90, false).replace('M', 'L')} L ${x1},${h} ${shapeArc(x1, h / 2, x1, y1, cd4, 270, false).replace('M', 'L')} z`
|
|
496
|
+
}
|
|
497
|
+
break
|
|
498
|
+
case 'flowChartDisplay':
|
|
499
|
+
{
|
|
500
|
+
const c3d4 = 270,
|
|
501
|
+
cd2 = 180
|
|
502
|
+
const x1 = w * 1 / 6
|
|
503
|
+
const x2 = w * 5 / 6
|
|
504
|
+
const y1 = h * 3 / 6
|
|
505
|
+
pathData = `M 0,${y1} L ${x1},0 L ${x2},0 ${shapeArc(w, h / 2, x1, y1, c3d4, c3d4 + cd2, false).replace('M', 'L')} L ${x1},${h} z`
|
|
506
|
+
}
|
|
507
|
+
break
|
|
508
|
+
case 'flowChartDelay':
|
|
509
|
+
{
|
|
510
|
+
const wd2 = w / 2,
|
|
511
|
+
hd2 = h / 2,
|
|
512
|
+
cd2 = 180,
|
|
513
|
+
c3d4 = 270
|
|
514
|
+
pathData = `M 0,0 L ${wd2},0 ${shapeArc(wd2, hd2, wd2, hd2, c3d4, c3d4 + cd2, false).replace('M', 'L')} L 0,${h} z`
|
|
515
|
+
}
|
|
516
|
+
break
|
|
517
|
+
case 'flowChartMagneticTape':
|
|
518
|
+
{
|
|
519
|
+
const wd2 = w / 2,
|
|
520
|
+
hd2 = h / 2,
|
|
521
|
+
cd2 = 180,
|
|
522
|
+
c3d4 = 270,
|
|
523
|
+
cd4 = 90
|
|
524
|
+
const idy = hd2 * Math.sin(Math.PI / 4)
|
|
525
|
+
const ib = hd2 + idy
|
|
526
|
+
const ang1 = Math.atan(h / w)
|
|
527
|
+
const ang1Dg = ang1 * 180 / Math.PI
|
|
528
|
+
pathData = `M ${wd2},${h} ${shapeArc(wd2, hd2, wd2, hd2, cd4, cd2, false).replace('M', 'L')} ${shapeArc(wd2, hd2, wd2, hd2, cd2, c3d4, false).replace('M', 'L')} ${shapeArc(wd2, hd2, wd2, hd2, c3d4, 360, false).replace('M', 'L')} ${shapeArc(wd2, hd2, wd2, hd2, 0, ang1Dg, false).replace('M', 'L')} L ${w},${ib} L ${w},${h} z`
|
|
529
|
+
}
|
|
530
|
+
break
|
|
531
|
+
case 'ellipse':
|
|
532
|
+
case 'flowChartConnector':
|
|
533
|
+
case 'flowChartSummingJunction':
|
|
534
|
+
case 'flowChartOr':
|
|
535
|
+
{
|
|
536
|
+
const cx = w / 2
|
|
537
|
+
const cy = h / 2
|
|
538
|
+
const rx = w / 2
|
|
539
|
+
const ry = h / 2
|
|
540
|
+
|
|
541
|
+
pathData = `M ${cx - rx},${cy} A ${rx},${ry} 0 1,0 ${cx + rx},${cy} A ${rx},${ry} 0 1,0 ${cx - rx},${cy} Z`
|
|
542
|
+
|
|
543
|
+
if (shapType === 'flowChartOr') {
|
|
544
|
+
pathData += ` M ${w / 2} 0 L ${w / 2} ${h} M 0 ${h / 2} L ${w} ${h / 2}`
|
|
545
|
+
}
|
|
546
|
+
else if (shapType === 'flowChartSummingJunction') {
|
|
547
|
+
const angVal = Math.PI / 4
|
|
548
|
+
const iDx = (w / 2) * Math.cos(angVal)
|
|
549
|
+
const idy = (h / 2) * Math.sin(angVal)
|
|
550
|
+
const il = cx - iDx
|
|
551
|
+
const ir = cx + iDx
|
|
552
|
+
const it = cy - idy
|
|
553
|
+
const ib = cy + idy
|
|
554
|
+
pathData += ` M ${il} ${it} L ${ir} ${ib} M ${ir} ${it} L ${il} ${ib}`
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
break
|
|
558
|
+
case 'roundRect':
|
|
559
|
+
case 'round1Rect':
|
|
560
|
+
case 'round2DiagRect':
|
|
561
|
+
case 'round2SameRect':
|
|
562
|
+
case 'snip1Rect':
|
|
563
|
+
case 'snip2DiagRect':
|
|
564
|
+
case 'snip2SameRect':
|
|
565
|
+
case 'flowChartAlternateProcess':
|
|
566
|
+
case 'flowChartPunchedCard':
|
|
567
|
+
{
|
|
568
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
569
|
+
let sAdj1_val, sAdj2_val
|
|
570
|
+
let shpTyp, adjTyp
|
|
571
|
+
|
|
572
|
+
if (shapAdjst_ary && Array.isArray(shapAdjst_ary)) {
|
|
573
|
+
for (const adj of shapAdjst_ary) {
|
|
574
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
575
|
+
if (sAdj_name === 'adj1') {
|
|
576
|
+
const sAdj1 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
577
|
+
sAdj1_val = parseInt(sAdj1.substring(4)) / 50000
|
|
578
|
+
}
|
|
579
|
+
else if (sAdj_name === 'adj2') {
|
|
580
|
+
const sAdj2 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
581
|
+
sAdj2_val = parseInt(sAdj2.substring(4)) / 50000
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else if (shapAdjst_ary) {
|
|
586
|
+
const sAdj = getTextByPathList(shapAdjst_ary, ['attrs', 'fmla'])
|
|
587
|
+
sAdj1_val = parseInt(sAdj.substring(4)) / 50000
|
|
588
|
+
sAdj2_val = 0
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
let needsTransform = false
|
|
592
|
+
switch (shapType) {
|
|
593
|
+
case 'roundRect':
|
|
594
|
+
case 'flowChartAlternateProcess':
|
|
595
|
+
shpTyp = 'round'
|
|
596
|
+
adjTyp = 'cornrAll'
|
|
597
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
598
|
+
sAdj2_val = 0
|
|
599
|
+
break
|
|
600
|
+
case 'round1Rect':
|
|
601
|
+
shpTyp = 'round'
|
|
602
|
+
adjTyp = 'cornr1'
|
|
603
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
604
|
+
sAdj2_val = 0
|
|
605
|
+
break
|
|
606
|
+
case 'round2DiagRect':
|
|
607
|
+
shpTyp = 'round'
|
|
608
|
+
adjTyp = 'diag'
|
|
609
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
610
|
+
if (sAdj2_val === undefined) sAdj2_val = 0
|
|
611
|
+
break
|
|
612
|
+
case 'round2SameRect':
|
|
613
|
+
shpTyp = 'round'
|
|
614
|
+
adjTyp = 'cornr2'
|
|
615
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
616
|
+
if (sAdj2_val === undefined) sAdj2_val = 0
|
|
617
|
+
break
|
|
618
|
+
case 'snip1Rect':
|
|
619
|
+
case 'flowChartPunchedCard':
|
|
620
|
+
shpTyp = 'snip'
|
|
621
|
+
adjTyp = 'cornr1'
|
|
622
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
623
|
+
sAdj2_val = 0
|
|
624
|
+
if (shapType === 'flowChartPunchedCard') {
|
|
625
|
+
needsTransform = true
|
|
626
|
+
}
|
|
627
|
+
break
|
|
628
|
+
case 'snip2DiagRect':
|
|
629
|
+
shpTyp = 'snip'
|
|
630
|
+
adjTyp = 'diag'
|
|
631
|
+
if (sAdj1_val === undefined) sAdj1_val = 0
|
|
632
|
+
if (sAdj2_val === undefined) sAdj2_val = 0.33334
|
|
633
|
+
break
|
|
634
|
+
case 'snip2SameRect':
|
|
635
|
+
shpTyp = 'snip'
|
|
636
|
+
adjTyp = 'cornr2'
|
|
637
|
+
if (sAdj1_val === undefined) sAdj1_val = 0.33334
|
|
638
|
+
if (sAdj2_val === undefined) sAdj2_val = 0
|
|
639
|
+
break
|
|
640
|
+
default:
|
|
641
|
+
}
|
|
642
|
+
pathData = shapeSnipRoundRect(w, h, sAdj1_val, sAdj2_val, shpTyp, adjTyp)
|
|
643
|
+
|
|
644
|
+
if (needsTransform) {
|
|
645
|
+
pathData = pathData.replace(/([MLQC])\s*([-\d.e]+)\s*([-\d.e]+)/gi, (match, command, x, y) => {
|
|
646
|
+
const newX = w - parseFloat(x)
|
|
647
|
+
return `${command}${newX} ${y}`
|
|
648
|
+
}).replace(/([MLQC])\s*([-\d.e]+)\s*([-\d.e]+)\s*([-\d.e]+)\s*([-\d.e]+)/gi, (match, command, c1x, c1y, x, y) => {
|
|
649
|
+
const newC1X = w - parseFloat(c1x)
|
|
650
|
+
const newX = w - parseFloat(x)
|
|
651
|
+
return `${command}${newC1X} ${c1y} ${newX} ${y}`
|
|
652
|
+
})
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
break
|
|
656
|
+
case 'snipRoundRect':
|
|
657
|
+
{
|
|
658
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
659
|
+
let sAdj1_val = 0.33334
|
|
660
|
+
let sAdj2_val = 0.33334
|
|
661
|
+
if (shapAdjst_ary) {
|
|
662
|
+
for (const adj of shapAdjst_ary) {
|
|
663
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
664
|
+
if (sAdj_name === 'adj1') {
|
|
665
|
+
const sAdj1 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
666
|
+
sAdj1_val = parseInt(sAdj1.substring(4)) / 50000
|
|
667
|
+
}
|
|
668
|
+
else if (sAdj_name === 'adj2') {
|
|
669
|
+
const sAdj2 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
670
|
+
sAdj2_val = parseInt(sAdj2.substring(4)) / 50000
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
pathData = `M0,${h} L${w},${h} L${w},${(h / 2) * sAdj2_val} L${w / 2 + (w / 2) * (1 - sAdj2_val)},0 L${(w / 2) * sAdj1_val},0 Q0,0 0,${(h / 2) * sAdj1_val} z`
|
|
675
|
+
}
|
|
676
|
+
break
|
|
677
|
+
case 'bentConnector2':
|
|
678
|
+
pathData = `M ${w} 0 L ${w} ${h} L 0 ${h}`
|
|
679
|
+
break
|
|
680
|
+
case 'rtTriangle':
|
|
681
|
+
pathData = `M 0 0 L 0 ${h} L ${w} ${h} Z`
|
|
682
|
+
break
|
|
683
|
+
case 'triangle':
|
|
684
|
+
case 'flowChartExtract':
|
|
685
|
+
case 'flowChartMerge':
|
|
686
|
+
{
|
|
687
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
688
|
+
let shapAdjst_val = 0.5
|
|
689
|
+
if (shapAdjst) {
|
|
690
|
+
shapAdjst_val = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
let p1x = w * shapAdjst_val
|
|
694
|
+
let p1y = 0
|
|
695
|
+
let p2x = 0
|
|
696
|
+
let p2y = h
|
|
697
|
+
let p3x = w
|
|
698
|
+
let p3y = h
|
|
699
|
+
|
|
700
|
+
if (shapType === 'flowChartMerge') {
|
|
701
|
+
[p1x, p1y] = [w - p1x, h - p1y]
|
|
702
|
+
;[p2x, p2y] = [w - p2x, h - p2y]
|
|
703
|
+
;[p3x, p3y] = [w - p3x, h - p3y]
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
pathData = `M ${p1x} ${p1y} L ${p2x} ${p2y} L ${p3x} ${p3y} Z`
|
|
707
|
+
}
|
|
708
|
+
break
|
|
709
|
+
case 'diamond':
|
|
710
|
+
case 'flowChartDecision':
|
|
711
|
+
case 'flowChartSort':
|
|
712
|
+
pathData = `M ${w / 2} 0 L 0 ${h / 2} L ${w / 2} ${h} L ${w} ${h / 2} Z`
|
|
713
|
+
if (shapType === 'flowChartSort') {
|
|
714
|
+
pathData += ` M 0 ${h / 2} L ${w} ${h / 2}`
|
|
715
|
+
}
|
|
716
|
+
break
|
|
717
|
+
case 'trapezoid':
|
|
718
|
+
case 'flowChartManualOperation':
|
|
719
|
+
case 'flowChartManualInput':
|
|
720
|
+
{
|
|
721
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
722
|
+
let adjst_val = 0.2
|
|
723
|
+
const max_adj_const = 0.7407
|
|
724
|
+
if (shapAdjst) {
|
|
725
|
+
const adjst = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
726
|
+
adjst_val = (adjst * 0.5) / max_adj_const
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
let p1x = w * adjst_val,
|
|
730
|
+
p1y = 0
|
|
731
|
+
let p2x = 0,
|
|
732
|
+
p2y = h
|
|
733
|
+
let p3x = w,
|
|
734
|
+
p3y = h
|
|
735
|
+
let p4x = (1 - adjst_val) * w,
|
|
736
|
+
p4y = 0
|
|
737
|
+
|
|
738
|
+
if (shapType === 'flowChartManualInput') {
|
|
739
|
+
adjst_val = 0
|
|
740
|
+
p1y = h / 5
|
|
741
|
+
p1x = w * adjst_val
|
|
742
|
+
p4x = (1 - adjst_val) * w
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
if (shapType === 'flowChartManualOperation') {
|
|
746
|
+
[p1x, p1y] = [w - p1x, h - p1y]
|
|
747
|
+
;[p2x, p2y] = [w - p2x, h - p2y]
|
|
748
|
+
;[p3x, p3y] = [w - p3x, h - p3y]
|
|
749
|
+
;[p4x, p4y] = [w - p4x, h - p4y]
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
pathData = `M ${p1x} ${p1y} L ${p2x} ${p2y} L ${p3x} ${p3y} L ${p4x} ${p4y} Z`
|
|
753
|
+
}
|
|
754
|
+
break
|
|
755
|
+
case 'parallelogram':
|
|
756
|
+
case 'flowChartInputOutput':
|
|
757
|
+
{
|
|
758
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
759
|
+
let adjst_val = 0.25
|
|
760
|
+
if (shapAdjst) {
|
|
761
|
+
const max_adj_const = w > h ? w / h : h / w
|
|
762
|
+
const adjst = parseInt(shapAdjst.substring(4)) / 100000
|
|
763
|
+
adjst_val = adjst / max_adj_const
|
|
764
|
+
}
|
|
765
|
+
pathData = `M ${adjst_val * w} 0 L 0 ${h} L ${(1 - adjst_val) * w} ${h} L ${w} 0 Z`
|
|
766
|
+
}
|
|
767
|
+
break
|
|
768
|
+
case 'pentagon':
|
|
769
|
+
pathData = `M ${0.5 * w} 0 L 0 ${0.375 * h} L ${0.15 * w} ${h} L ${0.85 * w} ${h} L ${w} ${0.375 * h} Z`
|
|
770
|
+
break
|
|
771
|
+
case 'hexagon':
|
|
772
|
+
case 'flowChartPreparation':
|
|
773
|
+
{
|
|
774
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
775
|
+
let adj = 25000 * RATIO_EMUs_Points
|
|
776
|
+
if (shapAdjst) {
|
|
777
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
778
|
+
}
|
|
779
|
+
const vf = 115470 * RATIO_EMUs_Points
|
|
780
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
781
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
782
|
+
const angVal1 = 60 * Math.PI / 180
|
|
783
|
+
const ss = Math.min(w, h)
|
|
784
|
+
const maxAdj = cnstVal1 * w / ss
|
|
785
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
786
|
+
const hd2 = h / 2
|
|
787
|
+
const shd2 = hd2 * vf / cnstVal2
|
|
788
|
+
const x1 = ss * a / cnstVal2
|
|
789
|
+
const x2 = w - x1
|
|
790
|
+
const dy1 = shd2 * Math.sin(angVal1)
|
|
791
|
+
const vc = h / 2
|
|
792
|
+
const y1 = vc - dy1
|
|
793
|
+
const y2 = vc + dy1
|
|
794
|
+
pathData = `M 0,${vc} L ${x1},${y1} L ${x2},${y1} L ${w},${vc} L ${x2},${y2} L ${x1},${y2} z`
|
|
795
|
+
}
|
|
796
|
+
break
|
|
797
|
+
case 'heptagon':
|
|
798
|
+
pathData = `M ${0.5 * w} 0 L ${w / 8} ${h / 4} L 0 ${5 / 8 * h} L ${w / 4} ${h} L ${3 / 4 * w} ${h} L ${w} ${5 / 8 * h} L ${7 / 8 * w} ${h / 4} Z`
|
|
799
|
+
break
|
|
800
|
+
case 'octagon':
|
|
801
|
+
{
|
|
802
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
803
|
+
let adj1 = 0.25
|
|
804
|
+
if (shapAdjst) {
|
|
805
|
+
adj1 = parseInt(shapAdjst.substring(4)) / 100000
|
|
806
|
+
}
|
|
807
|
+
const adj2 = (1 - adj1)
|
|
808
|
+
pathData = `M ${adj1 * w} 0 L 0 ${adj1 * h} L 0 ${adj2 * h} L ${adj1 * w} ${h} L ${adj2 * w} ${h} L ${w} ${adj2 * h} L ${w} ${adj1 * h} L ${adj2 * w} 0 Z`
|
|
809
|
+
}
|
|
810
|
+
break
|
|
811
|
+
case 'decagon':
|
|
812
|
+
pathData = `M ${3 / 8 * w} 0 L ${w / 8} ${h / 8} L 0 ${h / 2} L ${w / 8} ${7 / 8 * h} L ${3 / 8 * w} ${h} L ${5 / 8 * w} ${h} L ${7 / 8 * w} ${7 / 8 * h} L ${w} ${h / 2} L ${7 / 8 * w} ${h / 8} L ${5 / 8 * w} 0 Z`
|
|
813
|
+
break
|
|
814
|
+
case 'dodecagon':
|
|
815
|
+
pathData = `M ${3 / 8 * w} 0 L ${w / 8} ${h / 8} L 0 ${3 / 8 * h} L 0 ${5 / 8 * h} L ${w / 8} ${7 / 8 * h} L ${3 / 8 * w} ${h} L ${5 / 8 * w} ${h} L ${7 / 8 * w} ${7 / 8 * h} L ${w} ${5 / 8 * h} L ${w} ${3 / 8 * h} L ${7 / 8 * w} ${h / 8} L ${5 / 8 * w} 0 Z`
|
|
816
|
+
break
|
|
817
|
+
case 'star4':
|
|
818
|
+
{
|
|
819
|
+
const hc = w / 2,
|
|
820
|
+
vc = h / 2,
|
|
821
|
+
wd2 = w / 2,
|
|
822
|
+
hd2 = h / 2
|
|
823
|
+
let adj = 19098 * RATIO_EMUs_Points
|
|
824
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
825
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
826
|
+
if (shapAdjst) {
|
|
827
|
+
const name = shapAdjst['attrs']['name']
|
|
828
|
+
if (name === 'adj') {
|
|
829
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
833
|
+
const iwd2 = wd2 * a / cnstVal1
|
|
834
|
+
const ihd2 = hd2 * a / cnstVal1
|
|
835
|
+
const sdx = iwd2 * Math.cos(0.7853981634)
|
|
836
|
+
const sdy = ihd2 * Math.sin(0.7853981634)
|
|
837
|
+
const sx1 = hc - sdx
|
|
838
|
+
const sx2 = hc + sdx
|
|
839
|
+
const sy1 = vc - sdy
|
|
840
|
+
const sy2 = vc + sdy
|
|
841
|
+
pathData = `M 0,${vc} L ${sx1},${sy1} L ${hc},0 L ${sx2},${sy1} L ${w},${vc} L ${sx2},${sy2} L ${hc},${h} L ${sx1},${sy2} z`
|
|
842
|
+
}
|
|
843
|
+
break
|
|
844
|
+
case 'star5':
|
|
845
|
+
{
|
|
846
|
+
const hc = w / 2,
|
|
847
|
+
vc = h / 2,
|
|
848
|
+
wd2 = w / 2,
|
|
849
|
+
hd2 = h / 2
|
|
850
|
+
let adj = 19098 * RATIO_EMUs_Points
|
|
851
|
+
let hf = 105146 * RATIO_EMUs_Points
|
|
852
|
+
let vf = 110557 * RATIO_EMUs_Points
|
|
853
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
854
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
855
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
856
|
+
if (shapAdjst) {
|
|
857
|
+
Object.keys(shapAdjst).forEach(key => {
|
|
858
|
+
const name = shapAdjst[key]['attrs']['name']
|
|
859
|
+
if (name === 'adj') {
|
|
860
|
+
adj = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
861
|
+
}
|
|
862
|
+
else if (name === 'hf') {
|
|
863
|
+
hf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
864
|
+
}
|
|
865
|
+
else if (name === 'vf') {
|
|
866
|
+
vf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
867
|
+
}
|
|
868
|
+
})
|
|
869
|
+
}
|
|
870
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
871
|
+
const swd2 = wd2 * hf / cnstVal1
|
|
872
|
+
const shd2 = hd2 * vf / cnstVal1
|
|
873
|
+
const svc = vc * vf / cnstVal1
|
|
874
|
+
const dx1 = swd2 * Math.cos(0.31415926536)
|
|
875
|
+
const dx2 = swd2 * Math.cos(5.3407075111)
|
|
876
|
+
const dy1 = shd2 * Math.sin(0.31415926536)
|
|
877
|
+
const dy2 = shd2 * Math.sin(5.3407075111)
|
|
878
|
+
const x1 = hc - dx1
|
|
879
|
+
const x2 = hc - dx2
|
|
880
|
+
const x3 = hc + dx2
|
|
881
|
+
const x4 = hc + dx1
|
|
882
|
+
const y1 = svc - dy1
|
|
883
|
+
const y2 = svc - dy2
|
|
884
|
+
const iwd2 = swd2 * a / maxAdj
|
|
885
|
+
const ihd2 = shd2 * a / maxAdj
|
|
886
|
+
const sdx1 = iwd2 * Math.cos(5.9690260418)
|
|
887
|
+
const sdx2 = iwd2 * Math.cos(0.94247779608)
|
|
888
|
+
const sdy1 = ihd2 * Math.sin(0.94247779608)
|
|
889
|
+
const sdy2 = ihd2 * Math.sin(5.9690260418)
|
|
890
|
+
const sx1 = hc - sdx1
|
|
891
|
+
const sx2 = hc - sdx2
|
|
892
|
+
const sx3 = hc + sdx2
|
|
893
|
+
const sx4 = hc + sdx1
|
|
894
|
+
const sy1 = svc - sdy1
|
|
895
|
+
const sy2 = svc - sdy2
|
|
896
|
+
const sy3 = svc + ihd2
|
|
897
|
+
pathData = `M ${x1},${y1} L ${sx2},${sy1} L ${hc},0 L ${sx3},${sy1} L ${x4},${y1} L ${sx4},${sy2} L ${x3},${y2} L ${hc},${sy3} L ${x2},${y2} L ${sx1},${sy2} z`
|
|
898
|
+
}
|
|
899
|
+
break
|
|
900
|
+
case 'star6':
|
|
901
|
+
{
|
|
902
|
+
const hc = w / 2,
|
|
903
|
+
vc = h / 2,
|
|
904
|
+
wd2 = w / 2,
|
|
905
|
+
hd2 = h / 2,
|
|
906
|
+
hd4 = h / 4
|
|
907
|
+
let adj = 28868 * RATIO_EMUs_Points
|
|
908
|
+
let hf = 115470 * RATIO_EMUs_Points
|
|
909
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
910
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
911
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
912
|
+
if (shapAdjst) {
|
|
913
|
+
Object.keys(shapAdjst).forEach(key => {
|
|
914
|
+
const name = shapAdjst[key]['attrs']['name']
|
|
915
|
+
if (name === 'adj') {
|
|
916
|
+
adj = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
917
|
+
}
|
|
918
|
+
else if (name === 'hf') {
|
|
919
|
+
hf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
920
|
+
}
|
|
921
|
+
})
|
|
922
|
+
}
|
|
923
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
924
|
+
const swd2 = wd2 * hf / cnstVal1
|
|
925
|
+
const dx1 = swd2 * Math.cos(0.5235987756)
|
|
926
|
+
const x1 = hc - dx1
|
|
927
|
+
const x2 = hc + dx1
|
|
928
|
+
const y2 = vc + hd4
|
|
929
|
+
const iwd2 = swd2 * a / maxAdj
|
|
930
|
+
const ihd2 = hd2 * a / maxAdj
|
|
931
|
+
const sdx2 = iwd2 / 2
|
|
932
|
+
const sx1 = hc - iwd2
|
|
933
|
+
const sx2 = hc - sdx2
|
|
934
|
+
const sx3 = hc + sdx2
|
|
935
|
+
const sx4 = hc + iwd2
|
|
936
|
+
const sdy1 = ihd2 * Math.sin(1.0471975512)
|
|
937
|
+
const sy1 = vc - sdy1
|
|
938
|
+
const sy2 = vc + sdy1
|
|
939
|
+
pathData = `M ${x1},${hd4} L ${sx2},${sy1} L ${hc},0 L ${sx3},${sy1} L ${x2},${hd4} L ${sx4},${vc} L ${x2},${y2} L ${sx3},${sy2} L ${hc},${h} L ${sx2},${sy2} L ${x1},${y2} L ${sx1},${vc} z`
|
|
940
|
+
}
|
|
941
|
+
break
|
|
942
|
+
case 'star7':
|
|
943
|
+
{
|
|
944
|
+
const hc = w / 2,
|
|
945
|
+
vc = h / 2,
|
|
946
|
+
wd2 = w / 2,
|
|
947
|
+
hd2 = h / 2
|
|
948
|
+
let adj = 34601 * RATIO_EMUs_Points
|
|
949
|
+
let hf = 102572 * RATIO_EMUs_Points
|
|
950
|
+
let vf = 105210 * RATIO_EMUs_Points
|
|
951
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
952
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
953
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
954
|
+
if (shapAdjst) {
|
|
955
|
+
Object.keys(shapAdjst).forEach(key => {
|
|
956
|
+
const name = shapAdjst[key]['attrs']['name']
|
|
957
|
+
if (name === 'adj') {
|
|
958
|
+
adj = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
959
|
+
}
|
|
960
|
+
else if (name === 'hf') {
|
|
961
|
+
hf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
962
|
+
}
|
|
963
|
+
else if (name === 'vf') {
|
|
964
|
+
vf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
965
|
+
}
|
|
966
|
+
})
|
|
967
|
+
}
|
|
968
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
969
|
+
const swd2 = wd2 * hf / cnstVal1
|
|
970
|
+
const shd2 = hd2 * vf / cnstVal1
|
|
971
|
+
const svc = vc * vf / cnstVal1
|
|
972
|
+
const dx1 = swd2 * 97493 / 100000
|
|
973
|
+
const dx2 = swd2 * 78183 / 100000
|
|
974
|
+
const dx3 = swd2 * 43388 / 100000
|
|
975
|
+
const dy1 = shd2 * 62349 / 100000
|
|
976
|
+
const dy2 = shd2 * 22252 / 100000
|
|
977
|
+
const dy3 = shd2 * 90097 / 100000
|
|
978
|
+
const x1 = hc - dx1
|
|
979
|
+
const x2 = hc - dx2
|
|
980
|
+
const x3 = hc - dx3
|
|
981
|
+
const x4 = hc + dx3
|
|
982
|
+
const x5 = hc + dx2
|
|
983
|
+
const x6 = hc + dx1
|
|
984
|
+
const y1 = svc - dy1
|
|
985
|
+
const y2 = svc + dy2
|
|
986
|
+
const y3 = svc + dy3
|
|
987
|
+
const iwd2 = swd2 * a / maxAdj
|
|
988
|
+
const ihd2 = shd2 * a / maxAdj
|
|
989
|
+
const sdx1 = iwd2 * 97493 / 100000
|
|
990
|
+
const sdx2 = iwd2 * 78183 / 100000
|
|
991
|
+
const sdx3 = iwd2 * 43388 / 100000
|
|
992
|
+
const sx1 = hc - sdx1
|
|
993
|
+
const sx2 = hc - sdx2
|
|
994
|
+
const sx3 = hc - sdx3
|
|
995
|
+
const sx4 = hc + sdx3
|
|
996
|
+
const sx5 = hc + sdx2
|
|
997
|
+
const sx6 = hc + sdx1
|
|
998
|
+
const sdy1 = ihd2 * 90097 / 100000
|
|
999
|
+
const sdy2 = ihd2 * 22252 / 100000
|
|
1000
|
+
const sdy3 = ihd2 * 62349 / 100000
|
|
1001
|
+
const sy1 = svc - sdy1
|
|
1002
|
+
const sy2 = svc - sdy2
|
|
1003
|
+
const sy3 = svc + sdy3
|
|
1004
|
+
const sy4 = svc + ihd2
|
|
1005
|
+
pathData = `M ${x1},${y2} L ${sx1},${sy2} L ${x2},${y1} L ${sx3},${sy1} L ${hc},0 L ${sx4},${sy1} L ${x5},${y1} L ${sx6},${sy2} L ${x6},${y2} L ${sx5},${sy3} L ${x4},${y3} L ${hc},${sy4} L ${x3},${y3} L ${sx2},${sy3} z`
|
|
1006
|
+
}
|
|
1007
|
+
break
|
|
1008
|
+
case 'star8':
|
|
1009
|
+
{
|
|
1010
|
+
const hc = w / 2,
|
|
1011
|
+
vc = h / 2,
|
|
1012
|
+
wd2 = w / 2,
|
|
1013
|
+
hd2 = h / 2
|
|
1014
|
+
let adj = 37500 * RATIO_EMUs_Points
|
|
1015
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1016
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1017
|
+
if (shapAdjst) {
|
|
1018
|
+
const name = shapAdjst['attrs']['name']
|
|
1019
|
+
if (name === 'adj') {
|
|
1020
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1024
|
+
const dx1 = wd2 * Math.cos(0.7853981634)
|
|
1025
|
+
const x1 = hc - dx1
|
|
1026
|
+
const x2 = hc + dx1
|
|
1027
|
+
const dy1 = hd2 * Math.sin(0.7853981634)
|
|
1028
|
+
const y1 = vc - dy1
|
|
1029
|
+
const y2 = vc + dy1
|
|
1030
|
+
const iwd2 = wd2 * a / maxAdj
|
|
1031
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1032
|
+
const sdx1 = iwd2 * 92388 / 100000
|
|
1033
|
+
const sdx2 = iwd2 * 38268 / 100000
|
|
1034
|
+
const sdy1 = ihd2 * 92388 / 100000
|
|
1035
|
+
const sdy2 = ihd2 * 38268 / 100000
|
|
1036
|
+
const sx1 = hc - sdx1
|
|
1037
|
+
const sx2 = hc - sdx2
|
|
1038
|
+
const sx3 = hc + sdx2
|
|
1039
|
+
const sx4 = hc + sdx1
|
|
1040
|
+
const sy1 = vc - sdy1
|
|
1041
|
+
const sy2 = vc - sdy2
|
|
1042
|
+
const sy3 = vc + sdy2
|
|
1043
|
+
const sy4 = vc + sdy1
|
|
1044
|
+
pathData = `M 0,${vc} L ${sx1},${sy2} L ${x1},${y1} L ${sx2},${sy1} L ${hc},0 L ${sx3},${sy1} L ${x2},${y1} L ${sx4},${sy2} L ${w},${vc} L ${sx4},${sy3} L ${x2},${y2} L ${sx3},${sy4} L ${hc},${h} L ${sx2},${sy4} L ${x1},${y2} L ${sx1},${sy3} z`
|
|
1045
|
+
}
|
|
1046
|
+
break
|
|
1047
|
+
case 'star10':
|
|
1048
|
+
{
|
|
1049
|
+
const hc = w / 2,
|
|
1050
|
+
vc = h / 2,
|
|
1051
|
+
wd2 = w / 2,
|
|
1052
|
+
hd2 = h / 2
|
|
1053
|
+
let adj = 42533 * RATIO_EMUs_Points
|
|
1054
|
+
let hf = 105146 * RATIO_EMUs_Points
|
|
1055
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1056
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
1057
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1058
|
+
if (shapAdjst) {
|
|
1059
|
+
Object.keys(shapAdjst).forEach(key => {
|
|
1060
|
+
const name = shapAdjst[key]['attrs']['name']
|
|
1061
|
+
if (name === 'adj') {
|
|
1062
|
+
adj = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1063
|
+
}
|
|
1064
|
+
else if (name === 'hf') {
|
|
1065
|
+
hf = parseInt(shapAdjst[key]['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1066
|
+
}
|
|
1067
|
+
})
|
|
1068
|
+
}
|
|
1069
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1070
|
+
const swd2 = wd2 * hf / cnstVal1
|
|
1071
|
+
const dx1 = swd2 * 95106 / 100000
|
|
1072
|
+
const dx2 = swd2 * 58779 / 100000
|
|
1073
|
+
const x1 = hc - dx1
|
|
1074
|
+
const x2 = hc - dx2
|
|
1075
|
+
const x3 = hc + dx2
|
|
1076
|
+
const x4 = hc + dx1
|
|
1077
|
+
const dy1 = hd2 * 80902 / 100000
|
|
1078
|
+
const dy2 = hd2 * 30902 / 100000
|
|
1079
|
+
const y1 = vc - dy1
|
|
1080
|
+
const y2 = vc - dy2
|
|
1081
|
+
const y3 = vc + dy2
|
|
1082
|
+
const y4 = vc + dy1
|
|
1083
|
+
const iwd2 = swd2 * a / maxAdj
|
|
1084
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1085
|
+
const sdx1 = iwd2 * 80902 / 100000
|
|
1086
|
+
const sdx2 = iwd2 * 30902 / 100000
|
|
1087
|
+
const sdy1 = ihd2 * 95106 / 100000
|
|
1088
|
+
const sdy2 = ihd2 * 58779 / 100000
|
|
1089
|
+
const sx1 = hc - iwd2
|
|
1090
|
+
const sx2 = hc - sdx1
|
|
1091
|
+
const sx3 = hc - sdx2
|
|
1092
|
+
const sx4 = hc + sdx2
|
|
1093
|
+
const sx5 = hc + sdx1
|
|
1094
|
+
const sx6 = hc + iwd2
|
|
1095
|
+
const sy1 = vc - sdy1
|
|
1096
|
+
const sy2 = vc - sdy2
|
|
1097
|
+
const sy3 = vc + sdy2
|
|
1098
|
+
const sy4 = vc + sdy1
|
|
1099
|
+
pathData = `M ${x1},${y2} L ${sx2},${sy2} L ${x2},${y1} L ${sx3},${sy1} L ${hc},0 L ${sx4},${sy1} L ${x3},${y1} L ${sx5},${sy2} L ${x4},${y2} L ${sx6},${vc} L ${x4},${y3} L ${sx5},${sy3} L ${x3},${y4} L ${sx4},${sy4} L ${hc},${h} L ${sx3},${sy4} L ${x2},${y4} L ${sx2},${sy3} L ${x1},${y3} L ${sx1},${vc} z`
|
|
1100
|
+
}
|
|
1101
|
+
break
|
|
1102
|
+
case 'star12':
|
|
1103
|
+
{
|
|
1104
|
+
const hc = w / 2,
|
|
1105
|
+
vc = h / 2,
|
|
1106
|
+
wd2 = w / 2,
|
|
1107
|
+
hd2 = h / 2,
|
|
1108
|
+
hd4 = h / 4,
|
|
1109
|
+
wd4 = w / 4
|
|
1110
|
+
let adj = 37500 * RATIO_EMUs_Points
|
|
1111
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1112
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1113
|
+
if (shapAdjst) {
|
|
1114
|
+
const name = shapAdjst['attrs']['name']
|
|
1115
|
+
if (name === 'adj') {
|
|
1116
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1120
|
+
const dx1 = wd2 * Math.cos(0.5235987756)
|
|
1121
|
+
const dy1 = hd2 * Math.sin(1.0471975512)
|
|
1122
|
+
const x1 = hc - dx1
|
|
1123
|
+
const x3 = w * 3 / 4
|
|
1124
|
+
const x4 = hc + dx1
|
|
1125
|
+
const y1 = vc - dy1
|
|
1126
|
+
const y3 = h * 3 / 4
|
|
1127
|
+
const y4 = vc + dy1
|
|
1128
|
+
const iwd2 = wd2 * a / maxAdj
|
|
1129
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1130
|
+
const sdx1 = iwd2 * Math.cos(0.2617993878)
|
|
1131
|
+
const sdx2 = iwd2 * Math.cos(0.7853981634)
|
|
1132
|
+
const sdx3 = iwd2 * Math.cos(1.308996939)
|
|
1133
|
+
const sdy1 = ihd2 * Math.sin(1.308996939)
|
|
1134
|
+
const sdy2 = ihd2 * Math.sin(0.7853981634)
|
|
1135
|
+
const sdy3 = ihd2 * Math.sin(0.2617993878)
|
|
1136
|
+
const sx1 = hc - sdx1
|
|
1137
|
+
const sx2 = hc - sdx2
|
|
1138
|
+
const sx3 = hc - sdx3
|
|
1139
|
+
const sx4 = hc + sdx3
|
|
1140
|
+
const sx5 = hc + sdx2
|
|
1141
|
+
const sx6 = hc + sdx1
|
|
1142
|
+
const sy1 = vc - sdy1
|
|
1143
|
+
const sy2 = vc - sdy2
|
|
1144
|
+
const sy3 = vc - sdy3
|
|
1145
|
+
const sy4 = vc + sdy3
|
|
1146
|
+
const sy5 = vc + sdy2
|
|
1147
|
+
const sy6 = vc + sdy1
|
|
1148
|
+
pathData = `M 0,${vc} L ${sx1},${sy3} L ${x1},${hd4} L ${sx2},${sy2} L ${wd4},${y1} L ${sx3},${sy1} L ${hc},0 L ${sx4},${sy1} L ${x3},${y1} L ${sx5},${sy2} L ${x4},${hd4} L ${sx6},${sy3} L ${w},${vc} L ${sx6},${sy4} L ${x4},${y3} L ${sx5},${sy5} L ${x3},${y4} L ${sx4},${sy6} L ${hc},${h} L ${sx3},${sy6} L ${wd4},${y4} L ${sx2},${sy5} L ${x1},${y3} L ${sx1},${sy4} z`
|
|
1149
|
+
}
|
|
1150
|
+
break
|
|
1151
|
+
case 'star16':
|
|
1152
|
+
{
|
|
1153
|
+
const hc = w / 2,
|
|
1154
|
+
vc = h / 2,
|
|
1155
|
+
wd2 = w / 2,
|
|
1156
|
+
hd2 = h / 2
|
|
1157
|
+
let adj = 37500 * RATIO_EMUs_Points
|
|
1158
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1159
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1160
|
+
if (shapAdjst) {
|
|
1161
|
+
const name = shapAdjst['attrs']['name']
|
|
1162
|
+
if (name === 'adj') {
|
|
1163
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1167
|
+
const dx1 = wd2 * 92388 / 100000
|
|
1168
|
+
const dx2 = wd2 * 70711 / 100000
|
|
1169
|
+
const dx3 = wd2 * 38268 / 100000
|
|
1170
|
+
const dy1 = hd2 * 92388 / 100000
|
|
1171
|
+
const dy2 = hd2 * 70711 / 100000
|
|
1172
|
+
const dy3 = hd2 * 38268 / 100000
|
|
1173
|
+
const x1 = hc - dx1
|
|
1174
|
+
const x2 = hc - dx2
|
|
1175
|
+
const x3 = hc - dx3
|
|
1176
|
+
const x4 = hc + dx3
|
|
1177
|
+
const x5 = hc + dx2
|
|
1178
|
+
const x6 = hc + dx1
|
|
1179
|
+
const y1 = vc - dy1
|
|
1180
|
+
const y2 = vc - dy2
|
|
1181
|
+
const y3 = vc - dy3
|
|
1182
|
+
const y4 = vc + dy3
|
|
1183
|
+
const y5 = vc + dy2
|
|
1184
|
+
const y6 = vc + dy1
|
|
1185
|
+
const iwd2 = wd2 * a / maxAdj
|
|
1186
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1187
|
+
const sdx1 = iwd2 * 98079 / 100000
|
|
1188
|
+
const sdx2 = iwd2 * 83147 / 100000
|
|
1189
|
+
const sdx3 = iwd2 * 55557 / 100000
|
|
1190
|
+
const sdx4 = iwd2 * 19509 / 100000
|
|
1191
|
+
const sdy1 = ihd2 * 98079 / 100000
|
|
1192
|
+
const sdy2 = ihd2 * 83147 / 100000
|
|
1193
|
+
const sdy3 = ihd2 * 55557 / 100000
|
|
1194
|
+
const sdy4 = ihd2 * 19509 / 100000
|
|
1195
|
+
const sx1 = hc - sdx1
|
|
1196
|
+
const sx2 = hc - sdx2
|
|
1197
|
+
const sx3 = hc - sdx3
|
|
1198
|
+
const sx4 = hc - sdx4
|
|
1199
|
+
const sx5 = hc + sdx4
|
|
1200
|
+
const sx6 = hc + sdx3
|
|
1201
|
+
const sx7 = hc + sdx2
|
|
1202
|
+
const sx8 = hc + sdx1
|
|
1203
|
+
const sy1 = vc - sdy1
|
|
1204
|
+
const sy2 = vc - sdy2
|
|
1205
|
+
const sy3 = vc - sdy3
|
|
1206
|
+
const sy4 = vc - sdy4
|
|
1207
|
+
const sy5 = vc + sdy4
|
|
1208
|
+
const sy6 = vc + sdy3
|
|
1209
|
+
const sy7 = vc + sdy2
|
|
1210
|
+
const sy8 = vc + sdy1
|
|
1211
|
+
pathData = `M 0,${vc} L ${sx1},${sy4} L ${x1},${y3} L ${sx2},${sy3} L ${x2},${y2} L ${sx3},${sy2} L ${x3},${y1} L ${sx4},${sy1} L ${hc},0 L ${sx5},${sy1} L ${x4},${y1} L ${sx6},${sy2} L ${x5},${y2} L ${sx7},${sy3} L ${x6},${y3} L ${sx8},${sy4} L ${w},${vc} L ${sx8},${sy5} L ${x6},${y4} L ${sx7},${sy6} L ${x5},${y5} L ${sx6},${sy7} L ${x4},${y6} L ${sx5},${sy8} L ${hc},${h} L ${sx4},${sy8} L ${x3},${y6} L ${sx3},${sy7} L ${x2},${y5} L ${sx2},${sy6} L ${x1},${y4} L ${sx1},${sy5} z`
|
|
1212
|
+
}
|
|
1213
|
+
break
|
|
1214
|
+
case 'star24':
|
|
1215
|
+
{
|
|
1216
|
+
const hc = w / 2,
|
|
1217
|
+
vc = h / 2,
|
|
1218
|
+
wd2 = w / 2,
|
|
1219
|
+
hd2 = h / 2,
|
|
1220
|
+
hd4 = h / 4,
|
|
1221
|
+
wd4 = w / 4
|
|
1222
|
+
let adj = 37500 * RATIO_EMUs_Points
|
|
1223
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1224
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1225
|
+
if (shapAdjst) {
|
|
1226
|
+
const name = shapAdjst['attrs']['name']
|
|
1227
|
+
if (name === 'adj') {
|
|
1228
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1232
|
+
const dx1 = wd2 * Math.cos(0.2617993878)
|
|
1233
|
+
const dx2 = wd2 * Math.cos(0.5235987756)
|
|
1234
|
+
const dx3 = wd2 * Math.cos(0.7853981634)
|
|
1235
|
+
const dx4 = wd4
|
|
1236
|
+
const dx5 = wd2 * Math.cos(1.308996939)
|
|
1237
|
+
const dy1 = hd2 * Math.sin(1.308996939)
|
|
1238
|
+
const dy2 = hd2 * Math.sin(1.0471975512)
|
|
1239
|
+
const dy3 = hd2 * Math.sin(0.7853981634)
|
|
1240
|
+
const dy4 = hd4
|
|
1241
|
+
const dy5 = hd2 * Math.sin(0.2617993878)
|
|
1242
|
+
const x1 = hc - dx1
|
|
1243
|
+
const x2 = hc - dx2
|
|
1244
|
+
const x3 = hc - dx3
|
|
1245
|
+
const x4 = hc - dx4
|
|
1246
|
+
const x5 = hc - dx5
|
|
1247
|
+
const x6 = hc + dx5
|
|
1248
|
+
const x7 = hc + dx4
|
|
1249
|
+
const x8 = hc + dx3
|
|
1250
|
+
const x9 = hc + dx2
|
|
1251
|
+
const x10 = hc + dx1
|
|
1252
|
+
const y1 = vc - dy1
|
|
1253
|
+
const y2 = vc - dy2
|
|
1254
|
+
const y3 = vc - dy3
|
|
1255
|
+
const y4 = vc - dy4
|
|
1256
|
+
const y5 = vc - dy5
|
|
1257
|
+
const y6 = vc + dy5
|
|
1258
|
+
const y7 = vc + dy4
|
|
1259
|
+
const y8 = vc + dy3
|
|
1260
|
+
const y9 = vc + dy2
|
|
1261
|
+
const y10 = vc + dy1
|
|
1262
|
+
const iwd2 = wd2 * a / maxAdj
|
|
1263
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1264
|
+
const sdx1 = iwd2 * 99144 / 100000
|
|
1265
|
+
const sdx2 = iwd2 * 92388 / 100000
|
|
1266
|
+
const sdx3 = iwd2 * 79335 / 100000
|
|
1267
|
+
const sdx4 = iwd2 * 60876 / 100000
|
|
1268
|
+
const sdx5 = iwd2 * 38268 / 100000
|
|
1269
|
+
const sdx6 = iwd2 * 13053 / 100000
|
|
1270
|
+
const sdy1 = ihd2 * 99144 / 100000
|
|
1271
|
+
const sdy2 = ihd2 * 92388 / 100000
|
|
1272
|
+
const sdy3 = ihd2 * 79335 / 100000
|
|
1273
|
+
const sdy4 = ihd2 * 60876 / 100000
|
|
1274
|
+
const sdy5 = ihd2 * 38268 / 100000
|
|
1275
|
+
const sdy6 = ihd2 * 13053 / 100000
|
|
1276
|
+
const sx1 = hc - sdx1
|
|
1277
|
+
const sx2 = hc - sdx2
|
|
1278
|
+
const sx3 = hc - sdx3
|
|
1279
|
+
const sx4 = hc - sdx4
|
|
1280
|
+
const sx5 = hc - sdx5
|
|
1281
|
+
const sx6 = hc - sdx6
|
|
1282
|
+
const sx7 = hc + sdx6
|
|
1283
|
+
const sx8 = hc + sdx5
|
|
1284
|
+
const sx9 = hc + sdx4
|
|
1285
|
+
const sx10 = hc + sdx3
|
|
1286
|
+
const sx11 = hc + sdx2
|
|
1287
|
+
const sx12 = hc + sdx1
|
|
1288
|
+
const sy1 = vc - sdy1
|
|
1289
|
+
const sy2 = vc - sdy2
|
|
1290
|
+
const sy3 = vc - sdy3
|
|
1291
|
+
const sy4 = vc - sdy4
|
|
1292
|
+
const sy5 = vc - sdy5
|
|
1293
|
+
const sy6 = vc - sdy6
|
|
1294
|
+
const sy7 = vc + sdy6
|
|
1295
|
+
const sy8 = vc + sdy5
|
|
1296
|
+
const sy9 = vc + sdy4
|
|
1297
|
+
const sy10 = vc + sdy3
|
|
1298
|
+
const sy11 = vc + sdy2
|
|
1299
|
+
const sy12 = vc + sdy1
|
|
1300
|
+
pathData = `M 0,${vc} L ${sx1},${sy6} L ${x1},${y5} L ${sx2},${sy5} L ${x2},${y4} L ${sx3},${sy4} L ${x3},${y3} L ${sx4},${sy3} L ${x4},${y2} L ${sx5},${sy2} L ${x5},${y1} L ${sx6},${sy1} L ${hc},0 L ${sx7},${sy1} L ${x6},${y1} L ${sx8},${sy2} L ${x7},${y2} L ${sx9},${sy3} L ${x8},${y3} L ${sx10},${sy4} L ${x9},${y4} L ${sx11},${sy5} L ${x10},${y5} L ${sx12},${sy6} L ${w},${vc} L ${sx12},${sy7} L ${x10},${y6} L ${sx11},${sy8} L ${x9},${y7} L ${sx10},${sy9} L ${x8},${y8} L ${sx9},${sy10} L ${x7},${y9} L ${sx8},${sy11} L ${x6},${y10} L ${sx7},${sy12} L ${hc},${h} L ${sx6},${sy12} L ${x5},${y10} L ${sx5},${sy11} L ${x4},${y9} L ${sx4},${sy10} L ${x3},${y8} L ${sx3},${sy9} L ${x2},${y7} L ${sx2},${sy8} L ${x1},${y6} L ${sx1},${sy7} z`
|
|
1301
|
+
}
|
|
1302
|
+
break
|
|
1303
|
+
case 'star32':
|
|
1304
|
+
{
|
|
1305
|
+
const hc = w / 2,
|
|
1306
|
+
vc = h / 2,
|
|
1307
|
+
wd2 = w / 2,
|
|
1308
|
+
hd2 = h / 2
|
|
1309
|
+
let adj = 37500 * RATIO_EMUs_Points
|
|
1310
|
+
const maxAdj = 50000 * RATIO_EMUs_Points
|
|
1311
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1312
|
+
if (shapAdjst) {
|
|
1313
|
+
const name = shapAdjst['attrs']['name']
|
|
1314
|
+
if (name === 'adj') {
|
|
1315
|
+
adj = parseInt(shapAdjst['attrs']['fmla'].substring(4)) * RATIO_EMUs_Points
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1319
|
+
const dx1 = wd2 * 98079 / 100000
|
|
1320
|
+
const dx2 = wd2 * 92388 / 100000
|
|
1321
|
+
const dx3 = wd2 * 83147 / 100000
|
|
1322
|
+
const dx4 = wd2 * Math.cos(0.7853981634)
|
|
1323
|
+
const dx5 = wd2 * 55557 / 100000
|
|
1324
|
+
const dx6 = wd2 * 38268 / 100000
|
|
1325
|
+
const dx7 = wd2 * 19509 / 100000
|
|
1326
|
+
const dy1 = hd2 * 98079 / 100000
|
|
1327
|
+
const dy2 = hd2 * 92388 / 100000
|
|
1328
|
+
const dy3 = hd2 * 83147 / 100000
|
|
1329
|
+
const dy4 = hd2 * Math.sin(0.7853981634)
|
|
1330
|
+
const dy5 = hd2 * 55557 / 100000
|
|
1331
|
+
const dy6 = hd2 * 38268 / 100000
|
|
1332
|
+
const dy7 = hd2 * 19509 / 100000
|
|
1333
|
+
const x1 = hc - dx1
|
|
1334
|
+
const x2 = hc - dx2
|
|
1335
|
+
const x3 = hc - dx3
|
|
1336
|
+
const x4 = hc - dx4
|
|
1337
|
+
const x5 = hc - dx5
|
|
1338
|
+
const x6 = hc - dx6
|
|
1339
|
+
const x7 = hc - dx7
|
|
1340
|
+
const x8 = hc + dx7
|
|
1341
|
+
const x9 = hc + dx6
|
|
1342
|
+
const x10 = hc + dx5
|
|
1343
|
+
const x11 = hc + dx4
|
|
1344
|
+
const x12 = hc + dx3
|
|
1345
|
+
const x13 = hc + dx2
|
|
1346
|
+
const x14 = hc + dx1
|
|
1347
|
+
const y1 = vc - dy1
|
|
1348
|
+
const y2 = vc - dy2
|
|
1349
|
+
const y3 = vc - dy3
|
|
1350
|
+
const y4 = vc - dy4
|
|
1351
|
+
const y5 = vc - dy5
|
|
1352
|
+
const y6 = vc - dy6
|
|
1353
|
+
const y7 = vc - dy7
|
|
1354
|
+
const y8 = vc + dy7
|
|
1355
|
+
const y9 = vc + dy6
|
|
1356
|
+
const y10 = vc + dy5
|
|
1357
|
+
const y11 = vc + dy4
|
|
1358
|
+
const y12 = vc + dy3
|
|
1359
|
+
const y13 = vc + dy2
|
|
1360
|
+
const y14 = vc + dy1
|
|
1361
|
+
const iwd2 = wd2 * a / maxAdj
|
|
1362
|
+
const ihd2 = hd2 * a / maxAdj
|
|
1363
|
+
const sdx1 = iwd2 * 99518 / 100000
|
|
1364
|
+
const sdx2 = iwd2 * 95694 / 100000
|
|
1365
|
+
const sdx3 = iwd2 * 88192 / 100000
|
|
1366
|
+
const sdx4 = iwd2 * 77301 / 100000
|
|
1367
|
+
const sdx5 = iwd2 * 63439 / 100000
|
|
1368
|
+
const sdx6 = iwd2 * 47140 / 100000
|
|
1369
|
+
const sdx7 = iwd2 * 29028 / 100000
|
|
1370
|
+
const sdx8 = iwd2 * 9802 / 100000
|
|
1371
|
+
const sdy1 = ihd2 * 99518 / 100000
|
|
1372
|
+
const sdy2 = ihd2 * 95694 / 100000
|
|
1373
|
+
const sdy3 = ihd2 * 88192 / 100000
|
|
1374
|
+
const sdy4 = ihd2 * 77301 / 100000
|
|
1375
|
+
const sdy5 = ihd2 * 63439 / 100000
|
|
1376
|
+
const sdy6 = ihd2 * 47140 / 100000
|
|
1377
|
+
const sdy7 = ihd2 * 29028 / 100000
|
|
1378
|
+
const sdy8 = ihd2 * 9802 / 100000
|
|
1379
|
+
const sx1 = hc - sdx1
|
|
1380
|
+
const sx2 = hc - sdx2
|
|
1381
|
+
const sx3 = hc - sdx3
|
|
1382
|
+
const sx4 = hc - sdx4
|
|
1383
|
+
const sx5 = hc - sdx5
|
|
1384
|
+
const sx6 = hc - sdx6
|
|
1385
|
+
const sx7 = hc - sdx7
|
|
1386
|
+
const sx8 = hc - sdx8
|
|
1387
|
+
const sx9 = hc + sdx8
|
|
1388
|
+
const sx10 = hc + sdx7
|
|
1389
|
+
const sx11 = hc + sdx6
|
|
1390
|
+
const sx12 = hc + sdx5
|
|
1391
|
+
const sx13 = hc + sdx4
|
|
1392
|
+
const sx14 = hc + sdx3
|
|
1393
|
+
const sx15 = hc + sdx2
|
|
1394
|
+
const sx16 = hc + sdx1
|
|
1395
|
+
const sy1 = vc - sdy1
|
|
1396
|
+
const sy2 = vc - sdy2
|
|
1397
|
+
const sy3 = vc - sdy3
|
|
1398
|
+
const sy4 = vc - sdy4
|
|
1399
|
+
const sy5 = vc - sdy5
|
|
1400
|
+
const sy6 = vc - sdy6
|
|
1401
|
+
const sy7 = vc - sdy7
|
|
1402
|
+
const sy8 = vc - sdy8
|
|
1403
|
+
const sy9 = vc + sdy8
|
|
1404
|
+
const sy10 = vc + sdy7
|
|
1405
|
+
const sy11 = vc + sdy6
|
|
1406
|
+
const sy12 = vc + sdy5
|
|
1407
|
+
const sy13 = vc + sdy4
|
|
1408
|
+
const sy14 = vc + sdy3
|
|
1409
|
+
const sy15 = vc + sdy2
|
|
1410
|
+
const sy16 = vc + sdy1
|
|
1411
|
+
pathData = `M 0,${vc} L ${sx1},${sy8} L ${x1},${y7} L ${sx2},${sy7} L ${x2},${y6} L ${sx3},${sy6} L ${x3},${y5} L ${sx4},${sy5} L ${x4},${y4} L ${sx5},${sy4} L ${x5},${y3} L ${sx6},${sy3} L ${x6},${y2} L ${sx7},${sy2} L ${x7},${y1} L ${sx8},${sy1} L ${hc},0 L ${sx9},${sy1} L ${x8},${y1} L ${sx10},${sy2} L ${x9},${y2} L ${sx11},${sy3} L ${x10},${y3} L ${sx12},${sy4} L ${x11},${y4} L ${sx13},${sy5} L ${x12},${y5} L ${sx14},${sy6} L ${x13},${y6} L ${sx15},${sy7} L ${x14},${y7} L ${sx16},${sy8} L ${w},${vc} L ${sx16},${sy9} L ${x14},${y8} L ${sx15},${sy10} L ${x13},${y9} L ${sx14},${sy11} L ${x12},${y10} L ${sx13},${sy12} L ${x11},${y11} L ${sx12},${sy13} L ${x10},${y12} L ${sx11},${sy14} L ${x9},${y13} L ${sx10},${sy15} L ${x8},${y14} L ${sx9},${sy16} L ${hc},${h} L ${sx8},${sy16} L ${x7},${y14} L ${sx7},${sy15} L ${x6},${y13} L ${sx6},${sy14} L ${x5},${y12} L ${sx5},${sy13} L ${x4},${y11} L ${sx4},${sy12} L ${x3},${y10} L ${sx3},${sy11} L ${x2},${y9} L ${sx2},${sy10} L ${x1},${y8} L ${sx1},${sy9} z`
|
|
1412
|
+
}
|
|
1413
|
+
break
|
|
1414
|
+
case 'pie':
|
|
1415
|
+
case 'pieWedge':
|
|
1416
|
+
case 'arc':
|
|
1417
|
+
{
|
|
1418
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1419
|
+
let adj1, adj2, H, isClose
|
|
1420
|
+
|
|
1421
|
+
if (shapType === 'pie') {
|
|
1422
|
+
adj1 = 0
|
|
1423
|
+
adj2 = 270
|
|
1424
|
+
H = h
|
|
1425
|
+
isClose = true
|
|
1426
|
+
}
|
|
1427
|
+
else if (shapType === 'pieWedge') {
|
|
1428
|
+
adj1 = 180
|
|
1429
|
+
adj2 = 270
|
|
1430
|
+
H = 2 * h
|
|
1431
|
+
isClose = true
|
|
1432
|
+
}
|
|
1433
|
+
else if (shapType === 'arc') {
|
|
1434
|
+
adj1 = 270
|
|
1435
|
+
adj2 = 0
|
|
1436
|
+
H = h
|
|
1437
|
+
isClose = false
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
if (shapAdjst) {
|
|
1441
|
+
let shapAdjst1 = getTextByPathList(shapAdjst, ['attrs', 'fmla'])
|
|
1442
|
+
let shapAdjst2 = shapAdjst1
|
|
1443
|
+
if (shapAdjst1 === undefined) {
|
|
1444
|
+
shapAdjst1 = shapAdjst[0]['attrs']['fmla']
|
|
1445
|
+
shapAdjst2 = shapAdjst[1]['attrs']['fmla']
|
|
1446
|
+
}
|
|
1447
|
+
if (shapAdjst1) {
|
|
1448
|
+
adj1 = parseInt(shapAdjst1.substring(4)) / 60000
|
|
1449
|
+
}
|
|
1450
|
+
if (shapAdjst2) {
|
|
1451
|
+
adj2 = parseInt(shapAdjst2.substring(4)) / 60000
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
pathData = shapePie(H, w, adj1, adj2, isClose)
|
|
1456
|
+
}
|
|
1457
|
+
break
|
|
1458
|
+
case 'chord':
|
|
1459
|
+
{
|
|
1460
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1461
|
+
let sAdj1_val = 45
|
|
1462
|
+
let sAdj2_val = 270
|
|
1463
|
+
if (shapAdjst_ary) {
|
|
1464
|
+
for (const adj of shapAdjst_ary) {
|
|
1465
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1466
|
+
if (sAdj_name === 'adj1') {
|
|
1467
|
+
const sAdj1 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
1468
|
+
sAdj1_val = parseInt(sAdj1.substring(4)) / 60000
|
|
1469
|
+
}
|
|
1470
|
+
else if (sAdj_name === 'adj2') {
|
|
1471
|
+
const sAdj2 = getTextByPathList(adj, ['attrs', 'fmla'])
|
|
1472
|
+
sAdj2_val = parseInt(sAdj2.substring(4)) / 60000
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
const hR = h / 2
|
|
1477
|
+
const wR = w / 2
|
|
1478
|
+
pathData = shapeArc(wR, hR, wR, hR, sAdj1_val, sAdj2_val, true)
|
|
1479
|
+
}
|
|
1480
|
+
break
|
|
1481
|
+
case 'frame':
|
|
1482
|
+
{
|
|
1483
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1484
|
+
let adj1 = 12500 * RATIO_EMUs_Points
|
|
1485
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1486
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1487
|
+
if (shapAdjst) {
|
|
1488
|
+
adj1 = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1489
|
+
}
|
|
1490
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
1491
|
+
const x1 = Math.min(w, h) * a1 / cnstVal2
|
|
1492
|
+
const x4 = w - x1
|
|
1493
|
+
const y4 = h - x1
|
|
1494
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${x1},${x1} L ${x1},${y4} L ${x4},${y4} L ${x4},${x1} z`
|
|
1495
|
+
}
|
|
1496
|
+
break
|
|
1497
|
+
case 'donut':
|
|
1498
|
+
{
|
|
1499
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1500
|
+
let adj = 25000 * RATIO_EMUs_Points
|
|
1501
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1502
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1503
|
+
if (shapAdjst) {
|
|
1504
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1505
|
+
}
|
|
1506
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
1507
|
+
const dr = Math.min(w, h) * a / cnstVal2
|
|
1508
|
+
const iwd2 = w / 2 - dr
|
|
1509
|
+
const ihd2 = h / 2 - dr
|
|
1510
|
+
const outerPath = `M ${w / 2 - w / 2},${h / 2} A ${w / 2},${h / 2} 0 1,0 ${w / 2 + w / 2},${h / 2} A ${w / 2},${h / 2} 0 1,0 ${w / 2 - w / 2},${h / 2} Z`
|
|
1511
|
+
const innerPath = `M ${w / 2 + iwd2},${h / 2} A ${iwd2},${ihd2} 0 1,0 ${w / 2 - iwd2},${h / 2} A ${iwd2},${ihd2} 0 1,0 ${w / 2 + iwd2},${h / 2} Z`
|
|
1512
|
+
pathData = `${outerPath} ${innerPath}`
|
|
1513
|
+
}
|
|
1514
|
+
break
|
|
1515
|
+
case 'noSmoking':
|
|
1516
|
+
{
|
|
1517
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1518
|
+
let adj = 18750 * RATIO_EMUs_Points
|
|
1519
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1520
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1521
|
+
if (shapAdjst) {
|
|
1522
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1523
|
+
}
|
|
1524
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
1525
|
+
const dr = Math.min(w, h) * a / cnstVal2
|
|
1526
|
+
const iwd2 = w / 2 - dr
|
|
1527
|
+
const ihd2 = h / 2 - dr
|
|
1528
|
+
const ang = Math.atan(h / w)
|
|
1529
|
+
const ct = ihd2 * Math.cos(ang)
|
|
1530
|
+
const st = iwd2 * Math.sin(ang)
|
|
1531
|
+
const m = Math.sqrt(ct * ct + st * st)
|
|
1532
|
+
const n = iwd2 * ihd2 / m
|
|
1533
|
+
const drd2 = dr / 2
|
|
1534
|
+
const dang = Math.atan(drd2 / n)
|
|
1535
|
+
const swAng = -Math.PI + (dang * 2)
|
|
1536
|
+
const stAng1 = ang - dang
|
|
1537
|
+
const stAng2 = stAng1 - Math.PI
|
|
1538
|
+
const ct1 = ihd2 * Math.cos(stAng1)
|
|
1539
|
+
const st1 = iwd2 * Math.sin(stAng1)
|
|
1540
|
+
const m1 = Math.sqrt(ct1 * ct1 + st1 * st1)
|
|
1541
|
+
const n1 = iwd2 * ihd2 / m1
|
|
1542
|
+
const dx1 = n1 * Math.cos(stAng1)
|
|
1543
|
+
const dy1 = n1 * Math.sin(stAng1)
|
|
1544
|
+
const x1 = w / 2 + dx1
|
|
1545
|
+
const y1 = h / 2 + dy1
|
|
1546
|
+
const x2 = w / 2 - dx1
|
|
1547
|
+
const y2 = h / 2 - dy1
|
|
1548
|
+
const stAng1deg = stAng1 * 180 / Math.PI
|
|
1549
|
+
const stAng2deg = stAng2 * 180 / Math.PI
|
|
1550
|
+
const swAng2deg = swAng * 180 / Math.PI
|
|
1551
|
+
const outerCircle = `M ${w / 2 - w / 2},${h / 2} A ${w / 2},${h / 2} 0 1,0 ${w / 2 + w / 2},${h / 2} A ${w / 2},${h / 2} 0 1,0 ${w / 2 - w / 2},${h / 2} Z`
|
|
1552
|
+
const slash1 = `M ${x1},${y1} ${shapeArc(w / 2, h / 2, iwd2, ihd2, stAng1deg, (stAng1deg + swAng2deg), false).replace('M', 'L')} z`
|
|
1553
|
+
const slash2 = `M ${x2},${y2} ${shapeArc(w / 2, h / 2, iwd2, ihd2, stAng2deg, (stAng2deg + swAng2deg), false).replace('M', 'L')} z`
|
|
1554
|
+
pathData = `${outerCircle} ${slash1} ${slash2}`
|
|
1555
|
+
}
|
|
1556
|
+
break
|
|
1557
|
+
case 'halfFrame':
|
|
1558
|
+
{
|
|
1559
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1560
|
+
let sAdj1_val = 3.5
|
|
1561
|
+
let sAdj2_val = 3.5
|
|
1562
|
+
const cnsVal = 100000 * RATIO_EMUs_Points
|
|
1563
|
+
if (shapAdjst_ary) {
|
|
1564
|
+
for (const adj of shapAdjst_ary) {
|
|
1565
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1566
|
+
if (sAdj_name === 'adj1') {
|
|
1567
|
+
sAdj1_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1568
|
+
}
|
|
1569
|
+
else if (sAdj_name === 'adj2') {
|
|
1570
|
+
sAdj2_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
const minWH = Math.min(w, h)
|
|
1575
|
+
const maxAdj2 = (cnsVal * w) / minWH
|
|
1576
|
+
const a2 = (sAdj2_val < 0) ? 0 : (sAdj2_val > maxAdj2) ? maxAdj2 : sAdj2_val
|
|
1577
|
+
const x1 = (minWH * a2) / cnsVal
|
|
1578
|
+
const g2 = h - (h * x1 / w)
|
|
1579
|
+
const maxAdj1 = (cnsVal * g2) / minWH
|
|
1580
|
+
const a1 = (sAdj1_val < 0) ? 0 : (sAdj1_val > maxAdj1) ? maxAdj1 : sAdj1_val
|
|
1581
|
+
const y1 = minWH * a1 / cnsVal
|
|
1582
|
+
const x2 = w - (y1 * w / h)
|
|
1583
|
+
const y2 = h - (x1 * h / w)
|
|
1584
|
+
pathData = `M 0,0 L ${w},0 L ${x2},${y1} L ${x1},${y1} L ${x1},${y2} L 0,${h} z`
|
|
1585
|
+
}
|
|
1586
|
+
break
|
|
1587
|
+
case 'blockArc':
|
|
1588
|
+
{
|
|
1589
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1590
|
+
let adj1 = 180
|
|
1591
|
+
let adj2 = 0
|
|
1592
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
1593
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1594
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1595
|
+
if (shapAdjst_ary) {
|
|
1596
|
+
for (const adj of shapAdjst_ary) {
|
|
1597
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1598
|
+
if (sAdj_name === 'adj1') {
|
|
1599
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000
|
|
1600
|
+
}
|
|
1601
|
+
else if (sAdj_name === 'adj2') {
|
|
1602
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000
|
|
1603
|
+
}
|
|
1604
|
+
else if (sAdj_name === 'adj3') {
|
|
1605
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
const cd1 = 360
|
|
1610
|
+
const stAng = (adj1 < 0) ? 0 : (adj1 > cd1) ? cd1 : adj1
|
|
1611
|
+
const istAng = (adj2 < 0) ? 0 : (adj2 > cd1) ? cd1 : adj2
|
|
1612
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > cnstVal1) ? cnstVal1 : adj3
|
|
1613
|
+
const sw11 = istAng - stAng
|
|
1614
|
+
const sw12 = sw11 + cd1
|
|
1615
|
+
const swAng = (sw11 > 0) ? sw11 : sw12
|
|
1616
|
+
const iswAng = -swAng
|
|
1617
|
+
const endAng = stAng + swAng
|
|
1618
|
+
const iendAng = istAng + iswAng
|
|
1619
|
+
const stRd = stAng * (Math.PI) / 180
|
|
1620
|
+
const istRd = istAng * (Math.PI) / 180
|
|
1621
|
+
const wd2 = w / 2
|
|
1622
|
+
const hd2 = h / 2
|
|
1623
|
+
const hc = w / 2
|
|
1624
|
+
const vc = h / 2
|
|
1625
|
+
let x1, y1
|
|
1626
|
+
if (stAng > 90 && stAng < 270) {
|
|
1627
|
+
const wt1 = wd2 * (Math.sin((Math.PI) / 2 - stRd))
|
|
1628
|
+
const ht1 = hd2 * (Math.cos((Math.PI) / 2 - stRd))
|
|
1629
|
+
const dx1 = wd2 * (Math.cos(Math.atan(ht1 / wt1)))
|
|
1630
|
+
const dy1 = hd2 * (Math.sin(Math.atan(ht1 / wt1)))
|
|
1631
|
+
x1 = hc - dx1
|
|
1632
|
+
y1 = vc - dy1
|
|
1633
|
+
}
|
|
1634
|
+
else {
|
|
1635
|
+
const wt1 = wd2 * (Math.sin(stRd))
|
|
1636
|
+
const ht1 = hd2 * (Math.cos(stRd))
|
|
1637
|
+
const dx1 = wd2 * (Math.cos(Math.atan(wt1 / ht1)))
|
|
1638
|
+
const dy1 = hd2 * (Math.sin(Math.atan(wt1 / ht1)))
|
|
1639
|
+
x1 = hc + dx1
|
|
1640
|
+
y1 = vc + dy1
|
|
1641
|
+
}
|
|
1642
|
+
const dr = Math.min(w, h) * a3 / cnstVal2
|
|
1643
|
+
const iwd2 = wd2 - dr
|
|
1644
|
+
const ihd2 = hd2 - dr
|
|
1645
|
+
let x2, y2
|
|
1646
|
+
if ((endAng <= 450 && endAng > 270) || ((endAng >= 630 && endAng < 720))) {
|
|
1647
|
+
const wt2 = iwd2 * (Math.sin(istRd))
|
|
1648
|
+
const ht2 = ihd2 * (Math.cos(istRd))
|
|
1649
|
+
const dx2 = iwd2 * (Math.cos(Math.atan(wt2 / ht2)))
|
|
1650
|
+
const dy2 = ihd2 * (Math.sin(Math.atan(wt2 / ht2)))
|
|
1651
|
+
x2 = hc + dx2
|
|
1652
|
+
y2 = vc + dy2
|
|
1653
|
+
}
|
|
1654
|
+
else {
|
|
1655
|
+
const wt2 = iwd2 * (Math.sin((Math.PI) / 2 - istRd))
|
|
1656
|
+
const ht2 = ihd2 * (Math.cos((Math.PI) / 2 - istRd))
|
|
1657
|
+
const dx2 = iwd2 * (Math.cos(Math.atan(ht2 / wt2)))
|
|
1658
|
+
const dy2 = ihd2 * (Math.sin(Math.atan(ht2 / wt2)))
|
|
1659
|
+
x2 = hc - dx2
|
|
1660
|
+
y2 = vc - dy2
|
|
1661
|
+
}
|
|
1662
|
+
pathData = `M ${x1},${y1} ${shapeArc(wd2, hd2, wd2, hd2, stAng, endAng, false).replace('M', 'L')} L ${x2},${y2} ${shapeArc(wd2, hd2, iwd2, ihd2, istAng, iendAng, false).replace('M', 'L')} z`
|
|
1663
|
+
}
|
|
1664
|
+
break
|
|
1665
|
+
case 'bracePair':
|
|
1666
|
+
{
|
|
1667
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1668
|
+
let adj = 8333 * RATIO_EMUs_Points
|
|
1669
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
1670
|
+
const cnstVal2 = 50000 * RATIO_EMUs_Points
|
|
1671
|
+
const cnstVal3 = 100000 * RATIO_EMUs_Points
|
|
1672
|
+
if (shapAdjst) {
|
|
1673
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1674
|
+
}
|
|
1675
|
+
const vc = h / 2,
|
|
1676
|
+
cd2 = 180,
|
|
1677
|
+
cd4 = 90,
|
|
1678
|
+
c3d4 = 270
|
|
1679
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
1680
|
+
const minWH = Math.min(w, h)
|
|
1681
|
+
const x1 = minWH * a / cnstVal3
|
|
1682
|
+
const x2 = minWH * a / cnstVal2
|
|
1683
|
+
const x3 = w - x2
|
|
1684
|
+
const x4 = w - x1
|
|
1685
|
+
const y2 = vc - x1
|
|
1686
|
+
const y3 = vc + x1
|
|
1687
|
+
const y4 = h - x1
|
|
1688
|
+
pathData = `M ${x2},${h} ${shapeArc(x2, y4, x1, x1, cd4, cd2, false).replace('M', 'L')} L ${x1},${y3} ${shapeArc(0, y3, x1, x1, 0, (-cd4), false).replace('M', 'L')} ${shapeArc(0, y2, x1, x1, cd4, 0, false).replace('M', 'L')} L ${x1},${x1} ${shapeArc(x2, x1, x1, x1, cd2, c3d4, false).replace('M', 'L')} M ${x3},0 ${shapeArc(x3, x1, x1, x1, c3d4, 360, false).replace('M', 'L')} L ${x4},${y2} ${shapeArc(w, y2, x1, x1, cd2, cd4, false).replace('M', 'L')} ${shapeArc(w, y3, x1, x1, c3d4, cd2, false).replace('M', 'L')} L ${x4},${y4} ${shapeArc(x3, y4, x1, x1, 0, cd4, false).replace('M', 'L')}`
|
|
1689
|
+
}
|
|
1690
|
+
break
|
|
1691
|
+
case 'leftBrace':
|
|
1692
|
+
{
|
|
1693
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1694
|
+
let adj1 = 8333 * RATIO_EMUs_Points
|
|
1695
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
1696
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1697
|
+
if (shapAdjst_ary) {
|
|
1698
|
+
for (const adj of shapAdjst_ary) {
|
|
1699
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1700
|
+
if (sAdj_name === 'adj1') {
|
|
1701
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1702
|
+
}
|
|
1703
|
+
else if (sAdj_name === 'adj2') {
|
|
1704
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
const cd2 = 180,
|
|
1709
|
+
cd4 = 90,
|
|
1710
|
+
c3d4 = 270
|
|
1711
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal2) ? cnstVal2 : adj2
|
|
1712
|
+
const minWH = Math.min(w, h)
|
|
1713
|
+
const q1 = cnstVal2 - a2
|
|
1714
|
+
const q2 = (q1 < a2) ? q1 : a2
|
|
1715
|
+
const q3 = q2 / 2
|
|
1716
|
+
const maxAdj1 = q3 * h / minWH
|
|
1717
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
1718
|
+
const y1 = minWH * a1 / cnstVal2
|
|
1719
|
+
const y3 = h * a2 / cnstVal2
|
|
1720
|
+
const y2 = y3 - y1
|
|
1721
|
+
const y4 = y3 + y1
|
|
1722
|
+
pathData = `M ${w},${h} ${shapeArc(w, h - y1, w / 2, y1, cd4, cd2, false).replace('M', 'L')} L ${w / 2},${y4} ${shapeArc(0, y4, w / 2, y1, 0, (-cd4), false).replace('M', 'L')} ${shapeArc(0, y2, w / 2, y1, cd4, 0, false).replace('M', 'L')} L ${w / 2},${y1} ${shapeArc(w, y1, w / 2, y1, cd2, c3d4, false).replace('M', 'L')}`
|
|
1723
|
+
}
|
|
1724
|
+
break
|
|
1725
|
+
case 'rightBrace':
|
|
1726
|
+
{
|
|
1727
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1728
|
+
let adj1 = 8333 * RATIO_EMUs_Points
|
|
1729
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
1730
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1731
|
+
if (shapAdjst_ary) {
|
|
1732
|
+
for (const adj of shapAdjst_ary) {
|
|
1733
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1734
|
+
if (sAdj_name === 'adj1') {
|
|
1735
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1736
|
+
}
|
|
1737
|
+
else if (sAdj_name === 'adj2') {
|
|
1738
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
const cd = 360,
|
|
1743
|
+
cd2 = 180,
|
|
1744
|
+
cd4 = 90,
|
|
1745
|
+
c3d4 = 270
|
|
1746
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal2) ? cnstVal2 : adj2
|
|
1747
|
+
const minWH = Math.min(w, h)
|
|
1748
|
+
const q1 = cnstVal2 - a2
|
|
1749
|
+
const q2 = (q1 < a2) ? q1 : a2
|
|
1750
|
+
const q3 = q2 / 2
|
|
1751
|
+
const maxAdj1 = q3 * h / minWH
|
|
1752
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
1753
|
+
const y1 = minWH * a1 / cnstVal2
|
|
1754
|
+
const y3 = h * a2 / cnstVal2
|
|
1755
|
+
const y2 = y3 - y1
|
|
1756
|
+
const y4 = h - y1
|
|
1757
|
+
pathData = `M 0,0 ${shapeArc(0, y1, w / 2, y1, c3d4, cd, false).replace('M', 'L')} L ${w / 2},${y2} ${shapeArc(w, y2, w / 2, y1, cd2, cd4, false).replace('M', 'L')} ${shapeArc(w, y3 + y1, w / 2, y1, c3d4, cd2, false).replace('M', 'L')} L ${w / 2},${y4} ${shapeArc(0, y4, w / 2, y1, 0, cd4, false).replace('M', 'L')}`
|
|
1758
|
+
}
|
|
1759
|
+
break
|
|
1760
|
+
case 'bracketPair':
|
|
1761
|
+
{
|
|
1762
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1763
|
+
let adj = 16667 * RATIO_EMUs_Points
|
|
1764
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1765
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1766
|
+
if (shapAdjst) {
|
|
1767
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1768
|
+
}
|
|
1769
|
+
const cd2 = 180,
|
|
1770
|
+
cd4 = 90,
|
|
1771
|
+
c3d4 = 270
|
|
1772
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
1773
|
+
const x1 = Math.min(w, h) * a / cnstVal2
|
|
1774
|
+
const x2 = w - x1
|
|
1775
|
+
const y2 = h - x1
|
|
1776
|
+
pathData = `${shapeArc(x1, x1, x1, x1, c3d4, cd2, false)} ${shapeArc(x1, y2, x1, x1, cd2, cd4, false).replace('M', 'L')} ${shapeArc(x2, x1, x1, x1, c3d4, (c3d4 + cd4), false)} ${shapeArc(x2, y2, x1, x1, 0, cd4, false).replace('M', 'L')}`
|
|
1777
|
+
}
|
|
1778
|
+
break
|
|
1779
|
+
case 'leftBracket':
|
|
1780
|
+
{
|
|
1781
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1782
|
+
let adj = 8333 * RATIO_EMUs_Points
|
|
1783
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1784
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1785
|
+
const maxAdj = cnstVal1 * h / Math.min(w, h)
|
|
1786
|
+
if (shapAdjst) {
|
|
1787
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1788
|
+
}
|
|
1789
|
+
const cd2 = 180,
|
|
1790
|
+
cd4 = 90,
|
|
1791
|
+
c3d4 = 270
|
|
1792
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1793
|
+
let y1 = Math.min(w, h) * a / cnstVal2
|
|
1794
|
+
if (y1 > w) y1 = w
|
|
1795
|
+
const y2 = h - y1
|
|
1796
|
+
pathData = `M ${w},${h} ${shapeArc(y1, y2, y1, y1, cd4, cd2, false).replace('M', 'L')} L 0,${y1} ${shapeArc(y1, y1, y1, y1, cd2, c3d4, false).replace('M', 'L')} L ${w},0`
|
|
1797
|
+
}
|
|
1798
|
+
break
|
|
1799
|
+
case 'rightBracket':
|
|
1800
|
+
{
|
|
1801
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1802
|
+
let adj = 8333 * RATIO_EMUs_Points
|
|
1803
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
1804
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
1805
|
+
const maxAdj = cnstVal1 * h / Math.min(w, h)
|
|
1806
|
+
if (shapAdjst) {
|
|
1807
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1808
|
+
}
|
|
1809
|
+
const cd = 360,
|
|
1810
|
+
cd4 = 90,
|
|
1811
|
+
c3d4 = 270
|
|
1812
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
1813
|
+
const y1 = Math.min(w, h) * a / cnstVal2
|
|
1814
|
+
const y2 = h - y1
|
|
1815
|
+
const y3 = w - y1
|
|
1816
|
+
pathData = `M 0,${h} ${shapeArc(y3, y2, y1, y1, cd4, 0, false).replace('M', 'L')} L ${w},${h / 2} ${shapeArc(y3, y1, y1, y1, cd, c3d4, false).replace('M', 'L')} L 0,0`
|
|
1817
|
+
}
|
|
1818
|
+
break
|
|
1819
|
+
case 'moon':
|
|
1820
|
+
{
|
|
1821
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1822
|
+
let adj = 0.5
|
|
1823
|
+
if (shapAdjst) {
|
|
1824
|
+
adj = parseInt(shapAdjst.substring(4)) / 100000
|
|
1825
|
+
}
|
|
1826
|
+
const hd2 = h / 2
|
|
1827
|
+
const cd2 = 180
|
|
1828
|
+
const cd4 = 90
|
|
1829
|
+
const adj2 = (1 - adj) * w
|
|
1830
|
+
pathData = `M ${w},${h} ${shapeArc(w, hd2, w, hd2, cd4, (cd4 + cd2), false).replace('M', 'L')} ${shapeArc(w, hd2, adj2, hd2, (cd4 + cd2), cd4, false).replace('M', 'L')} z`
|
|
1831
|
+
}
|
|
1832
|
+
break
|
|
1833
|
+
case 'corner':
|
|
1834
|
+
{
|
|
1835
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
1836
|
+
let sAdj1_val = 50000 * RATIO_EMUs_Points
|
|
1837
|
+
let sAdj2_val = 50000 * RATIO_EMUs_Points
|
|
1838
|
+
const cnsVal = 100000 * RATIO_EMUs_Points
|
|
1839
|
+
if (shapAdjst_ary) {
|
|
1840
|
+
for (const adj of shapAdjst_ary) {
|
|
1841
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
1842
|
+
if (sAdj_name === 'adj1') {
|
|
1843
|
+
sAdj1_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1844
|
+
}
|
|
1845
|
+
else if (sAdj_name === 'adj2') {
|
|
1846
|
+
sAdj2_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
const minWH = Math.min(w, h)
|
|
1851
|
+
const maxAdj1 = cnsVal * h / minWH
|
|
1852
|
+
const maxAdj2 = cnsVal * w / minWH
|
|
1853
|
+
const a1 = (sAdj1_val < 0) ? 0 : (sAdj1_val > maxAdj1) ? maxAdj1 : sAdj1_val
|
|
1854
|
+
const a2 = (sAdj2_val < 0) ? 0 : (sAdj2_val > maxAdj2) ? maxAdj2 : sAdj2_val
|
|
1855
|
+
const x1 = minWH * a2 / cnsVal
|
|
1856
|
+
const dy1 = minWH * a1 / cnsVal
|
|
1857
|
+
const y1 = h - dy1
|
|
1858
|
+
pathData = `M 0,0 L ${x1},0 L ${x1},${y1} L ${w},${y1} L ${w},${h} L 0,${h} z`
|
|
1859
|
+
}
|
|
1860
|
+
break
|
|
1861
|
+
case 'diagStripe':
|
|
1862
|
+
{
|
|
1863
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1864
|
+
let sAdj1_val = 50000 * RATIO_EMUs_Points
|
|
1865
|
+
const cnsVal = 100000 * RATIO_EMUs_Points
|
|
1866
|
+
if (shapAdjst) {
|
|
1867
|
+
sAdj1_val = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1868
|
+
}
|
|
1869
|
+
const a1 = (sAdj1_val < 0) ? 0 : (sAdj1_val > cnsVal) ? cnsVal : sAdj1_val
|
|
1870
|
+
const x2 = w * a1 / cnsVal
|
|
1871
|
+
const y2 = h * a1 / cnsVal
|
|
1872
|
+
pathData = `M 0,${y2} L ${x2},0 L ${w},0 L 0,${h} z`
|
|
1873
|
+
}
|
|
1874
|
+
break
|
|
1875
|
+
case 'gear6':
|
|
1876
|
+
case 'gear9':
|
|
1877
|
+
pathData = shapeGear(w, h / 3.5, parseInt(shapType.substring(4)))
|
|
1878
|
+
break
|
|
1879
|
+
case 'bentConnector3':
|
|
1880
|
+
{
|
|
1881
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1882
|
+
let shapAdjst_val = 0.5
|
|
1883
|
+
if (shapAdjst) {
|
|
1884
|
+
shapAdjst_val = parseInt(shapAdjst.substring(4)) / 100000
|
|
1885
|
+
}
|
|
1886
|
+
pathData = `M 0 0 L ${shapAdjst_val * w} 0 L ${shapAdjst_val * w} ${h} L ${w} ${h}`
|
|
1887
|
+
}
|
|
1888
|
+
break
|
|
1889
|
+
case 'plus':
|
|
1890
|
+
{
|
|
1891
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1892
|
+
let adj1 = 0.25
|
|
1893
|
+
if (shapAdjst) {
|
|
1894
|
+
adj1 = parseInt(shapAdjst.substring(4)) / 100000
|
|
1895
|
+
}
|
|
1896
|
+
const adj2 = (1 - adj1)
|
|
1897
|
+
pathData = `M ${adj1 * w} 0 L ${adj1 * w} ${adj1 * h} L 0 ${adj1 * h} L 0 ${adj2 * h} L ${adj1 * w} ${adj2 * h} L ${adj1 * w} ${h} L ${adj2 * w} ${h} L ${adj2 * w} ${adj2 * h} L ${w} ${adj2 * h} L ${w} ${adj1 * h} L ${adj2 * w} ${adj1 * h} L ${adj2 * w} 0 Z`
|
|
1898
|
+
}
|
|
1899
|
+
break
|
|
1900
|
+
case 'teardrop':
|
|
1901
|
+
{
|
|
1902
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1903
|
+
let adj1 = 100000 * RATIO_EMUs_Points
|
|
1904
|
+
const cnsVal1 = adj1
|
|
1905
|
+
const cnsVal2 = 200000 * RATIO_EMUs_Points
|
|
1906
|
+
if (shapAdjst) {
|
|
1907
|
+
adj1 = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1908
|
+
}
|
|
1909
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnsVal2) ? cnsVal2 : adj1
|
|
1910
|
+
const r2 = Math.sqrt(2)
|
|
1911
|
+
const tw = r2 * (w / 2)
|
|
1912
|
+
const th = r2 * (h / 2)
|
|
1913
|
+
const sw = (tw * a1) / cnsVal1
|
|
1914
|
+
const sh = (th * a1) / cnsVal1
|
|
1915
|
+
const rd45 = (45 * (Math.PI) / 180)
|
|
1916
|
+
const dx1 = sw * (Math.cos(rd45))
|
|
1917
|
+
const dy1 = sh * (Math.cos(rd45))
|
|
1918
|
+
const x1 = (w / 2) + dx1
|
|
1919
|
+
const y1 = (h / 2) - dy1
|
|
1920
|
+
const x2 = ((w / 2) + x1) / 2
|
|
1921
|
+
const y2 = ((h / 2) + y1) / 2
|
|
1922
|
+
pathData = `${shapeArc(w / 2, h / 2, w / 2, h / 2, 180, 270, false)} Q ${x2},0 ${x1},${y1} Q ${w},${y2} ${w},${h / 2} ${shapeArc(w / 2, h / 2, w / 2, h / 2, 0, 90, false).replace('M', 'L')} ${shapeArc(w / 2, h / 2, w / 2, h / 2, 90, 180, false).replace('M', 'L')} z`
|
|
1923
|
+
}
|
|
1924
|
+
break
|
|
1925
|
+
case 'plaque':
|
|
1926
|
+
{
|
|
1927
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1928
|
+
let adj1 = 16667 * RATIO_EMUs_Points
|
|
1929
|
+
const cnsVal1 = 50000 * RATIO_EMUs_Points
|
|
1930
|
+
const cnsVal2 = 100000 * RATIO_EMUs_Points
|
|
1931
|
+
if (shapAdjst) {
|
|
1932
|
+
adj1 = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
1933
|
+
}
|
|
1934
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnsVal1) ? cnsVal1 : adj1
|
|
1935
|
+
const x1 = a1 * (Math.min(w, h)) / cnsVal2
|
|
1936
|
+
const x2 = w - x1
|
|
1937
|
+
const y2 = h - x1
|
|
1938
|
+
pathData = `M 0,${x1} ${shapeArc(0, 0, x1, x1, 90, 0, false).replace('M', 'L')} L ${x2},0 ${shapeArc(w, 0, x1, x1, 180, 90, false).replace('M', 'L')} L ${w},${y2} ${shapeArc(w, h, x1, x1, 270, 180, false).replace('M', 'L')} L ${x1},${h} ${shapeArc(0, h, x1, x1, 0, -90, false).replace('M', 'L')} z`
|
|
1939
|
+
}
|
|
1940
|
+
break
|
|
1941
|
+
case 'sun':
|
|
1942
|
+
{
|
|
1943
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
1944
|
+
const refr = RATIO_EMUs_Points
|
|
1945
|
+
let adj1 = 25000 * refr
|
|
1946
|
+
const cnstVal1 = 12500 * refr
|
|
1947
|
+
const cnstVal2 = 46875 * refr
|
|
1948
|
+
if (shapAdjst) {
|
|
1949
|
+
adj1 = parseInt(shapAdjst.substring(4)) * refr
|
|
1950
|
+
}
|
|
1951
|
+
const a1 = (adj1 < cnstVal1) ? cnstVal1 : (adj1 > cnstVal2) ? cnstVal2 : adj1
|
|
1952
|
+
const cnstVa3 = 50000 * refr
|
|
1953
|
+
const cnstVa4 = 100000 * refr
|
|
1954
|
+
const g0 = cnstVa3 - a1
|
|
1955
|
+
const g1 = g0 * 30274 / 32768
|
|
1956
|
+
const g2 = g0 * 12540 / 32768
|
|
1957
|
+
const g5 = cnstVa3 - g1
|
|
1958
|
+
const g6 = cnstVa3 - g2
|
|
1959
|
+
const g10 = g5 * 3 / 4
|
|
1960
|
+
const g11 = g6 * 3 / 4
|
|
1961
|
+
const g12 = g10 + 3662 * refr
|
|
1962
|
+
const g13 = g11 + 36620 * refr
|
|
1963
|
+
const g14 = g11 + 12500 * refr
|
|
1964
|
+
const g15 = cnstVa4 - g10
|
|
1965
|
+
const g16 = cnstVa4 - g12
|
|
1966
|
+
const g17 = cnstVa4 - g13
|
|
1967
|
+
const g18 = cnstVa4 - g14
|
|
1968
|
+
const ox1 = w * 18436 / 21600
|
|
1969
|
+
const oy1 = h * 3163 / 21600
|
|
1970
|
+
const ox2 = w * 3163 / 21600
|
|
1971
|
+
const oy2 = h * 18436 / 21600
|
|
1972
|
+
const x10 = w * g10 / cnstVa4
|
|
1973
|
+
const x12 = w * g12 / cnstVa4
|
|
1974
|
+
const x13 = w * g13 / cnstVa4
|
|
1975
|
+
const x14 = w * g14 / cnstVa4
|
|
1976
|
+
const x15 = w * g15 / cnstVa4
|
|
1977
|
+
const x16 = w * g16 / cnstVa4
|
|
1978
|
+
const x17 = w * g17 / cnstVa4
|
|
1979
|
+
const x18 = w * g18 / cnstVa4
|
|
1980
|
+
const x19 = w * a1 / cnstVa4
|
|
1981
|
+
const wR = w * g0 / cnstVa4
|
|
1982
|
+
const hR = h * g0 / cnstVa4
|
|
1983
|
+
const y10 = h * g10 / cnstVa4
|
|
1984
|
+
const y12 = h * g12 / cnstVa4
|
|
1985
|
+
const y13 = h * g13 / cnstVa4
|
|
1986
|
+
const y14 = h * g14 / cnstVa4
|
|
1987
|
+
const y15 = h * g15 / cnstVa4
|
|
1988
|
+
const y16 = h * g16 / cnstVa4
|
|
1989
|
+
const y17 = h * g17 / cnstVa4
|
|
1990
|
+
const y18 = h * g18 / cnstVa4
|
|
1991
|
+
pathData = `M ${w},${h / 2} L ${x15},${y18} L ${x15},${y14} z M ${ox1},${oy1} L ${x16},${y17} L ${x13},${y12} z M ${w / 2},0 L ${x18},${y10} L ${x14},${y10} z M ${ox2},${oy1} L ${x17},${y12} L ${x12},${y17} z M 0,${h / 2} L ${x10},${y14} L ${x10},${y18} z M ${ox2},${oy2} L ${x12},${y13} L ${x17},${y16} z M ${w / 2},${h} L ${x14},${y15} L ${x18},${y15} z M ${ox1},${oy2} L ${x13},${y16} L ${x16},${y13} z M ${x19},${h / 2} ${shapeArc(w / 2, h / 2, wR, hR, 180, 540, false).replace('M', 'L')} z`
|
|
1992
|
+
}
|
|
1993
|
+
break
|
|
1994
|
+
case 'heart':
|
|
1995
|
+
{
|
|
1996
|
+
const dx1 = w * 49 / 48
|
|
1997
|
+
const dx2 = w * 10 / 48
|
|
1998
|
+
const x1 = w / 2 - dx1
|
|
1999
|
+
const x2 = w / 2 - dx2
|
|
2000
|
+
const x3 = w / 2 + dx2
|
|
2001
|
+
const x4 = w / 2 + dx1
|
|
2002
|
+
const y1 = -h / 3
|
|
2003
|
+
pathData = `M ${w / 2},${h / 4} C ${x3},${y1} ${x4},${h / 4} ${w / 2},${h} C ${x1},${h / 4} ${x2},${y1} ${w / 2},${h / 4} z`
|
|
2004
|
+
}
|
|
2005
|
+
break
|
|
2006
|
+
case 'lightningBolt':
|
|
2007
|
+
{
|
|
2008
|
+
const x1 = w * 5022 / 21600,
|
|
2009
|
+
x2 = w * 11050 / 21600,
|
|
2010
|
+
x3 = w * 8472 / 21600,
|
|
2011
|
+
x5 = w * 10012 / 21600,
|
|
2012
|
+
x6 = w * 14767 / 21600,
|
|
2013
|
+
x7 = w * 12222 / 21600,
|
|
2014
|
+
x8 = w * 12860 / 21600,
|
|
2015
|
+
x10 = w * 7602 / 21600,
|
|
2016
|
+
x11 = w * 16577 / 21600,
|
|
2017
|
+
y1 = h * 3890 / 21600,
|
|
2018
|
+
y2 = h * 6080 / 21600,
|
|
2019
|
+
y3 = h * 6797 / 21600,
|
|
2020
|
+
y5 = h * 12877 / 21600,
|
|
2021
|
+
y6 = h * 9705 / 21600,
|
|
2022
|
+
y7 = h * 12007 / 21600,
|
|
2023
|
+
y8 = h * 13987 / 21600,
|
|
2024
|
+
y9 = h * 8382 / 21600,
|
|
2025
|
+
y11 = h * 14915 / 21600
|
|
2026
|
+
pathData = `M ${x3},0 L ${x8},${y2} L ${x2},${y3} L ${x11},${y7} L ${x6},${y5} L ${w},${h} L ${x5},${y11} L ${x7},${y8} L ${x1},${y6} L ${x10},${y9} L 0,${y1} z`
|
|
2027
|
+
}
|
|
2028
|
+
break
|
|
2029
|
+
case 'cube':
|
|
2030
|
+
{
|
|
2031
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
2032
|
+
const refr = RATIO_EMUs_Points
|
|
2033
|
+
let adj = 25000 * refr
|
|
2034
|
+
if (shapAdjst) {
|
|
2035
|
+
adj = parseInt(shapAdjst.substring(4)) * refr
|
|
2036
|
+
}
|
|
2037
|
+
const cnstVal2 = 100000 * refr
|
|
2038
|
+
const ss = Math.min(w, h)
|
|
2039
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal2) ? cnstVal2 : adj
|
|
2040
|
+
const y1 = ss * a / cnstVal2
|
|
2041
|
+
const y4 = h - y1
|
|
2042
|
+
const x4 = w - y1
|
|
2043
|
+
pathData = `M 0,${y1} L ${y1},0 L ${w},0 L ${w},${y4} L ${x4},${h} L 0,${h} z M 0,${y1} L ${x4},${y1} M ${x4},${y1} L ${w},0 M ${x4},${y1} L ${x4},${h}`
|
|
2044
|
+
}
|
|
2045
|
+
break
|
|
2046
|
+
case 'bevel':
|
|
2047
|
+
{
|
|
2048
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
2049
|
+
const refr = RATIO_EMUs_Points
|
|
2050
|
+
let adj = 12500 * refr
|
|
2051
|
+
if (shapAdjst) {
|
|
2052
|
+
adj = parseInt(shapAdjst.substring(4)) * refr
|
|
2053
|
+
}
|
|
2054
|
+
const cnstVal1 = 50000 * refr
|
|
2055
|
+
const cnstVal2 = 100000 * refr
|
|
2056
|
+
const ss = Math.min(w, h)
|
|
2057
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
2058
|
+
const x1 = ss * a / cnstVal2
|
|
2059
|
+
const x2 = w - x1
|
|
2060
|
+
const y2 = h - x1
|
|
2061
|
+
pathData = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z M ${x1},${x1} L ${x2},${x1} L ${x2},${y2} L ${x1},${y2} z M 0,0 L ${x1},${x1} M 0,${h} L ${x1},${y2} M ${w},0 L ${x2},${x1} M ${w},${h} L ${x2},${y2}`
|
|
2062
|
+
}
|
|
2063
|
+
break
|
|
2064
|
+
case 'foldedCorner':
|
|
2065
|
+
{
|
|
2066
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
2067
|
+
const refr = RATIO_EMUs_Points
|
|
2068
|
+
let adj = 16667 * refr
|
|
2069
|
+
if (shapAdjst) {
|
|
2070
|
+
adj = parseInt(shapAdjst.substring(4)) * refr
|
|
2071
|
+
}
|
|
2072
|
+
const cnstVal1 = 50000 * refr
|
|
2073
|
+
const cnstVal2 = 100000 * refr
|
|
2074
|
+
const ss = Math.min(w, h)
|
|
2075
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
2076
|
+
const dy2 = ss * a / cnstVal2
|
|
2077
|
+
const dy1 = dy2 / 5
|
|
2078
|
+
const x1 = w - dy2
|
|
2079
|
+
const x2 = x1 + dy1
|
|
2080
|
+
const y2 = h - dy2
|
|
2081
|
+
const y1 = y2 + dy1
|
|
2082
|
+
pathData = `M ${x1},${h} L ${x2},${y1} L ${w},${y2} L ${x1},${h} L 0,${h} L 0,0 L ${w},0 L ${w},${y2}`
|
|
2083
|
+
}
|
|
2084
|
+
break
|
|
2085
|
+
case 'cloud':
|
|
2086
|
+
case 'cloudCallout':
|
|
2087
|
+
{
|
|
2088
|
+
const x0 = w * 3900 / 43200
|
|
2089
|
+
const y0 = h * 14370 / 43200
|
|
2090
|
+
const rX1 = w * 6753 / 43200,
|
|
2091
|
+
rY1 = h * 9190 / 43200,
|
|
2092
|
+
rX2 = w * 5333 / 43200,
|
|
2093
|
+
rY2 = h * 7267 / 43200,
|
|
2094
|
+
rX3 = w * 4365 / 43200,
|
|
2095
|
+
rY3 = h * 5945 / 43200,
|
|
2096
|
+
rX4 = w * 4857 / 43200,
|
|
2097
|
+
rY4 = h * 6595 / 43200,
|
|
2098
|
+
rY5 = h * 7273 / 43200,
|
|
2099
|
+
rX6 = w * 6775 / 43200,
|
|
2100
|
+
rY6 = h * 9220 / 43200,
|
|
2101
|
+
rX7 = w * 5785 / 43200,
|
|
2102
|
+
rY7 = h * 7867 / 43200,
|
|
2103
|
+
rX8 = w * 6752 / 43200,
|
|
2104
|
+
rY8 = h * 9215 / 43200,
|
|
2105
|
+
rX9 = w * 7720 / 43200,
|
|
2106
|
+
rY9 = h * 10543 / 43200,
|
|
2107
|
+
rX10 = w * 4360 / 43200,
|
|
2108
|
+
rY10 = h * 5918 / 43200,
|
|
2109
|
+
rX11 = w * 4345 / 43200
|
|
2110
|
+
const sA1 = -11429249 / 60000,
|
|
2111
|
+
wA1 = 7426832 / 60000,
|
|
2112
|
+
sA2 = -8646143 / 60000,
|
|
2113
|
+
wA2 = 5396714 / 60000,
|
|
2114
|
+
sA3 = -8748475 / 60000,
|
|
2115
|
+
wA3 = 5983381 / 60000,
|
|
2116
|
+
sA4 = -7859164 / 60000,
|
|
2117
|
+
wA4 = 7034504 / 60000,
|
|
2118
|
+
sA5 = -4722533 / 60000,
|
|
2119
|
+
wA5 = 6541615 / 60000,
|
|
2120
|
+
sA6 = -2776035 / 60000,
|
|
2121
|
+
wA6 = 7816140 / 60000,
|
|
2122
|
+
sA7 = 37501 / 60000,
|
|
2123
|
+
wA7 = 6842000 / 60000,
|
|
2124
|
+
sA8 = 1347096 / 60000,
|
|
2125
|
+
wA8 = 6910353 / 60000,
|
|
2126
|
+
sA9 = 3974558 / 60000,
|
|
2127
|
+
wA9 = 4542661 / 60000,
|
|
2128
|
+
sA10 = -16496525 / 60000,
|
|
2129
|
+
wA10 = 8804134 / 60000,
|
|
2130
|
+
sA11 = -14809710 / 60000,
|
|
2131
|
+
wA11 = 9151131 / 60000
|
|
2132
|
+
|
|
2133
|
+
const getArc = (startX, startY, rX, rY, sA, wA) => {
|
|
2134
|
+
const cX = startX - rX * Math.cos(sA * Math.PI / 180)
|
|
2135
|
+
const cY = startY - rY * Math.sin(sA * Math.PI / 180)
|
|
2136
|
+
return shapeArc(cX, cY, rX, rY, sA, sA + wA, false).replace('M', 'L')
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
let cloudPath = `M ${x0},${y0}`
|
|
2140
|
+
let lastPoint = [x0, y0]
|
|
2141
|
+
const arcs = [
|
|
2142
|
+
[rX1, rY1, sA1, wA1],
|
|
2143
|
+
[rX2, rY2, sA2, wA2],
|
|
2144
|
+
[rX3, rY3, sA3, wA3],
|
|
2145
|
+
[rX4, rY4, sA4, wA4],
|
|
2146
|
+
[rX2, rY5, sA5, wA5],
|
|
2147
|
+
[rX6, rY6, sA6, wA6],
|
|
2148
|
+
[rX7, rY7, sA7, wA7],
|
|
2149
|
+
[rX8, rY8, sA8, wA8],
|
|
2150
|
+
[rX9, rY9, sA9, wA9],
|
|
2151
|
+
[rX10, rY10, sA10, wA10],
|
|
2152
|
+
[rX11, rY3, sA11, wA11]
|
|
2153
|
+
]
|
|
2154
|
+
|
|
2155
|
+
for (const arcParams of arcs) {
|
|
2156
|
+
const arcPath = getArc(lastPoint[0], lastPoint[1], ...arcParams)
|
|
2157
|
+
cloudPath += arcPath
|
|
2158
|
+
const lastL = arcPath.lastIndexOf('L')
|
|
2159
|
+
const coords = arcPath.substring(lastL + 1).split(' ')
|
|
2160
|
+
lastPoint = [parseFloat(coords[0]), parseFloat(coords[1])]
|
|
2161
|
+
}
|
|
2162
|
+
cloudPath += ' z'
|
|
2163
|
+
|
|
2164
|
+
if (shapType === 'cloudCallout') {
|
|
2165
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2166
|
+
const refr = RATIO_EMUs_Points
|
|
2167
|
+
let adj1 = -20833 * refr
|
|
2168
|
+
let adj2 = 62500 * refr
|
|
2169
|
+
if (shapAdjst_ary) {
|
|
2170
|
+
for (const adj of shapAdjst_ary) {
|
|
2171
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2172
|
+
if (sAdj_name === 'adj1') {
|
|
2173
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2174
|
+
}
|
|
2175
|
+
else if (sAdj_name === 'adj2') {
|
|
2176
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
const cnstVal2 = 100000 * refr
|
|
2181
|
+
const ss = Math.min(w, h)
|
|
2182
|
+
const wd2 = w / 2,
|
|
2183
|
+
hd2 = h / 2
|
|
2184
|
+
const dxPos = w * adj1 / cnstVal2
|
|
2185
|
+
const dyPos = h * adj2 / cnstVal2
|
|
2186
|
+
const xPos = wd2 + dxPos
|
|
2187
|
+
const yPos = hd2 + dyPos
|
|
2188
|
+
const ht = hd2 * Math.cos(Math.atan(dyPos / dxPos))
|
|
2189
|
+
const wt = wd2 * Math.sin(Math.atan(dyPos / dxPos))
|
|
2190
|
+
const g2 = wd2 * Math.cos(Math.atan(wt / ht))
|
|
2191
|
+
const g3 = hd2 * Math.sin(Math.atan(wt / ht))
|
|
2192
|
+
const g4 = (adj1 >= 0) ? wd2 + g2 : wd2 - g2
|
|
2193
|
+
const g5 = (adj1 >= 0) ? hd2 + g3 : hd2 - g3
|
|
2194
|
+
const g6 = g4 - xPos
|
|
2195
|
+
const g7 = g5 - yPos
|
|
2196
|
+
const g8 = Math.sqrt(g6 * g6 + g7 * g7)
|
|
2197
|
+
const g9 = ss * 6600 / 21600
|
|
2198
|
+
const g10 = g8 - g9
|
|
2199
|
+
const g11 = g10 / 3
|
|
2200
|
+
const g12 = ss * 1800 / 21600
|
|
2201
|
+
const g13 = g11 + g12
|
|
2202
|
+
const g16 = (g13 * g6 / g8) + xPos
|
|
2203
|
+
const g17 = (g13 * g7 / g8) + yPos
|
|
2204
|
+
const g18 = ss * 4800 / 21600
|
|
2205
|
+
const g20 = g18 + (g11 * 2)
|
|
2206
|
+
const g23 = (g20 * g6 / g8) + xPos
|
|
2207
|
+
const g24 = (g20 * g7 / g8) + yPos
|
|
2208
|
+
const g25 = ss * 1200 / 21600
|
|
2209
|
+
const g26 = ss * 600 / 21600
|
|
2210
|
+
const x23 = xPos + g26
|
|
2211
|
+
const x24 = g16 + g25
|
|
2212
|
+
const x25 = g23 + g12
|
|
2213
|
+
const calloutPath = `${shapeArc(x23 - g26, yPos, g26, g26, 0, 360, true)} M ${x24},${g17} ${shapeArc(x24 - g25, g17, g25, g25, 0, 360, true).replace('M', 'L')} M ${x25},${g24} ${shapeArc(x25 - g12, g24, g12, g12, 0, 360, true).replace('M', 'L')}`
|
|
2214
|
+
cloudPath += calloutPath
|
|
2215
|
+
}
|
|
2216
|
+
pathData = cloudPath
|
|
2217
|
+
}
|
|
2218
|
+
break
|
|
2219
|
+
case 'smileyFace':
|
|
2220
|
+
{
|
|
2221
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
2222
|
+
const refr = RATIO_EMUs_Points
|
|
2223
|
+
let adj = 4653 * refr
|
|
2224
|
+
if (shapAdjst) {
|
|
2225
|
+
adj = parseInt(shapAdjst.substring(4)) * refr
|
|
2226
|
+
}
|
|
2227
|
+
const cnstVal1 = 50000 * refr
|
|
2228
|
+
const cnstVal2 = 100000 * refr
|
|
2229
|
+
const cnstVal3 = 4653 * refr
|
|
2230
|
+
const wd2 = w / 2,
|
|
2231
|
+
hd2 = h / 2
|
|
2232
|
+
const a = (adj < -cnstVal3) ? -cnstVal3 : (adj > cnstVal3) ? cnstVal3 : adj
|
|
2233
|
+
const x2 = w * 6215 / 21600
|
|
2234
|
+
const x3 = w * 13135 / 21600
|
|
2235
|
+
const x4 = w * 16640 / 21600
|
|
2236
|
+
const y1 = h * 7570 / 21600
|
|
2237
|
+
const y3 = h * 16515 / 21600
|
|
2238
|
+
const dy2 = h * a / cnstVal2
|
|
2239
|
+
const y2 = y3 - dy2
|
|
2240
|
+
const y4 = y3 + dy2
|
|
2241
|
+
const dy3 = h * a / cnstVal1
|
|
2242
|
+
const y5 = y4 + dy3
|
|
2243
|
+
const wR = w * 1125 / 21600
|
|
2244
|
+
const hR = h * 1125 / 21600
|
|
2245
|
+
const cX1 = x2
|
|
2246
|
+
const cY1 = y1
|
|
2247
|
+
const cX2 = x3
|
|
2248
|
+
const x1_mouth = w * 4969 / 21699
|
|
2249
|
+
pathData = `${shapeArc(cX1, cY1, wR, hR, 0, 360, true)} ${shapeArc(cX2, cY1, wR, hR, 0, 360, true)} M ${x1_mouth},${y2} Q ${wd2},${y5} ${x4},${y2} Q ${wd2},${y5} ${x1_mouth},${y2} M 0,${hd2} ${shapeArc(wd2, hd2, wd2, hd2, 180, 540, false).replace('M', 'L')} z`
|
|
2250
|
+
}
|
|
2251
|
+
break
|
|
2252
|
+
case 'verticalScroll':
|
|
2253
|
+
case 'horizontalScroll':
|
|
2254
|
+
{
|
|
2255
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
2256
|
+
const refr = RATIO_EMUs_Points
|
|
2257
|
+
let adj = 12500 * refr
|
|
2258
|
+
if (shapAdjst) {
|
|
2259
|
+
adj = parseInt(shapAdjst.substring(4)) * refr
|
|
2260
|
+
}
|
|
2261
|
+
const cnstVal1 = 25000 * refr
|
|
2262
|
+
const cnstVal2 = 100000 * refr
|
|
2263
|
+
const ss = Math.min(w, h)
|
|
2264
|
+
const t = 0,
|
|
2265
|
+
l = 0,
|
|
2266
|
+
b = h,
|
|
2267
|
+
r = w
|
|
2268
|
+
const a = (adj < 0) ? 0 : (adj > cnstVal1) ? cnstVal1 : adj
|
|
2269
|
+
const ch = ss * a / cnstVal2
|
|
2270
|
+
const ch2 = ch / 2
|
|
2271
|
+
const ch4 = ch / 4
|
|
2272
|
+
if (shapType === 'verticalScroll') {
|
|
2273
|
+
const x3 = ch + ch2
|
|
2274
|
+
const x4 = ch + ch
|
|
2275
|
+
const x6 = r - ch
|
|
2276
|
+
const x7 = r - ch2
|
|
2277
|
+
const x5 = x6 - ch2
|
|
2278
|
+
const y3 = b - ch
|
|
2279
|
+
const y4 = b - ch2
|
|
2280
|
+
pathData = `M ${ch},${y3} L ${ch},${ch2} ${shapeArc(x3, ch2, ch2, ch2, 180, 270, false).replace('M', 'L')} L ${x7},${t} ${shapeArc(x7, ch2, ch2, ch2, 270, 450, false).replace('M', 'L')} L ${x6},${ch} L ${x6},${y4} ${shapeArc(x5, y4, ch2, ch2, 0, 90, false).replace('M', 'L')} L ${ch2},${b} ${shapeArc(ch2, y4, ch2, ch2, 90, 270, false).replace('M', 'L')} z M ${x3},${t} ${shapeArc(x3, ch2, ch2, ch2, 270, 450, false).replace('M', 'L')} ${shapeArc(x3, x3 / 2, ch4, ch4, 90, 270, false).replace('M', 'L')} L ${x4},${ch2} M ${x6},${ch} L ${x3},${ch} M ${ch},${y4} ${shapeArc(ch2, y4, ch2, ch2, 0, 270, false).replace('M', 'L')} ${shapeArc(ch2, (y4 + y3) / 2, ch4, ch4, 270, 450, false).replace('M', 'L')} z M ${ch},${y4} L ${ch},${y3}`
|
|
2281
|
+
}
|
|
2282
|
+
else if (shapType === 'horizontalScroll') {
|
|
2283
|
+
const y3 = ch + ch2
|
|
2284
|
+
const y4 = ch + ch
|
|
2285
|
+
const y6 = b - ch
|
|
2286
|
+
const y7 = b - ch2
|
|
2287
|
+
const y5 = y6 - ch2
|
|
2288
|
+
const x3 = r - ch
|
|
2289
|
+
const x4 = r - ch2
|
|
2290
|
+
pathData = `M ${l},${y3} ${shapeArc(ch2, y3, ch2, ch2, 180, 270, false).replace('M', 'L')} L ${x3},${ch} L ${x3},${ch2} ${shapeArc(x4, ch2, ch2, ch2, 180, 360, false).replace('M', 'L')} L ${r},${y5} ${shapeArc(x4, y5, ch2, ch2, 0, 90, false).replace('M', 'L')} L ${ch},${y6} L ${ch},${y7} ${shapeArc(ch2, y7, ch2, ch2, 0, 180, false).replace('M', 'L')} z M ${x4},${ch} ${shapeArc(x4, ch2, ch2, ch2, 90, -180, false).replace('M', 'L')} ${shapeArc((x3 + x4) / 2, ch2, ch4, ch4, 180, 0, false).replace('M', 'L')} z M ${x4},${ch} L ${x3},${ch} M ${ch2},${y4} L ${ch2},${y3} ${shapeArc(y3 / 2, y3, ch4, ch4, 180, 360, false).replace('M', 'L')} ${shapeArc(ch2, y3, ch2, ch2, 0, 180, false).replace('M', 'L')} M ${ch},${y3} L ${ch},${y6}`
|
|
2291
|
+
}
|
|
2292
|
+
}
|
|
2293
|
+
break
|
|
2294
|
+
case 'wedgeEllipseCallout':
|
|
2295
|
+
{
|
|
2296
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2297
|
+
const refr = RATIO_EMUs_Points
|
|
2298
|
+
let adj1 = -20833 * refr
|
|
2299
|
+
let adj2 = 62500 * refr
|
|
2300
|
+
if (shapAdjst_ary) {
|
|
2301
|
+
for (const adj of shapAdjst_ary) {
|
|
2302
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2303
|
+
if (sAdj_name === 'adj1') {
|
|
2304
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2305
|
+
}
|
|
2306
|
+
else if (sAdj_name === 'adj2') {
|
|
2307
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2311
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
2312
|
+
const angVal1 = 11 * Math.PI / 180
|
|
2313
|
+
const vc = h / 2,
|
|
2314
|
+
hc = w / 2
|
|
2315
|
+
const dxPos = w * adj1 / cnstVal1
|
|
2316
|
+
const dyPos = h * adj2 / cnstVal1
|
|
2317
|
+
const xPos = hc + dxPos
|
|
2318
|
+
const yPos = vc + dyPos
|
|
2319
|
+
const pang = Math.atan2(dyPos * w, dxPos * h)
|
|
2320
|
+
const stAng = pang + angVal1
|
|
2321
|
+
const enAng = pang - angVal1
|
|
2322
|
+
const dx1 = hc * Math.cos(stAng)
|
|
2323
|
+
const dy1 = vc * Math.sin(stAng)
|
|
2324
|
+
const dx2 = hc * Math.cos(enAng)
|
|
2325
|
+
const dy2 = vc * Math.sin(enAng)
|
|
2326
|
+
const x1 = hc + dx1
|
|
2327
|
+
const y1 = vc + dy1
|
|
2328
|
+
const x2 = hc + dx2
|
|
2329
|
+
const y2 = vc + dy2
|
|
2330
|
+
pathData = `M ${x1},${y1} L ${xPos},${yPos} L ${x2},${y2} ${shapeArc(hc, vc, hc, vc, enAng * 180 / Math.PI, stAng * 180 / Math.PI, true).replace('M', 'L')}`
|
|
2331
|
+
}
|
|
2332
|
+
break
|
|
2333
|
+
case 'wedgeRectCallout':
|
|
2334
|
+
{
|
|
2335
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2336
|
+
const refr = RATIO_EMUs_Points
|
|
2337
|
+
let adj1 = -20833 * refr
|
|
2338
|
+
let adj2 = 62500 * refr
|
|
2339
|
+
if (shapAdjst_ary) {
|
|
2340
|
+
for (const adj of shapAdjst_ary) {
|
|
2341
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2342
|
+
if (sAdj_name === 'adj1') {
|
|
2343
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2344
|
+
}
|
|
2345
|
+
else if (sAdj_name === 'adj2') {
|
|
2346
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
2351
|
+
const vc = h / 2,
|
|
2352
|
+
hc = w / 2
|
|
2353
|
+
const dxPos = w * adj1 / cnstVal1
|
|
2354
|
+
const dyPos = h * adj2 / cnstVal1
|
|
2355
|
+
const xPos = hc + dxPos
|
|
2356
|
+
const yPos = vc + dyPos
|
|
2357
|
+
const dq = dxPos * h / w
|
|
2358
|
+
const dz = Math.abs(dyPos) - Math.abs(dq)
|
|
2359
|
+
const xg1 = (dxPos > 0) ? 7 : 2
|
|
2360
|
+
const xg2 = (dxPos > 0) ? 10 : 5
|
|
2361
|
+
const x1 = w * xg1 / 12
|
|
2362
|
+
const x2 = w * xg2 / 12
|
|
2363
|
+
const yg1 = (dyPos > 0) ? 7 : 2
|
|
2364
|
+
const yg2 = (dyPos > 0) ? 10 : 5
|
|
2365
|
+
const y1 = h * yg1 / 12
|
|
2366
|
+
const y2 = h * yg2 / 12
|
|
2367
|
+
const xl = (dz > 0) ? 0 : ((dxPos > 0) ? 0 : xPos)
|
|
2368
|
+
const xt = (dz > 0) ? ((dyPos > 0) ? x1 : xPos) : x1
|
|
2369
|
+
const xr = (dz > 0) ? w : ((dxPos > 0) ? xPos : w)
|
|
2370
|
+
const xb = (dz > 0) ? ((dyPos > 0) ? xPos : x1) : x1
|
|
2371
|
+
const yl = (dz > 0) ? y1 : ((dxPos > 0) ? y1 : yPos)
|
|
2372
|
+
const yt = (dz > 0) ? ((dyPos > 0) ? 0 : yPos) : 0
|
|
2373
|
+
const yr = (dz > 0) ? y1 : ((dxPos > 0) ? yPos : y1)
|
|
2374
|
+
const yb = (dz > 0) ? ((dyPos > 0) ? yPos : h) : h
|
|
2375
|
+
pathData = `M 0,0 L ${x1},0 L ${xt},${yt} L ${x2},0 L ${w},0 L ${w},${y1} L ${xr},${yr} L ${w},${y2} L ${w},${h} L ${x2},${h} L ${xb},${yb} L ${x1},${h} L 0,${h} L 0,${y2} L ${xl},${yl} L 0,${y1} z`
|
|
2376
|
+
}
|
|
2377
|
+
break
|
|
2378
|
+
case 'wedgeRoundRectCallout':
|
|
2379
|
+
{
|
|
2380
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2381
|
+
const refr = RATIO_EMUs_Points
|
|
2382
|
+
let adj1 = -20833 * refr
|
|
2383
|
+
let adj2 = 62500 * refr
|
|
2384
|
+
let adj3 = 16667 * refr
|
|
2385
|
+
if (shapAdjst_ary) {
|
|
2386
|
+
for (const adj of shapAdjst_ary) {
|
|
2387
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2388
|
+
if (sAdj_name === 'adj1') {
|
|
2389
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2390
|
+
}
|
|
2391
|
+
else if (sAdj_name === 'adj2') {
|
|
2392
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2393
|
+
}
|
|
2394
|
+
else if (sAdj_name === 'adj3') {
|
|
2395
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
2400
|
+
const ss = Math.min(w, h)
|
|
2401
|
+
const vc = h / 2,
|
|
2402
|
+
hc = w / 2
|
|
2403
|
+
const dxPos = w * adj1 / cnstVal1
|
|
2404
|
+
const dyPos = h * adj2 / cnstVal1
|
|
2405
|
+
const xPos = hc + dxPos
|
|
2406
|
+
const yPos = vc + dyPos
|
|
2407
|
+
const dq = dxPos * h / w
|
|
2408
|
+
const dz = Math.abs(dyPos) - Math.abs(dq)
|
|
2409
|
+
const xg1 = (dxPos > 0) ? 7 : 2
|
|
2410
|
+
const xg2 = (dxPos > 0) ? 10 : 5
|
|
2411
|
+
const x1 = w * xg1 / 12
|
|
2412
|
+
const x2 = w * xg2 / 12
|
|
2413
|
+
const yg1 = (dyPos > 0) ? 7 : 2
|
|
2414
|
+
const yg2 = (dyPos > 0) ? 10 : 5
|
|
2415
|
+
const y1 = h * yg1 / 12
|
|
2416
|
+
const y2 = h * yg2 / 12
|
|
2417
|
+
const xl = (dz > 0) ? 0 : ((dxPos > 0) ? 0 : xPos)
|
|
2418
|
+
const xt = (dz > 0) ? ((dyPos > 0) ? x1 : xPos) : x1
|
|
2419
|
+
const xr = (dz > 0) ? w : ((dxPos > 0) ? xPos : w)
|
|
2420
|
+
const xb = (dz > 0) ? ((dyPos > 0) ? xPos : x1) : x1
|
|
2421
|
+
const yl = (dz > 0) ? y1 : ((dxPos > 0) ? y1 : yPos)
|
|
2422
|
+
const yt = (dz > 0) ? ((dyPos > 0) ? 0 : yPos) : 0
|
|
2423
|
+
const yr = (dz > 0) ? y1 : ((dxPos > 0) ? yPos : y1)
|
|
2424
|
+
const yb = (dz > 0) ? ((dyPos > 0) ? yPos : h) : h
|
|
2425
|
+
const u1 = ss * adj3 / cnstVal1
|
|
2426
|
+
const u2 = w - u1
|
|
2427
|
+
const v2 = h - u1
|
|
2428
|
+
pathData = `M 0,${u1} ${shapeArc(u1, u1, u1, u1, 180, 270, false).replace('M', 'L')} L ${x1},0 L ${xt},${yt} L ${x2},0 L ${u2},0 ${shapeArc(u2, u1, u1, u1, 270, 360, false).replace('M', 'L')} L ${w},${y1} L ${xr},${yr} L ${w},${y2} L ${w},${v2} ${shapeArc(u2, v2, u1, u1, 0, 90, false).replace('M', 'L')} L ${x2},${h} L ${xb},${yb} L ${x1},${h} L ${u1},${h} ${shapeArc(u1, v2, u1, u1, 90, 180, false).replace('M', 'L')} L 0,${y2} L ${xl},${yl} L 0,${y1} z`
|
|
2429
|
+
}
|
|
2430
|
+
break
|
|
2431
|
+
case 'accentBorderCallout1':
|
|
2432
|
+
case 'accentBorderCallout2':
|
|
2433
|
+
case 'accentBorderCallout3':
|
|
2434
|
+
case 'borderCallout1':
|
|
2435
|
+
case 'borderCallout2':
|
|
2436
|
+
case 'borderCallout3':
|
|
2437
|
+
case 'accentCallout1':
|
|
2438
|
+
case 'accentCallout2':
|
|
2439
|
+
case 'accentCallout3':
|
|
2440
|
+
case 'callout1':
|
|
2441
|
+
case 'callout2':
|
|
2442
|
+
case 'callout3':
|
|
2443
|
+
{
|
|
2444
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2445
|
+
const refr = RATIO_EMUs_Points
|
|
2446
|
+
let adj1 = 18750 * refr
|
|
2447
|
+
let adj2 = -8333 * refr
|
|
2448
|
+
let adj3 = 18750 * refr
|
|
2449
|
+
let adj4 = -16667 * refr
|
|
2450
|
+
let adj5 = 100000 * refr
|
|
2451
|
+
let adj6 = -16667 * refr
|
|
2452
|
+
let adj7 = 112963 * refr
|
|
2453
|
+
let adj8 = -8333 * refr
|
|
2454
|
+
if (shapAdjst_ary) {
|
|
2455
|
+
for (const adj of shapAdjst_ary) {
|
|
2456
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2457
|
+
if (sAdj_name === 'adj1') {
|
|
2458
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2459
|
+
}
|
|
2460
|
+
else if (sAdj_name === 'adj2') {
|
|
2461
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2462
|
+
}
|
|
2463
|
+
else if (sAdj_name === 'adj3') {
|
|
2464
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2465
|
+
}
|
|
2466
|
+
else if (sAdj_name === 'adj4') {
|
|
2467
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2468
|
+
}
|
|
2469
|
+
else if (sAdj_name === 'adj5') {
|
|
2470
|
+
adj5 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2471
|
+
}
|
|
2472
|
+
else if (sAdj_name === 'adj6') {
|
|
2473
|
+
adj6 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2474
|
+
}
|
|
2475
|
+
else if (sAdj_name === 'adj7') {
|
|
2476
|
+
adj7 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2477
|
+
}
|
|
2478
|
+
else if (sAdj_name === 'adj8') {
|
|
2479
|
+
adj8 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
const cnstVal1 = 100000 * refr
|
|
2484
|
+
let x1, y1, x2, y2, x3, y3, x4, y4
|
|
2485
|
+
const baseRect = `M 0,0 L ${w},0 L ${w},${h} L 0,${h} z`
|
|
2486
|
+
switch (shapType) {
|
|
2487
|
+
case 'borderCallout1':
|
|
2488
|
+
case 'callout1':
|
|
2489
|
+
if (!shapAdjst_ary) {
|
|
2490
|
+
adj1 = 18750 * refr
|
|
2491
|
+
adj2 = -8333 * refr
|
|
2492
|
+
adj3 = 112500 * refr
|
|
2493
|
+
adj4 = -38333 * refr
|
|
2494
|
+
}
|
|
2495
|
+
y1 = h * adj1 / cnstVal1
|
|
2496
|
+
x1 = w * adj2 / cnstVal1
|
|
2497
|
+
y2 = h * adj3 / cnstVal1
|
|
2498
|
+
x2 = w * adj4 / cnstVal1
|
|
2499
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2}`
|
|
2500
|
+
break
|
|
2501
|
+
case 'borderCallout2':
|
|
2502
|
+
case 'callout2':
|
|
2503
|
+
if (!shapAdjst_ary) {
|
|
2504
|
+
adj1 = 18750 * refr
|
|
2505
|
+
adj2 = -8333 * refr
|
|
2506
|
+
adj3 = 18750 * refr
|
|
2507
|
+
adj4 = -16667 * refr
|
|
2508
|
+
adj5 = 112500 * refr
|
|
2509
|
+
adj6 = -46667 * refr
|
|
2510
|
+
}
|
|
2511
|
+
y1 = h * adj1 / cnstVal1
|
|
2512
|
+
x1 = w * adj2 / cnstVal1
|
|
2513
|
+
y2 = h * adj3 / cnstVal1
|
|
2514
|
+
x2 = w * adj4 / cnstVal1
|
|
2515
|
+
y3 = h * adj5 / cnstVal1
|
|
2516
|
+
x3 = w * adj6 / cnstVal1
|
|
2517
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2} L ${x3},${y3}`
|
|
2518
|
+
break
|
|
2519
|
+
case 'borderCallout3':
|
|
2520
|
+
case 'callout3':
|
|
2521
|
+
if (!shapAdjst_ary) {
|
|
2522
|
+
adj1 = 18750 * refr
|
|
2523
|
+
adj2 = -8333 * refr
|
|
2524
|
+
adj3 = 18750 * refr
|
|
2525
|
+
adj4 = -16667 * refr
|
|
2526
|
+
adj5 = 100000 * refr
|
|
2527
|
+
adj6 = -16667 * refr
|
|
2528
|
+
adj7 = 112963 * refr
|
|
2529
|
+
adj8 = -8333 * refr
|
|
2530
|
+
}
|
|
2531
|
+
y1 = h * adj1 / cnstVal1
|
|
2532
|
+
x1 = w * adj2 / cnstVal1
|
|
2533
|
+
y2 = h * adj3 / cnstVal1
|
|
2534
|
+
x2 = w * adj4 / cnstVal1
|
|
2535
|
+
y3 = h * adj5 / cnstVal1
|
|
2536
|
+
x3 = w * adj6 / cnstVal1
|
|
2537
|
+
y4 = h * adj7 / cnstVal1
|
|
2538
|
+
x4 = w * adj8 / cnstVal1
|
|
2539
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2} L ${x3},${y3} L ${x4},${y4}`
|
|
2540
|
+
break
|
|
2541
|
+
case 'accentBorderCallout1':
|
|
2542
|
+
case 'accentCallout1':
|
|
2543
|
+
if (!shapAdjst_ary) {
|
|
2544
|
+
adj1 = 18750 * refr
|
|
2545
|
+
adj2 = -8333 * refr
|
|
2546
|
+
adj3 = 112500 * refr
|
|
2547
|
+
adj4 = -38333 * refr
|
|
2548
|
+
}
|
|
2549
|
+
y1 = h * adj1 / cnstVal1
|
|
2550
|
+
x1 = w * adj2 / cnstVal1
|
|
2551
|
+
y2 = h * adj3 / cnstVal1
|
|
2552
|
+
x2 = w * adj4 / cnstVal1
|
|
2553
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2} M ${x1},0 L ${x1},${h}`
|
|
2554
|
+
break
|
|
2555
|
+
case 'accentBorderCallout2':
|
|
2556
|
+
case 'accentCallout2':
|
|
2557
|
+
if (!shapAdjst_ary) {
|
|
2558
|
+
adj1 = 18750 * refr
|
|
2559
|
+
adj2 = -8333 * refr
|
|
2560
|
+
adj3 = 18750 * refr
|
|
2561
|
+
adj4 = -16667 * refr
|
|
2562
|
+
adj5 = 112500 * refr
|
|
2563
|
+
adj6 = -46667 * refr
|
|
2564
|
+
}
|
|
2565
|
+
y1 = h * adj1 / cnstVal1
|
|
2566
|
+
x1 = w * adj2 / cnstVal1
|
|
2567
|
+
y2 = h * adj3 / cnstVal1
|
|
2568
|
+
x2 = w * adj4 / cnstVal1
|
|
2569
|
+
y3 = h * adj5 / cnstVal1
|
|
2570
|
+
x3 = w * adj6 / cnstVal1
|
|
2571
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2} L ${x3},${y3} M ${x1},0 L ${x1},${h}`
|
|
2572
|
+
break
|
|
2573
|
+
case 'accentBorderCallout3':
|
|
2574
|
+
case 'accentCallout3':
|
|
2575
|
+
if (!shapAdjst_ary) {
|
|
2576
|
+
adj1 = 18750 * refr
|
|
2577
|
+
adj2 = -8333 * refr
|
|
2578
|
+
adj3 = 18750 * refr
|
|
2579
|
+
adj4 = -16667 * refr
|
|
2580
|
+
adj5 = 100000 * refr
|
|
2581
|
+
adj6 = -16667 * refr
|
|
2582
|
+
adj7 = 112963 * refr
|
|
2583
|
+
adj8 = -8333 * refr
|
|
2584
|
+
}
|
|
2585
|
+
y1 = h * adj1 / cnstVal1
|
|
2586
|
+
x1 = w * adj2 / cnstVal1
|
|
2587
|
+
y2 = h * adj3 / cnstVal1
|
|
2588
|
+
x2 = w * adj4 / cnstVal1
|
|
2589
|
+
y3 = h * adj5 / cnstVal1
|
|
2590
|
+
x3 = w * adj6 / cnstVal1
|
|
2591
|
+
y4 = h * adj7 / cnstVal1
|
|
2592
|
+
x4 = w * adj8 / cnstVal1
|
|
2593
|
+
pathData = `${baseRect} M ${x1},${y1} L ${x2},${y2} L ${x3},${y3} L ${x4},${y4} M ${x1},0 L ${x1},${h}`
|
|
2594
|
+
break
|
|
2595
|
+
default:
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
break
|
|
2599
|
+
case 'leftRightRibbon':
|
|
2600
|
+
{
|
|
2601
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2602
|
+
const refr = RATIO_EMUs_Points
|
|
2603
|
+
let adj1 = 50000 * refr
|
|
2604
|
+
let adj2 = 50000 * refr
|
|
2605
|
+
let adj3 = 16667 * refr
|
|
2606
|
+
if (shapAdjst_ary) {
|
|
2607
|
+
for (const adj of shapAdjst_ary) {
|
|
2608
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2609
|
+
if (sAdj_name === 'adj1') {
|
|
2610
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2611
|
+
}
|
|
2612
|
+
else if (sAdj_name === 'adj2') {
|
|
2613
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2614
|
+
}
|
|
2615
|
+
else if (sAdj_name === 'adj3') {
|
|
2616
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
const cnstVal1 = 33333 * refr
|
|
2621
|
+
const cnstVal2 = 100000 * refr
|
|
2622
|
+
const cnstVal3 = 200000 * refr
|
|
2623
|
+
const cnstVal4 = 400000 * refr
|
|
2624
|
+
const ss = Math.min(w, h)
|
|
2625
|
+
const hc = w / 2,
|
|
2626
|
+
vc = h / 2
|
|
2627
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > cnstVal1) ? cnstVal1 : adj3
|
|
2628
|
+
const maxAdj1 = cnstVal2 - a3
|
|
2629
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
2630
|
+
const w1 = hc - (w / 32)
|
|
2631
|
+
const maxAdj2 = cnstVal2 * w1 / ss
|
|
2632
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
2633
|
+
const x1 = ss * a2 / cnstVal2
|
|
2634
|
+
const x4 = w - x1
|
|
2635
|
+
const dy1 = h * a1 / cnstVal3
|
|
2636
|
+
const dy2 = h * a3 / -cnstVal3
|
|
2637
|
+
const ly1 = vc + dy2 - dy1
|
|
2638
|
+
const ry4 = vc + dy1 - dy2
|
|
2639
|
+
const ly2 = ly1 + dy1
|
|
2640
|
+
const ry3 = h - ly2
|
|
2641
|
+
const ly4 = ly2 * 2
|
|
2642
|
+
const ry2 = h - (ly4 - ly1)
|
|
2643
|
+
const hR = a3 * ss / cnstVal4
|
|
2644
|
+
const x2 = hc - (w / 32)
|
|
2645
|
+
const x3 = hc + (w / 32)
|
|
2646
|
+
const y1 = ly1 + hR
|
|
2647
|
+
const y2_arc = ry2 - hR
|
|
2648
|
+
pathData = `M 0,${ly2} L ${x1},0 L ${x1},${ly1} L ${hc},${ly1} ${shapeArc(hc, y1, w / 32, hR, 270, 450, false).replace('M', 'L')} ${shapeArc(hc, y2_arc, w / 32, hR, 270, 90, false).replace('M', 'L')} L ${x4},${ry2} L ${x4},${h - ly4} L ${w},${ry3} L ${x4},${h} L ${x4},${ry4} L ${hc},${ry4} ${shapeArc(hc, ry4 - hR, w / 32, hR, 90, 180, false).replace('M', 'L')} L ${x2},${ly4 - ly1} L ${x1},${ly4 - ly1} L ${x1},${ly4} z M ${x3},${y1} L ${x3},${ry2} M ${x2},${y2_arc} L ${x2},${ly4 - ly1}`
|
|
2649
|
+
}
|
|
2650
|
+
break
|
|
2651
|
+
case 'ribbon':
|
|
2652
|
+
case 'ribbon2':
|
|
2653
|
+
{
|
|
2654
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2655
|
+
let adj1 = 16667 * RATIO_EMUs_Points
|
|
2656
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
2657
|
+
if (shapAdjst_ary) {
|
|
2658
|
+
for (const adj of shapAdjst_ary) {
|
|
2659
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2660
|
+
if (sAdj_name === 'adj1') {
|
|
2661
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2662
|
+
}
|
|
2663
|
+
else if (sAdj_name === 'adj2') {
|
|
2664
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
2669
|
+
const cnstVal2 = 33333 * RATIO_EMUs_Points
|
|
2670
|
+
const cnstVal3 = 75000 * RATIO_EMUs_Points
|
|
2671
|
+
const cnstVal4 = 100000 * RATIO_EMUs_Points
|
|
2672
|
+
const cnstVal5 = 200000 * RATIO_EMUs_Points
|
|
2673
|
+
const cnstVal6 = 400000 * RATIO_EMUs_Points
|
|
2674
|
+
const hc = w / 2,
|
|
2675
|
+
t = 0,
|
|
2676
|
+
l = 0,
|
|
2677
|
+
b = h,
|
|
2678
|
+
r = w,
|
|
2679
|
+
wd8 = w / 8,
|
|
2680
|
+
wd32 = w / 32
|
|
2681
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal2) ? cnstVal2 : adj1
|
|
2682
|
+
const a2 = (adj2 < cnstVal1) ? cnstVal1 : (adj2 > cnstVal3) ? cnstVal3 : adj2
|
|
2683
|
+
const x10 = r - wd8
|
|
2684
|
+
const dx2 = w * a2 / cnstVal5
|
|
2685
|
+
const x2 = hc - dx2
|
|
2686
|
+
const x9 = hc + dx2
|
|
2687
|
+
const x3 = x2 + wd32
|
|
2688
|
+
const x8 = x9 - wd32
|
|
2689
|
+
const x5 = x2 + wd8
|
|
2690
|
+
const x6 = x9 - wd8
|
|
2691
|
+
const x4 = x5 - wd32
|
|
2692
|
+
const x7 = x6 + wd32
|
|
2693
|
+
const hR = h * a1 / cnstVal6
|
|
2694
|
+
if (shapType === 'ribbon2') {
|
|
2695
|
+
const dy1 = h * a1 / cnstVal5
|
|
2696
|
+
const y1 = b - dy1
|
|
2697
|
+
const dy2 = h * a1 / cnstVal4
|
|
2698
|
+
const y2 = b - dy2
|
|
2699
|
+
const y4 = t + dy2
|
|
2700
|
+
const y3 = (y4 + b) / 2
|
|
2701
|
+
const y6 = b - hR
|
|
2702
|
+
const y7 = y1 - hR
|
|
2703
|
+
pathData = `M ${l},${b} L ${wd8},${y3} L ${l},${y4} L ${x2},${y4} L ${x2},${hR} ${shapeArc(x3, hR, wd32, hR, 180, 270, false).replace('M', 'L')} L ${x8},${t} ${shapeArc(x8, hR, wd32, hR, 270, 360, false).replace('M', 'L')} L ${x9},${y4} L ${r},${y4} L ${x10},${y3} L ${r},${b} L ${x7},${b} ${shapeArc(x7, y6, wd32, hR, 90, 270, false).replace('M', 'L')} L ${x8},${y1} ${shapeArc(x8, y7, wd32, hR, 90, -90, false).replace('M', 'L')} L ${x3},${y2} ${shapeArc(x3, y7, wd32, hR, 270, 90, false).replace('M', 'L')} L ${x4},${y1} ${shapeArc(x4, y6, wd32, hR, 270, 450, false).replace('M', 'L')} z M ${x5},${y2} L ${x5},${y6} M ${x6},${y6} L ${x6},${y2} M ${x2},${y7} L ${x2},${y4} M ${x9},${y4} L ${x9},${y7}`
|
|
2704
|
+
}
|
|
2705
|
+
else if (shapType === 'ribbon') {
|
|
2706
|
+
const y1 = h * a1 / cnstVal5
|
|
2707
|
+
const y2 = h * a1 / cnstVal4
|
|
2708
|
+
const y4 = b - y2
|
|
2709
|
+
const y3 = y4 / 2
|
|
2710
|
+
const y5 = b - hR
|
|
2711
|
+
const y6 = y2 - hR
|
|
2712
|
+
pathData = `M ${l},${t} L ${x4},${t} ${shapeArc(x4, hR, wd32, hR, 270, 450, false).replace('M', 'L')} L ${x3},${y1} ${shapeArc(x3, y6, wd32, hR, 270, 90, false).replace('M', 'L')} L ${x8},${y2} ${shapeArc(x8, y6, wd32, hR, 90, -90, false).replace('M', 'L')} L ${x7},${y1} ${shapeArc(x7, hR, wd32, hR, 90, 270, false).replace('M', 'L')} L ${r},${t} L ${x10},${y3} L ${r},${y4} L ${x9},${y4} L ${x9},${y5} ${shapeArc(x8, y5, wd32, hR, 0, 90, false).replace('M', 'L')} L ${x3},${b} ${shapeArc(x3, y5, wd32, hR, 90, 180, false).replace('M', 'L')} L ${x2},${y4} L ${l},${y4} L ${wd8},${y3} z M ${x5},${hR} L ${x5},${y2} M ${x6},${y2} L ${x6},${hR} M ${x2},${y4} L ${x2},${y6} M ${x9},${y6} L ${x9},${y4}`
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
break
|
|
2716
|
+
case 'doubleWave':
|
|
2717
|
+
case 'wave':
|
|
2718
|
+
{
|
|
2719
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2720
|
+
let adj1 = (shapType === 'doubleWave') ? 6250 * RATIO_EMUs_Points : 12500 * RATIO_EMUs_Points
|
|
2721
|
+
let adj2 = 0
|
|
2722
|
+
if (shapAdjst_ary) {
|
|
2723
|
+
for (const adj of shapAdjst_ary) {
|
|
2724
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2725
|
+
if (sAdj_name === 'adj1') {
|
|
2726
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2727
|
+
}
|
|
2728
|
+
else if (sAdj_name === 'adj2') {
|
|
2729
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2730
|
+
}
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
const cnstVal2 = -10000 * RATIO_EMUs_Points
|
|
2734
|
+
const cnstVal3 = 50000 * RATIO_EMUs_Points
|
|
2735
|
+
const cnstVal4 = 100000 * RATIO_EMUs_Points
|
|
2736
|
+
const l = 0,
|
|
2737
|
+
b = h,
|
|
2738
|
+
r = w
|
|
2739
|
+
if (shapType === 'doubleWave') {
|
|
2740
|
+
const cnstVal1 = 12500 * RATIO_EMUs_Points
|
|
2741
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
2742
|
+
const a2 = (adj2 < cnstVal2) ? cnstVal2 : (adj2 > cnstVal4) ? cnstVal4 : adj2
|
|
2743
|
+
const y1 = h * a1 / cnstVal4
|
|
2744
|
+
const dy2 = y1 * 10 / 3
|
|
2745
|
+
const y2 = y1 - dy2
|
|
2746
|
+
const y3 = y1 + dy2
|
|
2747
|
+
const y4 = b - y1
|
|
2748
|
+
const y5 = y4 - dy2
|
|
2749
|
+
const y6 = y4 + dy2
|
|
2750
|
+
const of2 = w * a2 / cnstVal3
|
|
2751
|
+
const dx2 = (of2 > 0) ? 0 : of2
|
|
2752
|
+
const x2 = l - dx2
|
|
2753
|
+
const dx8 = (of2 > 0) ? of2 : 0
|
|
2754
|
+
const x8 = r - dx8
|
|
2755
|
+
const dx3 = (dx2 + x8) / 6
|
|
2756
|
+
const x3 = x2 + dx3
|
|
2757
|
+
const dx4 = (dx2 + x8) / 3
|
|
2758
|
+
const x4 = x2 + dx4
|
|
2759
|
+
const x5 = (x2 + x8) / 2
|
|
2760
|
+
const x6 = x5 + dx3
|
|
2761
|
+
const x7 = (x6 + x8) / 2
|
|
2762
|
+
const x9 = l + dx8
|
|
2763
|
+
const x15 = r + dx2
|
|
2764
|
+
const x10 = x9 + dx3
|
|
2765
|
+
const x11 = x9 + dx4
|
|
2766
|
+
const x12 = (x9 + x15) / 2
|
|
2767
|
+
const x13 = x12 + dx3
|
|
2768
|
+
const x14 = (x13 + x15) / 2
|
|
2769
|
+
pathData = `M ${x2},${y1} C ${x3},${y2} ${x4},${y3} ${x5},${y1} C ${x6},${y2} ${x7},${y3} ${x8},${y1} L ${x15},${y4} C ${x14},${y6} ${x13},${y5} ${x12},${y4} C ${x11},${y6} ${x10},${y5} ${x9},${y4} z`
|
|
2770
|
+
}
|
|
2771
|
+
else if (shapType === 'wave') {
|
|
2772
|
+
const cnstVal5 = 20000 * RATIO_EMUs_Points
|
|
2773
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal5) ? cnstVal5 : adj1
|
|
2774
|
+
const a2 = (adj2 < cnstVal2) ? cnstVal2 : (adj2 > cnstVal4) ? cnstVal4 : adj2
|
|
2775
|
+
const y1 = h * a1 / cnstVal4
|
|
2776
|
+
const dy2 = y1 * 10 / 3
|
|
2777
|
+
const y2 = y1 - dy2
|
|
2778
|
+
const y3 = y1 + dy2
|
|
2779
|
+
const y4 = b - y1
|
|
2780
|
+
const y5 = y4 - dy2
|
|
2781
|
+
const y6 = y4 + dy2
|
|
2782
|
+
const of2 = w * a2 / cnstVal3
|
|
2783
|
+
const dx2 = (of2 > 0) ? 0 : of2
|
|
2784
|
+
const x2 = l - dx2
|
|
2785
|
+
const dx5 = (of2 > 0) ? of2 : 0
|
|
2786
|
+
const x5 = r - dx5
|
|
2787
|
+
const dx3 = (dx2 + x5) / 3
|
|
2788
|
+
const x3 = x2 + dx3
|
|
2789
|
+
const x4 = (x3 + x5) / 2
|
|
2790
|
+
const x6 = l + dx5
|
|
2791
|
+
const x10 = r + dx2
|
|
2792
|
+
const x7 = x6 + dx3
|
|
2793
|
+
const x8 = (x7 + x10) / 2
|
|
2794
|
+
pathData = `M ${x2},${y1} C ${x3},${y2} ${x4},${y3} ${x5},${y1} L ${x10},${y4} C ${x8},${y6} ${x7},${y5} ${x6},${y4} z`
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
break
|
|
2798
|
+
case 'ellipseRibbon':
|
|
2799
|
+
case 'ellipseRibbon2':
|
|
2800
|
+
{
|
|
2801
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2802
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
2803
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
2804
|
+
let adj3 = 12500 * RATIO_EMUs_Points
|
|
2805
|
+
if (shapAdjst_ary) {
|
|
2806
|
+
for (const adj of shapAdjst_ary) {
|
|
2807
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2808
|
+
if (sAdj_name === 'adj1') {
|
|
2809
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2810
|
+
}
|
|
2811
|
+
else if (sAdj_name === 'adj2') {
|
|
2812
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2813
|
+
}
|
|
2814
|
+
else if (sAdj_name === 'adj3') {
|
|
2815
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
2820
|
+
const cnstVal3 = 75000 * RATIO_EMUs_Points
|
|
2821
|
+
const cnstVal4 = 100000 * RATIO_EMUs_Points
|
|
2822
|
+
const cnstVal5 = 200000 * RATIO_EMUs_Points
|
|
2823
|
+
const hc = w / 2,
|
|
2824
|
+
t = 0,
|
|
2825
|
+
l = 0,
|
|
2826
|
+
b = h,
|
|
2827
|
+
r = w,
|
|
2828
|
+
wd8 = w / 8
|
|
2829
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal4) ? cnstVal4 : adj1
|
|
2830
|
+
const a2 = (adj2 < cnstVal1) ? cnstVal1 : (adj2 > cnstVal3) ? cnstVal3 : adj2
|
|
2831
|
+
const q10 = cnstVal4 - a1
|
|
2832
|
+
const minAdj3 = (a1 - (q10 / 2) > 0) ? a1 - (q10 / 2) : 0
|
|
2833
|
+
const a3 = (adj3 < minAdj3) ? minAdj3 : (adj3 > a1) ? a1 : adj3
|
|
2834
|
+
const dx2 = w * a2 / cnstVal5
|
|
2835
|
+
const x2 = hc - dx2
|
|
2836
|
+
const x3 = x2 + wd8
|
|
2837
|
+
const x4 = r - x3
|
|
2838
|
+
const x5 = r - x2
|
|
2839
|
+
const x6 = r - wd8
|
|
2840
|
+
const dy1 = h * a3 / cnstVal4
|
|
2841
|
+
const f1 = 4 * dy1 / w
|
|
2842
|
+
const q2 = x3 - (x3 * x3 / w)
|
|
2843
|
+
const cx1 = x3 / 2
|
|
2844
|
+
const cx2 = r - cx1
|
|
2845
|
+
const q1_h = h * a1 / cnstVal4
|
|
2846
|
+
const dy3 = q1_h - dy1
|
|
2847
|
+
const q4 = x2 - (x2 * x2 / w)
|
|
2848
|
+
const q5 = f1 * q4
|
|
2849
|
+
const rh = b - q1_h
|
|
2850
|
+
const q8 = dy1 * 14 / 16
|
|
2851
|
+
const cx4 = x2 / 2
|
|
2852
|
+
const q9 = f1 * cx4
|
|
2853
|
+
const cx5 = r - cx4
|
|
2854
|
+
if (shapType === 'ellipseRibbon') {
|
|
2855
|
+
const y1 = f1 * q2
|
|
2856
|
+
const cy1 = f1 * cx1
|
|
2857
|
+
const y3 = q5 + dy3
|
|
2858
|
+
const q6 = dy1 + dy3 - y3
|
|
2859
|
+
const cy3 = (q6 + dy1) + dy3
|
|
2860
|
+
const y2 = (q8 + rh) / 2
|
|
2861
|
+
const y5 = q5 + rh
|
|
2862
|
+
const y6 = y3 + rh
|
|
2863
|
+
const cy4 = q9 + rh
|
|
2864
|
+
const cy6 = cy3 + rh
|
|
2865
|
+
const y7 = y1 + dy3
|
|
2866
|
+
pathData = `M ${l},${t} Q ${cx1},${cy1} ${x3},${y1} L ${x2},${y3} Q ${hc},${cy3} ${x5},${y3} L ${x4},${y1} Q ${cx2},${cy1} ${r},${t} L ${x6},${y2} L ${r},${rh} Q ${cx5},${cy4} ${x5},${y5} L ${x5},${y6} Q ${hc},${cy6} ${x2},${y6} L ${x2},${y5} Q ${cx4},${cy4} ${l},${rh} L ${wd8},${y2} z M ${x2},${y5} L ${x2},${y3} M ${x5},${y3} L ${x5},${y5} M ${x3},${y1} L ${x3},${y7} M ${x4},${y7} L ${x4},${y1}`
|
|
2867
|
+
}
|
|
2868
|
+
else if (shapType === 'ellipseRibbon2') {
|
|
2869
|
+
const u1 = f1 * q2
|
|
2870
|
+
const y1 = b - u1
|
|
2871
|
+
const cu1 = f1 * cx1
|
|
2872
|
+
const cy1 = b - cu1
|
|
2873
|
+
const u3 = q5 + dy3
|
|
2874
|
+
const y3 = b - u3
|
|
2875
|
+
const q6 = dy1 + dy3 - u3
|
|
2876
|
+
const cu3 = (q6 + dy1) + dy3
|
|
2877
|
+
const cy3 = b - cu3
|
|
2878
|
+
const u2 = (q8 + rh) / 2
|
|
2879
|
+
const y2 = b - u2
|
|
2880
|
+
const u5 = q5 + rh
|
|
2881
|
+
const y5 = b - u5
|
|
2882
|
+
const u6 = u3 + rh
|
|
2883
|
+
const y6 = b - u6
|
|
2884
|
+
const cu4 = q9 + rh
|
|
2885
|
+
const cy4 = b - cu4
|
|
2886
|
+
const cu6 = cu3 + rh
|
|
2887
|
+
const cy6 = b - cu6
|
|
2888
|
+
const u7 = u1 + dy3
|
|
2889
|
+
const y7 = b - u7
|
|
2890
|
+
pathData = `M ${l},${b} L ${wd8},${y2} L ${l},${q1_h} Q ${cx4},${cy4} ${x2},${y5} L ${x2},${y6} Q ${hc},${cy6} ${x5},${y6} L ${x5},${y5} Q ${cx5},${cy4} ${r},${q1_h} L ${x6},${y2} L ${r},${b} Q ${cx2},${cy1} ${x4},${y1} L ${x5},${y3} Q ${hc},${cy3} ${x2},${y3} L ${x3},${y1} Q ${cx1},${cy1} ${l},${b} z M ${x2},${y3} L ${x2},${y5} M ${x5},${y5} L ${x5},${y3} M ${x3},${y7} L ${x3},${y1} M ${x4},${y1} L ${x4},${y7}`
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
break
|
|
2894
|
+
case 'line':
|
|
2895
|
+
case 'straightConnector1':
|
|
2896
|
+
case 'bentConnector4':
|
|
2897
|
+
case 'bentConnector5':
|
|
2898
|
+
case 'curvedConnector2':
|
|
2899
|
+
case 'curvedConnector3':
|
|
2900
|
+
case 'curvedConnector4':
|
|
2901
|
+
case 'curvedConnector5':
|
|
2902
|
+
pathData = `M 0 0 L ${w} ${h}`
|
|
2903
|
+
break
|
|
2904
|
+
case 'rightArrow':
|
|
2905
|
+
{
|
|
2906
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2907
|
+
let sAdj1_val = 0.25
|
|
2908
|
+
let sAdj2_val = 0.5
|
|
2909
|
+
if (shapAdjst_ary) {
|
|
2910
|
+
const max_sAdj2_const = w / h
|
|
2911
|
+
for (const adj of shapAdjst_ary) {
|
|
2912
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2913
|
+
if (sAdj_name === 'adj1') {
|
|
2914
|
+
sAdj1_val = 0.5 - (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000)
|
|
2915
|
+
}
|
|
2916
|
+
else if (sAdj_name === 'adj2') {
|
|
2917
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
2918
|
+
sAdj2_val = 1 - (sAdj2_val2 / max_sAdj2_const)
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
pathData = `M ${w} ${h / 2} L ${sAdj2_val * w} 0 L ${sAdj2_val * w} ${sAdj1_val * h} L 0 ${sAdj1_val * h} L 0 ${(1 - sAdj1_val) * h} L ${sAdj2_val * w} ${(1 - sAdj1_val) * h} L ${sAdj2_val * w} ${h} Z`
|
|
2923
|
+
}
|
|
2924
|
+
break
|
|
2925
|
+
case 'leftArrow':
|
|
2926
|
+
{
|
|
2927
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2928
|
+
let sAdj1_val = 0.25
|
|
2929
|
+
let sAdj2_val = 0.5
|
|
2930
|
+
if (shapAdjst_ary) {
|
|
2931
|
+
const max_sAdj2_const = w / h
|
|
2932
|
+
for (const adj of shapAdjst_ary) {
|
|
2933
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2934
|
+
if (sAdj_name === 'adj1') {
|
|
2935
|
+
sAdj1_val = 0.5 - (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000)
|
|
2936
|
+
}
|
|
2937
|
+
else if (sAdj_name === 'adj2') {
|
|
2938
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
2939
|
+
sAdj2_val = sAdj2_val2 / max_sAdj2_const
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
}
|
|
2943
|
+
pathData = `M 0 ${h / 2} L ${sAdj2_val * w} ${h} L ${sAdj2_val * w} ${(1 - sAdj1_val) * h} L ${w} ${(1 - sAdj1_val) * h} L ${w} ${sAdj1_val * h} L ${sAdj2_val * w} ${sAdj1_val * h} L ${sAdj2_val * w} 0 Z`
|
|
2944
|
+
}
|
|
2945
|
+
break
|
|
2946
|
+
case 'downArrow':
|
|
2947
|
+
case 'flowChartOffpageConnector':
|
|
2948
|
+
{
|
|
2949
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2950
|
+
let sAdj1_val = 0.25
|
|
2951
|
+
let sAdj2_val = 0.5
|
|
2952
|
+
if (shapAdjst_ary) {
|
|
2953
|
+
const max_sAdj2_const = h / w
|
|
2954
|
+
for (const adj of shapAdjst_ary) {
|
|
2955
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2956
|
+
if (sAdj_name === 'adj1') {
|
|
2957
|
+
sAdj1_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000
|
|
2958
|
+
}
|
|
2959
|
+
else if (sAdj_name === 'adj2') {
|
|
2960
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
2961
|
+
sAdj2_val = sAdj2_val2 / max_sAdj2_const
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
if (shapType === 'flowChartOffpageConnector') {
|
|
2966
|
+
sAdj1_val = 0.5
|
|
2967
|
+
sAdj2_val = 0.212
|
|
2968
|
+
}
|
|
2969
|
+
pathData = `M ${(0.5 - sAdj1_val) * w} 0 L ${(0.5 - sAdj1_val) * w} ${(1 - sAdj2_val) * h} L 0 ${(1 - sAdj2_val) * h} L ${w / 2} ${h} L ${w} ${(1 - sAdj2_val) * h} L ${(0.5 + sAdj1_val) * w} ${(1 - sAdj2_val) * h} L ${(0.5 + sAdj1_val) * w} 0 Z`
|
|
2970
|
+
}
|
|
2971
|
+
break
|
|
2972
|
+
case 'upArrow':
|
|
2973
|
+
{
|
|
2974
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2975
|
+
let sAdj1_val = 0.25
|
|
2976
|
+
let sAdj2_val = 0.5
|
|
2977
|
+
if (shapAdjst_ary) {
|
|
2978
|
+
const max_sAdj2_const = h / w
|
|
2979
|
+
for (const adj of shapAdjst_ary) {
|
|
2980
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
2981
|
+
if (sAdj_name === 'adj1') {
|
|
2982
|
+
sAdj1_val = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000
|
|
2983
|
+
}
|
|
2984
|
+
else if (sAdj_name === 'adj2') {
|
|
2985
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
2986
|
+
sAdj2_val = sAdj2_val2 / max_sAdj2_const
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
pathData = `M ${w / 2} 0 L 0 ${sAdj2_val * h} L ${(0.5 - sAdj1_val) * w} ${sAdj2_val * h} L ${(0.5 - sAdj1_val) * w} ${h} L ${(0.5 + sAdj1_val) * w} ${h} L ${(0.5 + sAdj1_val) * w} ${sAdj2_val * h} L ${w} ${sAdj2_val * h} Z`
|
|
2991
|
+
}
|
|
2992
|
+
break
|
|
2993
|
+
case 'leftRightArrow':
|
|
2994
|
+
{
|
|
2995
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
2996
|
+
let sAdj1_val = 0.25
|
|
2997
|
+
let sAdj2_val = 0.25
|
|
2998
|
+
if (shapAdjst_ary) {
|
|
2999
|
+
const max_sAdj2_const = w / h
|
|
3000
|
+
for (const adj of shapAdjst_ary) {
|
|
3001
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3002
|
+
if (sAdj_name === 'adj1') {
|
|
3003
|
+
sAdj1_val = 0.5 - (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000)
|
|
3004
|
+
}
|
|
3005
|
+
else if (sAdj_name === 'adj2') {
|
|
3006
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
3007
|
+
sAdj2_val = sAdj2_val2 / max_sAdj2_const
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
pathData = `M 0 ${h / 2} L ${sAdj2_val * w} ${h} L ${sAdj2_val * w} ${(1 - sAdj1_val) * h} L ${(1 - sAdj2_val) * w} ${(1 - sAdj1_val) * h} L ${(1 - sAdj2_val) * w} ${h} L ${w} ${h / 2} L ${(1 - sAdj2_val) * w} 0 L ${(1 - sAdj2_val) * w} ${sAdj1_val * h} L ${sAdj2_val * w} ${sAdj1_val * h} L ${sAdj2_val * w} 0 Z`
|
|
3012
|
+
}
|
|
3013
|
+
break
|
|
3014
|
+
case 'upDownArrow':
|
|
3015
|
+
{
|
|
3016
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3017
|
+
let sAdj1_val = 0.25
|
|
3018
|
+
let sAdj2_val = 0.25
|
|
3019
|
+
if (shapAdjst_ary) {
|
|
3020
|
+
const max_sAdj2_const = h / w
|
|
3021
|
+
for (const adj of shapAdjst_ary) {
|
|
3022
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3023
|
+
if (sAdj_name === 'adj1') {
|
|
3024
|
+
sAdj1_val = 0.5 - (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 200000)
|
|
3025
|
+
}
|
|
3026
|
+
else if (sAdj_name === 'adj2') {
|
|
3027
|
+
const sAdj2_val2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 100000
|
|
3028
|
+
sAdj2_val = sAdj2_val2 / max_sAdj2_const
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
pathData = `M ${w / 2} 0 L 0 ${sAdj2_val * h} L ${sAdj1_val * w} ${sAdj2_val * h} L ${sAdj1_val * w} ${(1 - sAdj2_val) * h} L 0 ${(1 - sAdj2_val) * h} L ${w / 2} ${h} L ${w} ${(1 - sAdj2_val) * h} L ${(1 - sAdj1_val) * w} ${(1 - sAdj2_val) * h} L ${(1 - sAdj1_val) * w} ${sAdj2_val * h} L ${w} ${sAdj2_val * h} Z`
|
|
3033
|
+
}
|
|
3034
|
+
break
|
|
3035
|
+
case 'quadArrow':
|
|
3036
|
+
{
|
|
3037
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3038
|
+
let adj1 = 22500 * RATIO_EMUs_Points
|
|
3039
|
+
let adj2 = 22500 * RATIO_EMUs_Points
|
|
3040
|
+
let adj3 = 22500 * RATIO_EMUs_Points
|
|
3041
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3042
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3043
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3044
|
+
if (shapAdjst_ary) {
|
|
3045
|
+
for (const adj of shapAdjst_ary) {
|
|
3046
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3047
|
+
if (sAdj_name === 'adj1') {
|
|
3048
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3049
|
+
}
|
|
3050
|
+
else if (sAdj_name === 'adj2') {
|
|
3051
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3052
|
+
}
|
|
3053
|
+
else if (sAdj_name === 'adj3') {
|
|
3054
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
const vc = h / 2,
|
|
3059
|
+
hc = w / 2
|
|
3060
|
+
const minWH = Math.min(w, h)
|
|
3061
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3062
|
+
const maxAdj1 = 2 * a2
|
|
3063
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3064
|
+
const q1 = cnstVal2 - maxAdj1
|
|
3065
|
+
const maxAdj3 = q1 / 2
|
|
3066
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3067
|
+
const x1 = minWH * a3 / cnstVal2
|
|
3068
|
+
const dx2 = minWH * a2 / cnstVal2
|
|
3069
|
+
const x2 = hc - dx2
|
|
3070
|
+
const x5 = hc + dx2
|
|
3071
|
+
const dx3 = minWH * a1 / cnstVal3
|
|
3072
|
+
const x3 = hc - dx3
|
|
3073
|
+
const x4 = hc + dx3
|
|
3074
|
+
const x6 = w - x1
|
|
3075
|
+
const y2 = vc - dx2
|
|
3076
|
+
const y5 = vc + dx2
|
|
3077
|
+
const y3 = vc - dx3
|
|
3078
|
+
const y4 = vc + dx3
|
|
3079
|
+
const y6 = h - x1
|
|
3080
|
+
pathData = `M 0,${vc} L ${x1},${y2} L ${x1},${y3} L ${x3},${y3} L ${x3},${x1} L ${x2},${x1} L ${hc},0 L ${x5},${x1} L ${x4},${x1} L ${x4},${y3} L ${x6},${y3} L ${x6},${y2} L ${w},${vc} L ${x6},${y5} L ${x6},${y4} L ${x4},${y4} L ${x4},${y6} L ${x5},${y6} L ${hc},${h} L ${x2},${y6} L ${x3},${y6} L ${x3},${y4} L ${x1},${y4} L ${x1},${y5} z`
|
|
3081
|
+
}
|
|
3082
|
+
break
|
|
3083
|
+
case 'leftRightUpArrow':
|
|
3084
|
+
{
|
|
3085
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3086
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3087
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3088
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3089
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3090
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3091
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3092
|
+
if (shapAdjst_ary) {
|
|
3093
|
+
for (const adj of shapAdjst_ary) {
|
|
3094
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3095
|
+
if (sAdj_name === 'adj1') {
|
|
3096
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3097
|
+
}
|
|
3098
|
+
else if (sAdj_name === 'adj2') {
|
|
3099
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3100
|
+
}
|
|
3101
|
+
else if (sAdj_name === 'adj3') {
|
|
3102
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3106
|
+
const hc = w / 2
|
|
3107
|
+
const minWH = Math.min(w, h)
|
|
3108
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3109
|
+
const maxAdj1 = 2 * a2
|
|
3110
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3111
|
+
const q1 = cnstVal2 - maxAdj1
|
|
3112
|
+
const maxAdj3 = q1 / 2
|
|
3113
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3114
|
+
const x1 = minWH * a3 / cnstVal2
|
|
3115
|
+
const dx2 = minWH * a2 / cnstVal2
|
|
3116
|
+
const x2 = hc - dx2
|
|
3117
|
+
const x5 = hc + dx2
|
|
3118
|
+
const dx3 = minWH * a1 / cnstVal3
|
|
3119
|
+
const x3 = hc - dx3
|
|
3120
|
+
const x4 = hc + dx3
|
|
3121
|
+
const x6 = w - x1
|
|
3122
|
+
const dy2 = minWH * a2 / cnstVal1
|
|
3123
|
+
const y2 = h - dy2
|
|
3124
|
+
const y4 = h - dx2
|
|
3125
|
+
const y3 = y4 - dx3
|
|
3126
|
+
const y5 = y4 + dx3
|
|
3127
|
+
pathData = `M 0,${y4} L ${x1},${y2} L ${x1},${y3} L ${x3},${y3} L ${x3},${x1} L ${x2},${x1} L ${hc},0 L ${x5},${x1} L ${x4},${x1} L ${x4},${y3} L ${x6},${y3} L ${x6},${y2} L ${w},${y4} L ${x6},${h} L ${x6},${y5} L ${x1},${y5} L ${x1},${h} z`
|
|
3128
|
+
}
|
|
3129
|
+
break
|
|
3130
|
+
case 'leftUpArrow':
|
|
3131
|
+
{
|
|
3132
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3133
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3134
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3135
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3136
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3137
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3138
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3139
|
+
if (shapAdjst_ary) {
|
|
3140
|
+
for (const adj of shapAdjst_ary) {
|
|
3141
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3142
|
+
if (sAdj_name === 'adj1') {
|
|
3143
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3144
|
+
}
|
|
3145
|
+
else if (sAdj_name === 'adj2') {
|
|
3146
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3147
|
+
}
|
|
3148
|
+
else if (sAdj_name === 'adj3') {
|
|
3149
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
const minWH = Math.min(w, h)
|
|
3154
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3155
|
+
const maxAdj1 = 2 * a2
|
|
3156
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3157
|
+
const maxAdj3 = cnstVal2 - maxAdj1
|
|
3158
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3159
|
+
const x1 = minWH * a3 / cnstVal2
|
|
3160
|
+
const dx2 = minWH * a2 / cnstVal1
|
|
3161
|
+
const x2 = w - dx2
|
|
3162
|
+
const y2 = h - dx2
|
|
3163
|
+
const dx4 = minWH * a2 / cnstVal2
|
|
3164
|
+
const x4 = w - dx4
|
|
3165
|
+
const y4 = h - dx4
|
|
3166
|
+
const dx3 = minWH * a1 / cnstVal3
|
|
3167
|
+
const x3 = x4 - dx3
|
|
3168
|
+
const x5 = x4 + dx3
|
|
3169
|
+
const y3 = y4 - dx3
|
|
3170
|
+
const y5 = y4 + dx3
|
|
3171
|
+
pathData = `M 0,${y4} L ${x1},${y2} L ${x1},${y3} L ${x3},${y3} L ${x3},${x1} L ${x2},${x1} L ${x4},0 L ${w},${x1} L ${x5},${x1} L ${x5},${y5} L ${x1},${y5} L ${x1},${h} z`
|
|
3172
|
+
}
|
|
3173
|
+
break
|
|
3174
|
+
case 'bentUpArrow':
|
|
3175
|
+
{
|
|
3176
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3177
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3178
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3179
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3180
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3181
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3182
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3183
|
+
if (shapAdjst_ary) {
|
|
3184
|
+
for (const adj of shapAdjst_ary) {
|
|
3185
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3186
|
+
if (sAdj_name === 'adj1') {
|
|
3187
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3188
|
+
}
|
|
3189
|
+
else if (sAdj_name === 'adj2') {
|
|
3190
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3191
|
+
}
|
|
3192
|
+
else if (sAdj_name === 'adj3') {
|
|
3193
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
const minWH = Math.min(w, h)
|
|
3198
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
3199
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3200
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > cnstVal1) ? cnstVal1 : adj3
|
|
3201
|
+
const y1 = minWH * a3 / cnstVal2
|
|
3202
|
+
const dx1 = minWH * a2 / cnstVal1
|
|
3203
|
+
const x1 = w - dx1
|
|
3204
|
+
const dx3 = minWH * a2 / cnstVal2
|
|
3205
|
+
const x3 = w - dx3
|
|
3206
|
+
const dx2 = minWH * a1 / cnstVal3
|
|
3207
|
+
const x2 = x3 - dx2
|
|
3208
|
+
const x4 = x3 + dx2
|
|
3209
|
+
const dy2 = minWH * a1 / cnstVal2
|
|
3210
|
+
const y2 = h - dy2
|
|
3211
|
+
pathData = `M 0,${y2} L ${x2},${y2} L ${x2},${y1} L ${x1},${y1} L ${x3},0 L ${w},${y1} L ${x4},${y1} L ${x4},${h} L 0,${h} z`
|
|
3212
|
+
}
|
|
3213
|
+
break
|
|
3214
|
+
case 'bentArrow':
|
|
3215
|
+
{
|
|
3216
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3217
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3218
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3219
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3220
|
+
let adj4 = 43750 * RATIO_EMUs_Points
|
|
3221
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3222
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3223
|
+
if (shapAdjst_ary) {
|
|
3224
|
+
for (const adj of shapAdjst_ary) {
|
|
3225
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3226
|
+
if (sAdj_name === 'adj1') {
|
|
3227
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3228
|
+
}
|
|
3229
|
+
else if (sAdj_name === 'adj2') {
|
|
3230
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3231
|
+
}
|
|
3232
|
+
else if (sAdj_name === 'adj3') {
|
|
3233
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3234
|
+
}
|
|
3235
|
+
else if (sAdj_name === 'adj4') {
|
|
3236
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
}
|
|
3240
|
+
const minWH = Math.min(w, h)
|
|
3241
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3242
|
+
const maxAdj1 = 2 * a2
|
|
3243
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3244
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > cnstVal1) ? cnstVal1 : adj3
|
|
3245
|
+
const th = minWH * a1 / cnstVal2
|
|
3246
|
+
const aw2 = minWH * a2 / cnstVal2
|
|
3247
|
+
const th2 = th / 2
|
|
3248
|
+
const dh2 = aw2 - th2
|
|
3249
|
+
const ah = minWH * a3 / cnstVal2
|
|
3250
|
+
const bw = w - ah
|
|
3251
|
+
const bh = h - dh2
|
|
3252
|
+
const bs = (bw < bh) ? bw : bh
|
|
3253
|
+
const maxAdj4 = cnstVal2 * bs / minWH
|
|
3254
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3255
|
+
const bd = minWH * a4 / cnstVal2
|
|
3256
|
+
const bd3 = bd - th
|
|
3257
|
+
const bd2 = (bd3 > 0) ? bd3 : 0
|
|
3258
|
+
const x3 = th + bd2
|
|
3259
|
+
const x4 = w - ah
|
|
3260
|
+
const y3 = dh2 + th
|
|
3261
|
+
const y4 = y3 + dh2
|
|
3262
|
+
const y5 = dh2 + bd
|
|
3263
|
+
const y6 = y3 + bd2
|
|
3264
|
+
pathData = `M 0,${h} L 0,${y5} ${shapeArc(bd, y5, bd, bd, 180, 270, false).replace('M', 'L')} L ${x4},${dh2} L ${x4},0 L ${w},${aw2} L ${x4},${y4} L ${x4},${y3} L ${x3},${y3} ${shapeArc(x3, y6, bd2, bd2, 270, 180, false).replace('M', 'L')} L ${th},${h} z`
|
|
3265
|
+
}
|
|
3266
|
+
break
|
|
3267
|
+
case 'uturnArrow':
|
|
3268
|
+
{
|
|
3269
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3270
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3271
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3272
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3273
|
+
let adj4 = 43750 * RATIO_EMUs_Points
|
|
3274
|
+
let adj5 = 75000 * RATIO_EMUs_Points
|
|
3275
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
3276
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3277
|
+
if (shapAdjst_ary) {
|
|
3278
|
+
for (const adj of shapAdjst_ary) {
|
|
3279
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3280
|
+
if (sAdj_name === 'adj1') {
|
|
3281
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3282
|
+
}
|
|
3283
|
+
else if (sAdj_name === 'adj2') {
|
|
3284
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3285
|
+
}
|
|
3286
|
+
else if (sAdj_name === 'adj3') {
|
|
3287
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3288
|
+
}
|
|
3289
|
+
else if (sAdj_name === 'adj4') {
|
|
3290
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3291
|
+
}
|
|
3292
|
+
else if (sAdj_name === 'adj5') {
|
|
3293
|
+
adj5 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
const minWH = Math.min(w, h)
|
|
3298
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3299
|
+
const maxAdj1 = 2 * a2
|
|
3300
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3301
|
+
const q2 = a1 * minWH / h
|
|
3302
|
+
const q3 = cnstVal2 - q2
|
|
3303
|
+
const maxAdj3 = q3 * h / minWH
|
|
3304
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3305
|
+
const q1 = a3 + a1
|
|
3306
|
+
const minAdj5 = q1 * minWH / h
|
|
3307
|
+
const a5 = (adj5 < minAdj5) ? minAdj5 : (adj5 > cnstVal2) ? cnstVal2 : adj5
|
|
3308
|
+
const th = minWH * a1 / cnstVal2
|
|
3309
|
+
const aw2 = minWH * a2 / cnstVal2
|
|
3310
|
+
const th2 = th / 2
|
|
3311
|
+
const dh2 = aw2 - th2
|
|
3312
|
+
const y5 = h * a5 / cnstVal2
|
|
3313
|
+
const ah = minWH * a3 / cnstVal2
|
|
3314
|
+
const y4 = y5 - ah
|
|
3315
|
+
const x9 = w - dh2
|
|
3316
|
+
const bw = x9 / 2
|
|
3317
|
+
const bs = (bw < y4) ? bw : y4
|
|
3318
|
+
const maxAdj4 = cnstVal2 * bs / minWH
|
|
3319
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3320
|
+
const bd = minWH * a4 / cnstVal2
|
|
3321
|
+
const bd3 = bd - th
|
|
3322
|
+
const bd2 = (bd3 > 0) ? bd3 : 0
|
|
3323
|
+
const x3 = th + bd2
|
|
3324
|
+
const x8 = w - aw2
|
|
3325
|
+
const x6 = x8 - aw2
|
|
3326
|
+
const x7 = x6 + dh2
|
|
3327
|
+
const x4 = x9 - bd
|
|
3328
|
+
const x5 = x7 - bd2
|
|
3329
|
+
pathData = `M 0,${h} L 0,${bd} ${shapeArc(bd, bd, bd, bd, 180, 270, false).replace('M', 'L')} L ${x4},0 ${shapeArc(x4, bd, bd, bd, 270, 360, false).replace('M', 'L')} L ${x9},${y4} L ${w},${y4} L ${x8},${y5} L ${x6},${y4} L ${x7},${y4} L ${x7},${x3} ${shapeArc(x5, x3, bd2, bd2, 0, -90, false).replace('M', 'L')} L ${x3},${th} ${shapeArc(x3, x3, bd2, bd2, 270, 180, false).replace('M', 'L')} L ${th},${h} z`
|
|
3330
|
+
}
|
|
3331
|
+
break
|
|
3332
|
+
case 'stripedRightArrow':
|
|
3333
|
+
{
|
|
3334
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3335
|
+
let adj1 = 50000 * RATIO_EMUs_Points
|
|
3336
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3337
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
3338
|
+
const cnstVal2 = 200000 * RATIO_EMUs_Points
|
|
3339
|
+
const cnstVal3 = 84375 * RATIO_EMUs_Points
|
|
3340
|
+
if (shapAdjst_ary) {
|
|
3341
|
+
for (const adj of shapAdjst_ary) {
|
|
3342
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3343
|
+
if (sAdj_name === 'adj1') {
|
|
3344
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3345
|
+
}
|
|
3346
|
+
else if (sAdj_name === 'adj2') {
|
|
3347
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
const vc = h / 2
|
|
3352
|
+
const minWH = Math.min(w, h)
|
|
3353
|
+
const maxAdj2 = cnstVal3 * w / minWH
|
|
3354
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
3355
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3356
|
+
const x4 = minWH * 5 / 32
|
|
3357
|
+
const dx5 = minWH * a2 / cnstVal1
|
|
3358
|
+
const x5 = w - dx5
|
|
3359
|
+
const dy1 = h * a1 / cnstVal2
|
|
3360
|
+
const y1 = vc - dy1
|
|
3361
|
+
const y2 = vc + dy1
|
|
3362
|
+
const ssd8 = minWH / 8,
|
|
3363
|
+
ssd16 = minWH / 16,
|
|
3364
|
+
ssd32 = minWH / 32
|
|
3365
|
+
pathData = `M 0,${y1} L ${ssd32},${y1} L ${ssd32},${y2} L 0,${y2} z M ${ssd16},${y1} L ${ssd8},${y1} L ${ssd8},${y2} L ${ssd16},${y2} z M ${x4},${y1} L ${x5},${y1} L ${x5},0 L ${w},${vc} L ${x5},${h} L ${x5},${y2} L ${x4},${y2} z`
|
|
3366
|
+
}
|
|
3367
|
+
break
|
|
3368
|
+
case 'notchedRightArrow':
|
|
3369
|
+
{
|
|
3370
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3371
|
+
let adj1 = 50000 * RATIO_EMUs_Points
|
|
3372
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3373
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
3374
|
+
const cnstVal2 = 200000 * RATIO_EMUs_Points
|
|
3375
|
+
if (shapAdjst_ary) {
|
|
3376
|
+
for (const adj of shapAdjst_ary) {
|
|
3377
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3378
|
+
if (sAdj_name === 'adj1') {
|
|
3379
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3380
|
+
}
|
|
3381
|
+
else if (sAdj_name === 'adj2') {
|
|
3382
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
const vc = h / 2,
|
|
3387
|
+
hd2 = vc
|
|
3388
|
+
const minWH = Math.min(w, h)
|
|
3389
|
+
const maxAdj2 = cnstVal1 * w / minWH
|
|
3390
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
3391
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3392
|
+
const dx2 = minWH * a2 / cnstVal1
|
|
3393
|
+
const x2 = w - dx2
|
|
3394
|
+
const dy1 = h * a1 / cnstVal2
|
|
3395
|
+
const y1 = vc - dy1
|
|
3396
|
+
const y2 = vc + dy1
|
|
3397
|
+
const x1 = dy1 * dx2 / hd2
|
|
3398
|
+
pathData = `M 0,${y1} L ${x2},${y1} L ${x2},0 L ${w},${vc} L ${x2},${h} L ${x2},${y2} L 0,${y2} L ${x1},${vc} z`
|
|
3399
|
+
}
|
|
3400
|
+
break
|
|
3401
|
+
case 'homePlate':
|
|
3402
|
+
{
|
|
3403
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
3404
|
+
let adj = 50000 * RATIO_EMUs_Points
|
|
3405
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
3406
|
+
if (shapAdjst) {
|
|
3407
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
3408
|
+
}
|
|
3409
|
+
const vc = h / 2
|
|
3410
|
+
const minWH = Math.min(w, h)
|
|
3411
|
+
const maxAdj = cnstVal1 * w / minWH
|
|
3412
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
3413
|
+
const dx1 = minWH * a / cnstVal1
|
|
3414
|
+
const x1 = w - dx1
|
|
3415
|
+
pathData = `M 0,0 L ${x1},0 L ${w},${vc} L ${x1},${h} L 0,${h} z`
|
|
3416
|
+
}
|
|
3417
|
+
break
|
|
3418
|
+
case 'chevron':
|
|
3419
|
+
{
|
|
3420
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
3421
|
+
let adj = 50000 * RATIO_EMUs_Points
|
|
3422
|
+
const cnstVal1 = 100000 * RATIO_EMUs_Points
|
|
3423
|
+
if (shapAdjst) {
|
|
3424
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
3425
|
+
}
|
|
3426
|
+
const vc = h / 2
|
|
3427
|
+
const minWH = Math.min(w, h)
|
|
3428
|
+
const maxAdj = cnstVal1 * w / minWH
|
|
3429
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
3430
|
+
const x1 = minWH * a / cnstVal1
|
|
3431
|
+
const x2 = w - x1
|
|
3432
|
+
pathData = `M 0,0 L ${x2},0 L ${w},${vc} L ${x2},${h} L 0,${h} L ${x1},${vc} z`
|
|
3433
|
+
}
|
|
3434
|
+
break
|
|
3435
|
+
case 'rightArrowCallout':
|
|
3436
|
+
{
|
|
3437
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3438
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3439
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3440
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3441
|
+
let adj4 = 64977 * RATIO_EMUs_Points
|
|
3442
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3443
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3444
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3445
|
+
if (shapAdjst_ary) {
|
|
3446
|
+
for (const adj of shapAdjst_ary) {
|
|
3447
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3448
|
+
if (sAdj_name === 'adj1') {
|
|
3449
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3450
|
+
}
|
|
3451
|
+
else if (sAdj_name === 'adj2') {
|
|
3452
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3453
|
+
}
|
|
3454
|
+
else if (sAdj_name === 'adj3') {
|
|
3455
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3456
|
+
}
|
|
3457
|
+
else if (sAdj_name === 'adj4') {
|
|
3458
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
const vc = h / 2,
|
|
3463
|
+
r = w,
|
|
3464
|
+
b = h,
|
|
3465
|
+
l = 0,
|
|
3466
|
+
t = 0
|
|
3467
|
+
const ss = Math.min(w, h)
|
|
3468
|
+
const maxAdj2 = cnstVal1 * h / ss
|
|
3469
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3470
|
+
const maxAdj1 = a2 * 2
|
|
3471
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3472
|
+
const maxAdj3 = cnstVal2 * w / ss
|
|
3473
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3474
|
+
const q2 = a3 * ss / w
|
|
3475
|
+
const maxAdj4 = cnstVal1 - q2
|
|
3476
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3477
|
+
const dy1 = ss * a2 / cnstVal2
|
|
3478
|
+
const dy2 = ss * a1 / cnstVal3
|
|
3479
|
+
const y1 = vc - dy1
|
|
3480
|
+
const y2 = vc - dy2
|
|
3481
|
+
const y3 = vc + dy2
|
|
3482
|
+
const y4 = vc + dy1
|
|
3483
|
+
const dx3 = ss * a3 / cnstVal2
|
|
3484
|
+
const x3 = r - dx3
|
|
3485
|
+
const x2 = w * a4 / cnstVal2
|
|
3486
|
+
pathData = `M ${l},${t} L ${x2},${t} L ${x2},${y2} L ${x3},${y2} L ${x3},${y1} L ${r},${vc} L ${x3},${y4} L ${x3},${y3} L ${x2},${y3} L ${x2},${b} L ${l},${b} z`
|
|
3487
|
+
}
|
|
3488
|
+
break
|
|
3489
|
+
case 'downArrowCallout':
|
|
3490
|
+
{
|
|
3491
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3492
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3493
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3494
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3495
|
+
let adj4 = 64977 * RATIO_EMUs_Points
|
|
3496
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3497
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3498
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3499
|
+
if (shapAdjst_ary) {
|
|
3500
|
+
for (const adj of shapAdjst_ary) {
|
|
3501
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3502
|
+
if (sAdj_name === 'adj1') {
|
|
3503
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3504
|
+
}
|
|
3505
|
+
else if (sAdj_name === 'adj2') {
|
|
3506
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3507
|
+
}
|
|
3508
|
+
else if (sAdj_name === 'adj3') {
|
|
3509
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3510
|
+
}
|
|
3511
|
+
else if (sAdj_name === 'adj4') {
|
|
3512
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3513
|
+
}
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
const hc = w / 2,
|
|
3517
|
+
r = w,
|
|
3518
|
+
b = h,
|
|
3519
|
+
l = 0,
|
|
3520
|
+
t = 0
|
|
3521
|
+
const ss = Math.min(w, h)
|
|
3522
|
+
const maxAdj2 = cnstVal1 * w / ss
|
|
3523
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3524
|
+
const maxAdj1 = a2 * 2
|
|
3525
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3526
|
+
const maxAdj3 = cnstVal2 * h / ss
|
|
3527
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3528
|
+
const q2 = a3 * ss / h
|
|
3529
|
+
const maxAdj4 = cnstVal2 - q2
|
|
3530
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3531
|
+
const dx1 = ss * a2 / cnstVal2
|
|
3532
|
+
const dx2 = ss * a1 / cnstVal3
|
|
3533
|
+
const x1 = hc - dx1
|
|
3534
|
+
const x2 = hc - dx2
|
|
3535
|
+
const x3 = hc + dx2
|
|
3536
|
+
const x4 = hc + dx1
|
|
3537
|
+
const dy3 = ss * a3 / cnstVal2
|
|
3538
|
+
const y3 = b - dy3
|
|
3539
|
+
const y2 = h * a4 / cnstVal2
|
|
3540
|
+
pathData = `M ${l},${t} L ${r},${t} L ${r},${y2} L ${x3},${y2} L ${x3},${y3} L ${x4},${y3} L ${hc},${b} L ${x1},${y3} L ${x2},${y3} L ${x2},${y2} L ${l},${y2} z`
|
|
3541
|
+
}
|
|
3542
|
+
break
|
|
3543
|
+
case 'leftArrowCallout':
|
|
3544
|
+
{
|
|
3545
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3546
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3547
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3548
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3549
|
+
let adj4 = 64977 * RATIO_EMUs_Points
|
|
3550
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3551
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3552
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3553
|
+
if (shapAdjst_ary) {
|
|
3554
|
+
for (const adj of shapAdjst_ary) {
|
|
3555
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3556
|
+
if (sAdj_name === 'adj1') {
|
|
3557
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3558
|
+
}
|
|
3559
|
+
else if (sAdj_name === 'adj2') {
|
|
3560
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3561
|
+
}
|
|
3562
|
+
else if (sAdj_name === 'adj3') {
|
|
3563
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3564
|
+
}
|
|
3565
|
+
else if (sAdj_name === 'adj4') {
|
|
3566
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
}
|
|
3570
|
+
const vc = h / 2,
|
|
3571
|
+
r = w,
|
|
3572
|
+
b = h,
|
|
3573
|
+
l = 0,
|
|
3574
|
+
t = 0
|
|
3575
|
+
const ss = Math.min(w, h)
|
|
3576
|
+
const maxAdj2 = cnstVal1 * h / ss
|
|
3577
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3578
|
+
const maxAdj1 = a2 * 2
|
|
3579
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3580
|
+
const maxAdj3 = cnstVal2 * w / ss
|
|
3581
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3582
|
+
const q2 = a3 * ss / w
|
|
3583
|
+
const maxAdj4 = cnstVal2 - q2
|
|
3584
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3585
|
+
const dy1 = ss * a2 / cnstVal2
|
|
3586
|
+
const dy2 = ss * a1 / cnstVal3
|
|
3587
|
+
const y1 = vc - dy1
|
|
3588
|
+
const y2 = vc - dy2
|
|
3589
|
+
const y3 = vc + dy2
|
|
3590
|
+
const y4 = vc + dy1
|
|
3591
|
+
const x1 = ss * a3 / cnstVal2
|
|
3592
|
+
const dx2 = w * a4 / cnstVal2
|
|
3593
|
+
const x2 = r - dx2
|
|
3594
|
+
pathData = `M ${l},${vc} L ${x1},${y1} L ${x1},${y2} L ${x2},${y2} L ${x2},${t} L ${r},${t} L ${r},${b} L ${x2},${b} L ${x2},${y3} L ${x1},${y3} L ${x1},${y4} z`
|
|
3595
|
+
}
|
|
3596
|
+
break
|
|
3597
|
+
case 'upArrowCallout':
|
|
3598
|
+
{
|
|
3599
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3600
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3601
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3602
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3603
|
+
let adj4 = 64977 * RATIO_EMUs_Points
|
|
3604
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3605
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3606
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3607
|
+
if (shapAdjst_ary) {
|
|
3608
|
+
for (const adj of shapAdjst_ary) {
|
|
3609
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3610
|
+
if (sAdj_name === 'adj1') {
|
|
3611
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3612
|
+
}
|
|
3613
|
+
else if (sAdj_name === 'adj2') {
|
|
3614
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3615
|
+
}
|
|
3616
|
+
else if (sAdj_name === 'adj3') {
|
|
3617
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3618
|
+
}
|
|
3619
|
+
else if (sAdj_name === 'adj4') {
|
|
3620
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
const hc = w / 2,
|
|
3625
|
+
r = w,
|
|
3626
|
+
b = h,
|
|
3627
|
+
l = 0,
|
|
3628
|
+
t = 0
|
|
3629
|
+
const ss = Math.min(w, h)
|
|
3630
|
+
const maxAdj2 = cnstVal1 * w / ss
|
|
3631
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3632
|
+
const maxAdj1 = a2 * 2
|
|
3633
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3634
|
+
const maxAdj3 = cnstVal2 * h / ss
|
|
3635
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3636
|
+
const q2 = a3 * ss / h
|
|
3637
|
+
const maxAdj4 = cnstVal2 - q2
|
|
3638
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3639
|
+
const dx1 = ss * a2 / cnstVal2
|
|
3640
|
+
const dx2 = ss * a1 / cnstVal3
|
|
3641
|
+
const x1 = hc - dx1
|
|
3642
|
+
const x2 = hc - dx2
|
|
3643
|
+
const x3 = hc + dx2
|
|
3644
|
+
const x4 = hc + dx1
|
|
3645
|
+
const y1 = ss * a3 / cnstVal2
|
|
3646
|
+
const dy2 = h * a4 / cnstVal2
|
|
3647
|
+
const y2 = b - dy2
|
|
3648
|
+
pathData = `M ${l},${y2} L ${x2},${y2} L ${x2},${y1} L ${x1},${y1} L ${hc},${t} L ${x4},${y1} L ${x3},${y1} L ${x3},${y2} L ${r},${y2} L ${r},${b} L ${l},${b} z`
|
|
3649
|
+
}
|
|
3650
|
+
break
|
|
3651
|
+
case 'leftRightArrowCallout':
|
|
3652
|
+
{
|
|
3653
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3654
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3655
|
+
let adj2 = 25000 * RATIO_EMUs_Points
|
|
3656
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3657
|
+
let adj4 = 48123 * RATIO_EMUs_Points
|
|
3658
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3659
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3660
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3661
|
+
if (shapAdjst_ary) {
|
|
3662
|
+
for (const adj of shapAdjst_ary) {
|
|
3663
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3664
|
+
if (sAdj_name === 'adj1') {
|
|
3665
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3666
|
+
}
|
|
3667
|
+
else if (sAdj_name === 'adj2') {
|
|
3668
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3669
|
+
}
|
|
3670
|
+
else if (sAdj_name === 'adj3') {
|
|
3671
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3672
|
+
}
|
|
3673
|
+
else if (sAdj_name === 'adj4') {
|
|
3674
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
const vc = h / 2,
|
|
3679
|
+
hc = w / 2,
|
|
3680
|
+
r = w,
|
|
3681
|
+
b = h,
|
|
3682
|
+
l = 0,
|
|
3683
|
+
t = 0
|
|
3684
|
+
const ss = Math.min(w, h)
|
|
3685
|
+
const maxAdj2 = cnstVal1 * h / ss
|
|
3686
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3687
|
+
const maxAdj1 = a2 * 2
|
|
3688
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3689
|
+
const maxAdj3 = cnstVal1 * w / ss
|
|
3690
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3691
|
+
const q2 = a3 * ss / (w / 2)
|
|
3692
|
+
const maxAdj4 = cnstVal2 - q2
|
|
3693
|
+
const a4 = (adj4 < 0) ? 0 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3694
|
+
const dy1 = ss * a2 / cnstVal2
|
|
3695
|
+
const dy2 = ss * a1 / cnstVal3
|
|
3696
|
+
const y1 = vc - dy1
|
|
3697
|
+
const y2 = vc - dy2
|
|
3698
|
+
const y3 = vc + dy2
|
|
3699
|
+
const y4 = vc + dy1
|
|
3700
|
+
const x1 = ss * a3 / cnstVal2
|
|
3701
|
+
const x4 = r - x1
|
|
3702
|
+
const dx2 = w * a4 / cnstVal3
|
|
3703
|
+
const x2 = hc - dx2
|
|
3704
|
+
const x3 = hc + dx2
|
|
3705
|
+
pathData = `M ${l},${vc} L ${x1},${y1} L ${x1},${y2} L ${x2},${y2} L ${x2},${t} L ${x3},${t} L ${x3},${y2} L ${x4},${y2} L ${x4},${y1} L ${r},${vc} L ${x4},${y4} L ${x4},${y3} L ${x3},${y3} L ${x3},${b} L ${x2},${b} L ${x2},${y3} L ${x1},${y3} L ${x1},${y4} z`
|
|
3706
|
+
}
|
|
3707
|
+
break
|
|
3708
|
+
case 'quadArrowCallout':
|
|
3709
|
+
{
|
|
3710
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3711
|
+
let adj1 = 18515 * RATIO_EMUs_Points
|
|
3712
|
+
let adj2 = 18515 * RATIO_EMUs_Points
|
|
3713
|
+
let adj3 = 18515 * RATIO_EMUs_Points
|
|
3714
|
+
let adj4 = 48123 * RATIO_EMUs_Points
|
|
3715
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3716
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3717
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
3718
|
+
if (shapAdjst_ary) {
|
|
3719
|
+
for (const adj of shapAdjst_ary) {
|
|
3720
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3721
|
+
if (sAdj_name === 'adj1') {
|
|
3722
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3723
|
+
}
|
|
3724
|
+
else if (sAdj_name === 'adj2') {
|
|
3725
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3726
|
+
}
|
|
3727
|
+
else if (sAdj_name === 'adj3') {
|
|
3728
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3729
|
+
}
|
|
3730
|
+
else if (sAdj_name === 'adj4') {
|
|
3731
|
+
adj4 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
const vc = h / 2,
|
|
3736
|
+
hc = w / 2,
|
|
3737
|
+
r = w,
|
|
3738
|
+
b = h,
|
|
3739
|
+
l = 0,
|
|
3740
|
+
t = 0
|
|
3741
|
+
const ss = Math.min(w, h)
|
|
3742
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > cnstVal1) ? cnstVal1 : adj2
|
|
3743
|
+
const maxAdj1 = a2 * 2
|
|
3744
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
3745
|
+
const maxAdj3 = cnstVal1 - a2
|
|
3746
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3747
|
+
const q2 = a3 * 2
|
|
3748
|
+
const maxAdj4 = cnstVal2 - q2
|
|
3749
|
+
const a4 = (adj4 < a1) ? a1 : (adj4 > maxAdj4) ? maxAdj4 : adj4
|
|
3750
|
+
const dx2 = ss * a2 / cnstVal2
|
|
3751
|
+
const dx3 = ss * a1 / cnstVal3
|
|
3752
|
+
const ah = ss * a3 / cnstVal2
|
|
3753
|
+
const dx1 = w * a4 / cnstVal3
|
|
3754
|
+
const dy1 = h * a4 / cnstVal3
|
|
3755
|
+
const x8 = r - ah
|
|
3756
|
+
const x2 = hc - dx1
|
|
3757
|
+
const x7 = hc + dx1
|
|
3758
|
+
const x3 = hc - dx2
|
|
3759
|
+
const x6 = hc + dx2
|
|
3760
|
+
const x4 = hc - dx3
|
|
3761
|
+
const x5 = hc + dx3
|
|
3762
|
+
const y8 = b - ah
|
|
3763
|
+
const y2 = vc - dy1
|
|
3764
|
+
const y7 = vc + dy1
|
|
3765
|
+
const y3 = vc - dx2
|
|
3766
|
+
const y6 = vc + dx2
|
|
3767
|
+
const y4 = vc - dx3
|
|
3768
|
+
const y5 = vc + dx3
|
|
3769
|
+
pathData = `M ${l},${vc} L ${ah},${y3} L ${ah},${y4} L ${x2},${y4} L ${x2},${y2} L ${x4},${y2} L ${x4},${ah} L ${x3},${ah} L ${hc},${t} L ${x6},${ah} L ${x5},${ah} L ${x5},${y2} L ${x7},${y2} L ${x7},${y4} L ${x8},${y4} L ${x8},${y3} L ${r},${vc} L ${x8},${y6} L ${x8},${y5} L ${x7},${y5} L ${x7},${y7} L ${x5},${y7} L ${x5},${y8} L ${x6},${y8} L ${hc},${b} L ${x3},${y8} L ${x4},${y8} L ${x4},${y7} L ${x2},${y7} L ${x2},${y5} L ${ah},${y5} L ${ah},${y6} z`
|
|
3770
|
+
}
|
|
3771
|
+
break
|
|
3772
|
+
case 'curvedDownArrow':
|
|
3773
|
+
{
|
|
3774
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3775
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3776
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3777
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3778
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3779
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3780
|
+
if (shapAdjst_ary) {
|
|
3781
|
+
for (const adj of shapAdjst_ary) {
|
|
3782
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3783
|
+
if (sAdj_name === 'adj1') {
|
|
3784
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3785
|
+
}
|
|
3786
|
+
else if (sAdj_name === 'adj2') {
|
|
3787
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3788
|
+
}
|
|
3789
|
+
else if (sAdj_name === 'adj3') {
|
|
3790
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
const wd2 = w / 2,
|
|
3795
|
+
r = w,
|
|
3796
|
+
b = h,
|
|
3797
|
+
t = 0,
|
|
3798
|
+
c3d4 = 270,
|
|
3799
|
+
cd2 = 180,
|
|
3800
|
+
cd4 = 90
|
|
3801
|
+
const ss = Math.min(w, h)
|
|
3802
|
+
const maxAdj2 = cnstVal1 * w / ss
|
|
3803
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3804
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal2) ? cnstVal2 : adj1
|
|
3805
|
+
const th = ss * a1 / cnstVal2
|
|
3806
|
+
const aw = ss * a2 / cnstVal2
|
|
3807
|
+
const q1 = (th + aw) / 4
|
|
3808
|
+
const wR = wd2 - q1
|
|
3809
|
+
const q7 = wR * 2
|
|
3810
|
+
const q11 = Math.sqrt(q7 * q7 - th * th)
|
|
3811
|
+
const idy = q11 * h / q7
|
|
3812
|
+
const maxAdj3 = cnstVal2 * idy / ss
|
|
3813
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3814
|
+
const ah = ss * a3 / cnstVal2
|
|
3815
|
+
const x3 = wR + th
|
|
3816
|
+
const q5 = Math.sqrt(h * h - ah * ah)
|
|
3817
|
+
const dx = q5 * wR / h
|
|
3818
|
+
const x5 = wR + dx
|
|
3819
|
+
const x7 = x3 + dx
|
|
3820
|
+
const dh = (aw - th) / 2
|
|
3821
|
+
const x4 = x5 - dh
|
|
3822
|
+
const x8 = x7 + dh
|
|
3823
|
+
const x6 = r - (aw / 2)
|
|
3824
|
+
const y1 = b - ah
|
|
3825
|
+
const swAng = Math.atan(dx / ah)
|
|
3826
|
+
const swAngDeg = swAng * 180 / Math.PI
|
|
3827
|
+
const mswAng = -swAngDeg
|
|
3828
|
+
const dang2 = Math.atan((th / 2) / idy)
|
|
3829
|
+
const dang2Deg = dang2 * 180 / Math.PI
|
|
3830
|
+
const stAng = c3d4 + swAngDeg
|
|
3831
|
+
const stAng2 = c3d4 - dang2Deg
|
|
3832
|
+
const swAng2 = dang2Deg - cd4
|
|
3833
|
+
const swAng3 = cd4 + dang2Deg
|
|
3834
|
+
pathData = `M ${x6},${b} L ${x4},${y1} L ${x5},${y1} ${shapeArc(wR, h, wR, h, stAng, (stAng + mswAng), false).replace('M', 'L')} L ${x3},${t} ${shapeArc(x3, h, wR, h, c3d4, (c3d4 + swAngDeg), false).replace('M', 'L')} L ${x5 + th},${y1} L ${x8},${y1} z M ${x3},${t} ${shapeArc(x3, h, wR, h, stAng2, (stAng2 + swAng2), false).replace('M', 'L')} ${shapeArc(wR, h, wR, h, cd2, (cd2 + swAng3), false).replace('M', 'L')}`
|
|
3835
|
+
}
|
|
3836
|
+
break
|
|
3837
|
+
case 'curvedLeftArrow':
|
|
3838
|
+
{
|
|
3839
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3840
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3841
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3842
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3843
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3844
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3845
|
+
if (shapAdjst_ary) {
|
|
3846
|
+
for (const adj of shapAdjst_ary) {
|
|
3847
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3848
|
+
if (sAdj_name === 'adj1') {
|
|
3849
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3850
|
+
}
|
|
3851
|
+
else if (sAdj_name === 'adj2') {
|
|
3852
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3853
|
+
}
|
|
3854
|
+
else if (sAdj_name === 'adj3') {
|
|
3855
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
const hd2 = h / 2,
|
|
3860
|
+
r = w,
|
|
3861
|
+
b = h,
|
|
3862
|
+
l = 0,
|
|
3863
|
+
t = 0,
|
|
3864
|
+
c3d4 = 270,
|
|
3865
|
+
cd4 = 90
|
|
3866
|
+
const ss = Math.min(w, h)
|
|
3867
|
+
const maxAdj2 = cnstVal1 * h / ss
|
|
3868
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3869
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > a2) ? a2 : adj1
|
|
3870
|
+
const th = ss * a1 / cnstVal2
|
|
3871
|
+
const aw = ss * a2 / cnstVal2
|
|
3872
|
+
const q1 = (th + aw) / 4
|
|
3873
|
+
const hR = hd2 - q1
|
|
3874
|
+
const q7 = hR * 2
|
|
3875
|
+
const q11 = Math.sqrt(q7 * q7 - th * th)
|
|
3876
|
+
const iDx = q11 * w / q7
|
|
3877
|
+
const maxAdj3 = cnstVal2 * iDx / ss
|
|
3878
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3879
|
+
const ah = ss * a3 / cnstVal2
|
|
3880
|
+
const y3 = hR + th
|
|
3881
|
+
const q5 = Math.sqrt(w * w - ah * ah)
|
|
3882
|
+
const dy = q5 * hR / w
|
|
3883
|
+
const y5 = hR + dy
|
|
3884
|
+
const y7 = y3 + dy
|
|
3885
|
+
const dh = (aw - th) / 2
|
|
3886
|
+
const y4 = y5 - dh
|
|
3887
|
+
const y8 = y7 + dh
|
|
3888
|
+
const y6 = b - (aw / 2)
|
|
3889
|
+
const x1 = l + ah
|
|
3890
|
+
const swAng = Math.atan(dy / ah)
|
|
3891
|
+
const dang2 = Math.atan((th / 2) / iDx)
|
|
3892
|
+
const swAng2 = dang2 - swAng
|
|
3893
|
+
const swAngDg = swAng * 180 / Math.PI
|
|
3894
|
+
const swAng2Dg = swAng2 * 180 / Math.PI
|
|
3895
|
+
pathData = `M ${r},${y3} ${shapeArc(l, hR, w, hR, 0, -cd4, false).replace('M', 'L')} L ${l},${t} ${shapeArc(l, y3, w, hR, c3d4, (c3d4 + cd4), false).replace('M', 'L')} L ${r},${y3} ${shapeArc(l, y3, w, hR, 0, swAngDg, false).replace('M', 'L')} L ${x1},${y7} L ${x1},${y8} L ${l},${y6} L ${x1},${y4} L ${x1},${y5} ${shapeArc(l, hR, w, hR, swAngDg, (swAngDg + swAng2Dg), false).replace('M', 'L')} ${shapeArc(l, hR, w, hR, 0, -cd4, false).replace('M', 'L')} ${shapeArc(l, y3, w, hR, c3d4, (c3d4 + cd4), false).replace('M', 'L')}`
|
|
3896
|
+
}
|
|
3897
|
+
break
|
|
3898
|
+
case 'curvedRightArrow':
|
|
3899
|
+
{
|
|
3900
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3901
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3902
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3903
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3904
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3905
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3906
|
+
if (shapAdjst_ary) {
|
|
3907
|
+
for (const adj of shapAdjst_ary) {
|
|
3908
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3909
|
+
if (sAdj_name === 'adj1') {
|
|
3910
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3911
|
+
}
|
|
3912
|
+
else if (sAdj_name === 'adj2') {
|
|
3913
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3914
|
+
}
|
|
3915
|
+
else if (sAdj_name === 'adj3') {
|
|
3916
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3917
|
+
}
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
const hd2 = h / 2,
|
|
3921
|
+
r = w,
|
|
3922
|
+
b = h,
|
|
3923
|
+
l = 0,
|
|
3924
|
+
cd2 = 180,
|
|
3925
|
+
cd4 = 90,
|
|
3926
|
+
c3d4 = 270
|
|
3927
|
+
const ss = Math.min(w, h)
|
|
3928
|
+
const maxAdj2 = cnstVal1 * h / ss
|
|
3929
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3930
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > a2) ? a2 : adj1
|
|
3931
|
+
const th = ss * a1 / cnstVal2
|
|
3932
|
+
const aw = ss * a2 / cnstVal2
|
|
3933
|
+
const q1 = (th + aw) / 4
|
|
3934
|
+
const hR = hd2 - q1
|
|
3935
|
+
const q7 = hR * 2
|
|
3936
|
+
const q11 = Math.sqrt(q7 * q7 - th * th)
|
|
3937
|
+
const iDx = q11 * w / q7
|
|
3938
|
+
const maxAdj3 = cnstVal2 * iDx / ss
|
|
3939
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
3940
|
+
const ah = ss * a3 / cnstVal2
|
|
3941
|
+
const y3 = hR + th
|
|
3942
|
+
const q5 = Math.sqrt(w * w - ah * ah)
|
|
3943
|
+
const dy = q5 * hR / w
|
|
3944
|
+
const y5 = hR + dy
|
|
3945
|
+
const y7 = y3 + dy
|
|
3946
|
+
const dh = (aw - th) / 2
|
|
3947
|
+
const y4 = y5 - dh
|
|
3948
|
+
const y8 = y7 + dh
|
|
3949
|
+
const y6 = b - (aw / 2)
|
|
3950
|
+
const x1 = r - ah
|
|
3951
|
+
const swAng = Math.atan(dy / ah)
|
|
3952
|
+
const stAng = Math.PI - swAng
|
|
3953
|
+
const mswAng = -swAng
|
|
3954
|
+
const dang2 = Math.atan((th / 2) / iDx)
|
|
3955
|
+
const swAng2 = dang2 - Math.PI / 2
|
|
3956
|
+
const stAngDg = stAng * 180 / Math.PI
|
|
3957
|
+
const mswAngDg = mswAng * 180 / Math.PI
|
|
3958
|
+
const swAngDg = swAng * 180 / Math.PI
|
|
3959
|
+
const swAng2dg = swAng2 * 180 / Math.PI
|
|
3960
|
+
pathData = `M ${l},${hR} ${shapeArc(w, hR, w, hR, cd2, cd2 + mswAngDg, false).replace('M', 'L')} L ${x1},${y5} L ${x1},${y4} L ${r},${y6} L ${x1},${y8} L ${x1},${y7} ${shapeArc(w, y3, w, hR, stAngDg, stAngDg + swAngDg, false).replace('M', 'L')} L ${l},${hR} ${shapeArc(w, hR, w, hR, cd2, cd2 + cd4, false).replace('M', 'L')} L ${r},${th} ${shapeArc(w, y3, w, hR, c3d4, c3d4 + swAng2dg, false).replace('M', 'L')}`
|
|
3961
|
+
}
|
|
3962
|
+
break
|
|
3963
|
+
case 'curvedUpArrow':
|
|
3964
|
+
{
|
|
3965
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
3966
|
+
let adj1 = 25000 * RATIO_EMUs_Points
|
|
3967
|
+
let adj2 = 50000 * RATIO_EMUs_Points
|
|
3968
|
+
let adj3 = 25000 * RATIO_EMUs_Points
|
|
3969
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
3970
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
3971
|
+
if (shapAdjst_ary) {
|
|
3972
|
+
for (const adj of shapAdjst_ary) {
|
|
3973
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
3974
|
+
if (sAdj_name === 'adj1') {
|
|
3975
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3976
|
+
}
|
|
3977
|
+
else if (sAdj_name === 'adj2') {
|
|
3978
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3979
|
+
}
|
|
3980
|
+
else if (sAdj_name === 'adj3') {
|
|
3981
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
3982
|
+
}
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
const wd2 = w / 2,
|
|
3986
|
+
r = w,
|
|
3987
|
+
b = h,
|
|
3988
|
+
t = 0,
|
|
3989
|
+
cd2 = 180,
|
|
3990
|
+
cd4 = 90
|
|
3991
|
+
const ss = Math.min(w, h)
|
|
3992
|
+
const maxAdj2 = cnstVal1 * w / ss
|
|
3993
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
3994
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal2) ? cnstVal2 : adj1
|
|
3995
|
+
const th = ss * a1 / cnstVal2
|
|
3996
|
+
const aw = ss * a2 / cnstVal2
|
|
3997
|
+
const q1 = (th + aw) / 4
|
|
3998
|
+
const wR = wd2 - q1
|
|
3999
|
+
const q7 = wR * 2
|
|
4000
|
+
const q11 = Math.sqrt(q7 * q7 - th * th)
|
|
4001
|
+
const idy = q11 * h / q7
|
|
4002
|
+
const maxAdj3 = cnstVal2 * idy / ss
|
|
4003
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
4004
|
+
const ah = ss * a3 / cnstVal2
|
|
4005
|
+
const x3 = wR + th
|
|
4006
|
+
const q5 = Math.sqrt(h * h - ah * ah)
|
|
4007
|
+
const dx = q5 * wR / h
|
|
4008
|
+
const x5 = wR + dx
|
|
4009
|
+
const x7 = x3 + dx
|
|
4010
|
+
const dh = (aw - th) / 2
|
|
4011
|
+
const x4 = x5 - dh
|
|
4012
|
+
const x8 = x7 + dh
|
|
4013
|
+
const x6 = r - (aw / 2)
|
|
4014
|
+
const y1 = t + ah
|
|
4015
|
+
const swAng = Math.atan(dx / ah)
|
|
4016
|
+
const dang2 = Math.atan((th / 2) / idy)
|
|
4017
|
+
const swAng2 = dang2 - swAng
|
|
4018
|
+
const stAng3 = Math.PI / 2 - swAng
|
|
4019
|
+
const stAng2 = Math.PI / 2 - dang2
|
|
4020
|
+
const stAng2dg = stAng2 * 180 / Math.PI
|
|
4021
|
+
const swAng2dg = swAng2 * 180 / Math.PI
|
|
4022
|
+
const stAng3dg = stAng3 * 180 / Math.PI
|
|
4023
|
+
const swAngDg = swAng * 180 / Math.PI
|
|
4024
|
+
pathData = `${shapeArc(wR, 0, wR, h, stAng2dg, stAng2dg + swAng2dg, false)} L ${x5},${y1} L ${x4},${y1} L ${x6},${t} L ${x8},${y1} L ${x7},${y1} ${shapeArc(x3, 0, wR, h, stAng3dg, stAng3dg + swAngDg, false).replace('M', 'L')} L ${wR},${b} ${shapeArc(wR, 0, wR, h, cd4, cd2, false).replace('M', 'L')} L ${th},${t} ${shapeArc(x3, 0, wR, h, cd2, cd4, false).replace('M', 'L')}`
|
|
4025
|
+
}
|
|
4026
|
+
break
|
|
4027
|
+
case 'mathDivide':
|
|
4028
|
+
case 'mathEqual':
|
|
4029
|
+
case 'mathMinus':
|
|
4030
|
+
case 'mathMultiply':
|
|
4031
|
+
case 'mathNotEqual':
|
|
4032
|
+
case 'mathPlus':
|
|
4033
|
+
{
|
|
4034
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
4035
|
+
let adj1, adj2, adj3
|
|
4036
|
+
if (shapAdjst_ary) {
|
|
4037
|
+
if (Array.isArray(shapAdjst_ary)) {
|
|
4038
|
+
for (const adj of shapAdjst_ary) {
|
|
4039
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
4040
|
+
if (sAdj_name === 'adj1') {
|
|
4041
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4))
|
|
4042
|
+
}
|
|
4043
|
+
else if (sAdj_name === 'adj2') {
|
|
4044
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4))
|
|
4045
|
+
}
|
|
4046
|
+
else if (sAdj_name === 'adj3') {
|
|
4047
|
+
adj3 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4))
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
else {
|
|
4052
|
+
adj1 = parseInt(getTextByPathList(shapAdjst_ary, ['attrs', 'fmla']).substring(4))
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
4056
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
4057
|
+
const cnstVal3 = 200000 * RATIO_EMUs_Points
|
|
4058
|
+
const hc = w / 2,
|
|
4059
|
+
vc = h / 2,
|
|
4060
|
+
hd2 = h / 2
|
|
4061
|
+
if (shapType === 'mathNotEqual') {
|
|
4062
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4063
|
+
if (adj2 === undefined) adj2 = 110 * 60000
|
|
4064
|
+
if (adj3 === undefined) adj3 = 11760
|
|
4065
|
+
adj1 *= RATIO_EMUs_Points
|
|
4066
|
+
adj2 = (adj2 / 60000) * Math.PI / 180
|
|
4067
|
+
adj3 *= RATIO_EMUs_Points
|
|
4068
|
+
const angVal1 = 70 * Math.PI / 180,
|
|
4069
|
+
angVal2 = 110 * Math.PI / 180
|
|
4070
|
+
const cnstVal4 = 73490 * RATIO_EMUs_Points
|
|
4071
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal1) ? cnstVal1 : adj1
|
|
4072
|
+
const crAng = (adj2 < angVal1) ? angVal1 : (adj2 > angVal2) ? angVal2 : adj2
|
|
4073
|
+
const maxAdj3 = cnstVal2 - (a1 * 2)
|
|
4074
|
+
const a3 = (adj3 < 0) ? 0 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
4075
|
+
const dy1 = h * a1 / cnstVal2
|
|
4076
|
+
const dy2 = h * a3 / cnstVal3
|
|
4077
|
+
const dx1 = w * cnstVal4 / cnstVal3
|
|
4078
|
+
const x1 = hc - dx1
|
|
4079
|
+
const x8 = hc + dx1
|
|
4080
|
+
const y2 = vc - dy2
|
|
4081
|
+
const y3 = vc + dy2
|
|
4082
|
+
const y1 = y2 - dy1
|
|
4083
|
+
const y4 = y3 + dy1
|
|
4084
|
+
const cadj2 = crAng - Math.PI / 2
|
|
4085
|
+
const xadj2 = hd2 * Math.tan(cadj2)
|
|
4086
|
+
const len = Math.sqrt(xadj2 * xadj2 + hd2 * hd2)
|
|
4087
|
+
const bhw = len * dy1 / hd2
|
|
4088
|
+
const bhw2 = bhw / 2
|
|
4089
|
+
const x7 = hc + xadj2 - bhw2
|
|
4090
|
+
const dx67 = xadj2 * y1 / hd2
|
|
4091
|
+
const x6 = x7 - dx67
|
|
4092
|
+
const dx57 = xadj2 * y2 / hd2
|
|
4093
|
+
const x5 = x7 - dx57
|
|
4094
|
+
const dx47 = xadj2 * y3 / hd2
|
|
4095
|
+
const x4 = x7 - dx47
|
|
4096
|
+
const dx37 = xadj2 * y4 / hd2
|
|
4097
|
+
const x3 = x7 - dx37
|
|
4098
|
+
const rx6 = x6 + bhw
|
|
4099
|
+
const rx5 = x5 + bhw
|
|
4100
|
+
const rx4 = x4 + bhw
|
|
4101
|
+
const rx3 = x3 + bhw
|
|
4102
|
+
const dx7 = dy1 * hd2 / len
|
|
4103
|
+
const rxt = x7 + dx7
|
|
4104
|
+
const lxt = (x7 + bhw) - dx7
|
|
4105
|
+
const rx = (cadj2 > 0) ? rxt : (x7 + bhw)
|
|
4106
|
+
const lx = (cadj2 > 0) ? x7 : lxt
|
|
4107
|
+
const dy3 = dy1 * xadj2 / len
|
|
4108
|
+
const ry = (cadj2 > 0) ? dy3 : 0
|
|
4109
|
+
const ly = (cadj2 > 0) ? 0 : -dy3
|
|
4110
|
+
const dlx = w - rx
|
|
4111
|
+
const drx = w - lx
|
|
4112
|
+
const dly = h - ry
|
|
4113
|
+
const dry = h - ly
|
|
4114
|
+
pathData = `M ${x1},${y1} L ${x6},${y1} L ${lx},${ly} L ${rx},${ry} L ${rx6},${y1} L ${x8},${y1} L ${x8},${y2} L ${rx5},${y2} L ${rx4},${y3} L ${x8},${y3} L ${x8},${y4} L ${rx3},${y4} L ${drx},${dry} L ${dlx},${dly} L ${x3},${y4} L ${x1},${y4} L ${x1},${y3} L ${x4},${y3} L ${x5},${y2} L ${x1},${y2} z`
|
|
4115
|
+
}
|
|
4116
|
+
else if (shapType === 'mathDivide') {
|
|
4117
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4118
|
+
if (adj2 === undefined) adj2 = 5880
|
|
4119
|
+
if (adj3 === undefined) adj3 = 11760
|
|
4120
|
+
adj1 *= RATIO_EMUs_Points
|
|
4121
|
+
adj2 *= RATIO_EMUs_Points
|
|
4122
|
+
adj3 *= RATIO_EMUs_Points
|
|
4123
|
+
const cnstVal4 = 1000 * RATIO_EMUs_Points
|
|
4124
|
+
const cnstVal5 = 36745 * RATIO_EMUs_Points
|
|
4125
|
+
const cnstVal6 = 73490 * RATIO_EMUs_Points
|
|
4126
|
+
const a1 = (adj1 < cnstVal4) ? cnstVal4 : (adj1 > cnstVal5) ? cnstVal5 : adj1
|
|
4127
|
+
const ma3h = (cnstVal6 - a1) / 4
|
|
4128
|
+
const ma3w = cnstVal5 * w / h
|
|
4129
|
+
const maxAdj3 = (ma3h < ma3w) ? ma3h : ma3w
|
|
4130
|
+
const a3 = (adj3 < cnstVal4) ? cnstVal4 : (adj3 > maxAdj3) ? maxAdj3 : adj3
|
|
4131
|
+
const maxAdj2 = cnstVal6 - (4 * a3) - a1
|
|
4132
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
4133
|
+
const dy1 = h * a1 / cnstVal3
|
|
4134
|
+
const yg = h * a2 / cnstVal2
|
|
4135
|
+
const rad = h * a3 / cnstVal2
|
|
4136
|
+
const dx1 = w * cnstVal6 / cnstVal3
|
|
4137
|
+
const y3 = vc - dy1
|
|
4138
|
+
const y4 = vc + dy1
|
|
4139
|
+
const y2 = y3 - (yg + rad)
|
|
4140
|
+
const y1 = y2 - rad
|
|
4141
|
+
const y5 = h - y1
|
|
4142
|
+
const x1 = hc - dx1
|
|
4143
|
+
const x3 = hc + dx1
|
|
4144
|
+
pathData = `M ${hc},${y1} A ${rad},${rad} 0 1,0 ${hc},${y1 + 2 * rad} A ${rad},${rad} 0 1,0 ${hc},${y1} z M ${hc},${y5} A ${rad},${rad} 0 1,1 ${hc},${y5 - 2 * rad} A ${rad},${rad} 0 1,1 ${hc},${y5} z M ${x1},${y3} L ${x3},${y3} L ${x3},${y4} L ${x1},${y4} z`
|
|
4145
|
+
}
|
|
4146
|
+
else if (shapType === 'mathEqual') {
|
|
4147
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4148
|
+
if (adj2 === undefined) adj2 = 11760
|
|
4149
|
+
adj1 *= RATIO_EMUs_Points
|
|
4150
|
+
adj2 *= RATIO_EMUs_Points
|
|
4151
|
+
const cnstVal5 = 36745 * RATIO_EMUs_Points
|
|
4152
|
+
const cnstVal6 = 73490 * RATIO_EMUs_Points
|
|
4153
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal5) ? cnstVal5 : adj1
|
|
4154
|
+
const mAdj2 = cnstVal2 - (a1 * 2)
|
|
4155
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > mAdj2) ? mAdj2 : adj2
|
|
4156
|
+
const dy1 = h * a1 / cnstVal2
|
|
4157
|
+
const dy2 = h * a2 / cnstVal3
|
|
4158
|
+
const dx1 = w * cnstVal6 / cnstVal3
|
|
4159
|
+
const y2 = vc - dy2
|
|
4160
|
+
const y3 = vc + dy2
|
|
4161
|
+
const y1 = y2 - dy1
|
|
4162
|
+
const y4 = y3 + dy1
|
|
4163
|
+
const x1 = hc - dx1
|
|
4164
|
+
const x2 = hc + dx1
|
|
4165
|
+
pathData = `M ${x1},${y1} L ${x2},${y1} L ${x2},${y2} L ${x1},${y2} z M ${x1},${y3} L ${x2},${y3} L ${x2},${y4} L ${x1},${y4} z`
|
|
4166
|
+
}
|
|
4167
|
+
else if (shapType === 'mathMinus') {
|
|
4168
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4169
|
+
adj1 *= RATIO_EMUs_Points
|
|
4170
|
+
const cnstVal6 = 73490 * RATIO_EMUs_Points
|
|
4171
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal2) ? cnstVal2 : adj1
|
|
4172
|
+
const dy1 = h * a1 / cnstVal3
|
|
4173
|
+
const dx1 = w * cnstVal6 / cnstVal3
|
|
4174
|
+
const y1 = vc - dy1
|
|
4175
|
+
const y2 = vc + dy1
|
|
4176
|
+
const x1 = hc - dx1
|
|
4177
|
+
const x2 = hc + dx1
|
|
4178
|
+
pathData = `M ${x1},${y1} L ${x2},${y1} L ${x2},${y2} L ${x1},${y2} z`
|
|
4179
|
+
}
|
|
4180
|
+
else if (shapType === 'mathMultiply') {
|
|
4181
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4182
|
+
adj1 *= RATIO_EMUs_Points
|
|
4183
|
+
const cnstVal6 = 51965 * RATIO_EMUs_Points
|
|
4184
|
+
const ss = Math.min(w, h)
|
|
4185
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal6) ? cnstVal6 : adj1
|
|
4186
|
+
const th = ss * a1 / cnstVal2
|
|
4187
|
+
const a = Math.atan(h / w)
|
|
4188
|
+
const sa = Math.sin(a)
|
|
4189
|
+
const ca = Math.cos(a)
|
|
4190
|
+
const ta = Math.tan(a)
|
|
4191
|
+
const dl = Math.sqrt(w * w + h * h)
|
|
4192
|
+
const lM = dl - (dl * cnstVal6 / cnstVal2)
|
|
4193
|
+
const xM = ca * lM / 2
|
|
4194
|
+
const yM = sa * lM / 2
|
|
4195
|
+
const dxAM = sa * th / 2
|
|
4196
|
+
const dyAM = ca * th / 2
|
|
4197
|
+
const xA = xM - dxAM
|
|
4198
|
+
const yA = yM + dyAM
|
|
4199
|
+
const xB = xM + dxAM
|
|
4200
|
+
const yB = yM - dyAM
|
|
4201
|
+
const yC = (hc - xB) * ta + yB
|
|
4202
|
+
const xD = w - xB
|
|
4203
|
+
const xE = w - xA
|
|
4204
|
+
const xF = xE - ((vc - yA) / ta)
|
|
4205
|
+
const xL = xA + ((vc - yA) / ta)
|
|
4206
|
+
const yG = h - yA
|
|
4207
|
+
const yH = h - yB
|
|
4208
|
+
const yI = h - yC
|
|
4209
|
+
pathData = `M ${xA},${yA} L ${xB},${yB} L ${hc},${yC} L ${xD},${yB} L ${xE},${yA} L ${xF},${vc} L ${xE},${yG} L ${xD},${yH} L ${hc},${yI} L ${xB},${yH} L ${xA},${yG} L ${xL},${vc} z`
|
|
4210
|
+
}
|
|
4211
|
+
else if (shapType === 'mathPlus') {
|
|
4212
|
+
if (adj1 === undefined) adj1 = 23520
|
|
4213
|
+
adj1 *= RATIO_EMUs_Points
|
|
4214
|
+
const cnstVal6 = 73490 * RATIO_EMUs_Points
|
|
4215
|
+
const ss = Math.min(w, h)
|
|
4216
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > cnstVal6) ? cnstVal6 : adj1
|
|
4217
|
+
const dx1 = w * cnstVal6 / cnstVal3
|
|
4218
|
+
const dy1 = h * cnstVal6 / cnstVal3
|
|
4219
|
+
const dx2 = ss * a1 / cnstVal3
|
|
4220
|
+
const x1 = hc - dx1
|
|
4221
|
+
const x2 = hc - dx2
|
|
4222
|
+
const x3 = hc + dx2
|
|
4223
|
+
const x4 = hc + dx1
|
|
4224
|
+
const y1 = vc - dy1
|
|
4225
|
+
const y2 = vc - dx2
|
|
4226
|
+
const y3 = vc + dx2
|
|
4227
|
+
const y4 = vc + dy1
|
|
4228
|
+
pathData = `M ${x1},${y2} L ${x2},${y2} L ${x2},${y1} L ${x3},${y1} L ${x3},${y2} L ${x4},${y2} L ${x4},${y3} L ${x3},${y3} L ${x3},${y4} L ${x2},${y4} L ${x2},${y3} L ${x1},${y3} z`
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
4231
|
+
break
|
|
4232
|
+
case 'can':
|
|
4233
|
+
case 'flowChartMagneticDisk':
|
|
4234
|
+
case 'flowChartMagneticDrum':
|
|
4235
|
+
{
|
|
4236
|
+
const shapAdjst = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd', 'attrs', 'fmla'])
|
|
4237
|
+
let adj = 25000 * RATIO_EMUs_Points
|
|
4238
|
+
const cnstVal1 = 50000 * RATIO_EMUs_Points
|
|
4239
|
+
const cnstVal2 = 200000 * RATIO_EMUs_Points
|
|
4240
|
+
if (shapAdjst) {
|
|
4241
|
+
adj = parseInt(shapAdjst.substring(4)) * RATIO_EMUs_Points
|
|
4242
|
+
}
|
|
4243
|
+
if (shapType === 'flowChartMagneticDisk' || shapType === 'flowChartMagneticDrum') {
|
|
4244
|
+
adj = 50000 * RATIO_EMUs_Points
|
|
4245
|
+
}
|
|
4246
|
+
const ss = Math.min(w, h)
|
|
4247
|
+
const maxAdj = cnstVal1 * h / ss
|
|
4248
|
+
const a = (adj < 0) ? 0 : (adj > maxAdj) ? maxAdj : adj
|
|
4249
|
+
const y1 = ss * a / cnstVal2
|
|
4250
|
+
const y3 = h - y1
|
|
4251
|
+
const cd2 = 180,
|
|
4252
|
+
wd2 = w / 2
|
|
4253
|
+
let dVal = `${shapeArc(wd2, y1, wd2, y1, 0, cd2, false)} ${shapeArc(wd2, y1, wd2, y1, cd2, cd2 + cd2, false).replace('M', 'L')} L ${w},${y3} ${shapeArc(wd2, y3, wd2, y1, 0, cd2, false).replace('M', 'L')} L 0,${y1}`
|
|
4254
|
+
|
|
4255
|
+
if (shapType === 'flowChartMagneticDrum') {
|
|
4256
|
+
dVal = dVal.replace(/([MLQC])\s*([-\d.e]+)\s*([-\d.e]+)/gi, (match, command, x, y) => {
|
|
4257
|
+
const newX = w / 2 - (parseFloat(y) - h / 2)
|
|
4258
|
+
const newY = h / 2 + (parseFloat(x) - w / 2)
|
|
4259
|
+
return `${command}${newX} ${newY}`
|
|
4260
|
+
}).replace(/([MLQC])\s*([-\d.e]+)\s*([-\d.e]+)\s*([-\d.e]+)\s*([-\d.e]+)/gi, (match, command, c1x, c1y, x, y) => {
|
|
4261
|
+
const newC1X = w / 2 - (parseFloat(c1y) - h / 2)
|
|
4262
|
+
const newC1Y = h / 2 + (parseFloat(c1x) - w / 2)
|
|
4263
|
+
const newX = w / 2 - (parseFloat(y) - h / 2)
|
|
4264
|
+
const newY = h / 2 + (parseFloat(x) - w / 2)
|
|
4265
|
+
return `${command}${newC1X} ${newC1Y} ${newX} ${newY}`
|
|
4266
|
+
})
|
|
4267
|
+
}
|
|
4268
|
+
pathData = dVal
|
|
4269
|
+
}
|
|
4270
|
+
break
|
|
4271
|
+
case 'swooshArrow':
|
|
4272
|
+
{
|
|
4273
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
4274
|
+
const refr = RATIO_EMUs_Points
|
|
4275
|
+
let adj1 = 25000 * refr
|
|
4276
|
+
let adj2 = 16667 * refr
|
|
4277
|
+
if (shapAdjst_ary) {
|
|
4278
|
+
for (const adj of shapAdjst_ary) {
|
|
4279
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
4280
|
+
if (sAdj_name === 'adj1') {
|
|
4281
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
4282
|
+
}
|
|
4283
|
+
else if (sAdj_name === 'adj2') {
|
|
4284
|
+
adj2 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * refr
|
|
4285
|
+
}
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4288
|
+
const cnstVal1 = 1 * refr
|
|
4289
|
+
const cnstVal2 = 70000 * refr
|
|
4290
|
+
const cnstVal3 = 75000 * refr
|
|
4291
|
+
const cnstVal4 = 100000 * refr
|
|
4292
|
+
const ss = Math.min(w, h)
|
|
4293
|
+
const ssd8 = ss / 8
|
|
4294
|
+
const hd6 = h / 6
|
|
4295
|
+
const a1 = (adj1 < cnstVal1) ? cnstVal1 : (adj1 > cnstVal3) ? cnstVal3 : adj1
|
|
4296
|
+
const maxAdj2 = cnstVal2 * w / ss
|
|
4297
|
+
const a2 = (adj2 < 0) ? 0 : (adj2 > maxAdj2) ? maxAdj2 : adj2
|
|
4298
|
+
const ad1 = h * a1 / cnstVal4
|
|
4299
|
+
const ad2 = ss * a2 / cnstVal4
|
|
4300
|
+
const xB = w - ad2
|
|
4301
|
+
const yB = ssd8
|
|
4302
|
+
const alfa = (Math.PI / 2) / 14
|
|
4303
|
+
const dx0 = ssd8 * Math.tan(alfa)
|
|
4304
|
+
const xC = xB - dx0
|
|
4305
|
+
const dx1 = ad1 * Math.tan(alfa)
|
|
4306
|
+
const yF = yB + ad1
|
|
4307
|
+
const xF = xB + dx1
|
|
4308
|
+
const xE = xF + dx0
|
|
4309
|
+
const yE = yF + ssd8
|
|
4310
|
+
const dy22 = yE / 2
|
|
4311
|
+
const dy3 = h / 20
|
|
4312
|
+
const yD = dy22 - dy3
|
|
4313
|
+
const yP1 = hd6 + (hd6)
|
|
4314
|
+
const xP1 = w / 6
|
|
4315
|
+
const yP2 = yF + (hd6 / 2)
|
|
4316
|
+
const xP2 = w / 4
|
|
4317
|
+
pathData = `M 0,${h} Q ${xP1},${yP1} ${xB},${yB} L ${xC},0 L ${w},${yD} L ${xE},${yE} L ${xF},${yF} Q ${xP2},${yP2} 0,${h} z`
|
|
4318
|
+
}
|
|
4319
|
+
break
|
|
4320
|
+
case 'circularArrow':
|
|
4321
|
+
{
|
|
4322
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
4323
|
+
let adj1 = 12500 * RATIO_EMUs_Points
|
|
4324
|
+
let adj2 = (1142319 / 60000) * Math.PI / 180
|
|
4325
|
+
let adj3 = (20457681 / 60000) * Math.PI / 180
|
|
4326
|
+
let adj4 = (10800000 / 60000) * Math.PI / 180
|
|
4327
|
+
let adj5 = 12500 * RATIO_EMUs_Points
|
|
4328
|
+
if (shapAdjst_ary) {
|
|
4329
|
+
for (const adj of shapAdjst_ary) {
|
|
4330
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
4331
|
+
if (sAdj_name === 'adj1') {
|
|
4332
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
4333
|
+
}
|
|
4334
|
+
else if (sAdj_name === 'adj2') {
|
|
4335
|
+
adj2 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4336
|
+
}
|
|
4337
|
+
else if (sAdj_name === 'adj3') {
|
|
4338
|
+
adj3 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4339
|
+
}
|
|
4340
|
+
else if (sAdj_name === 'adj4') {
|
|
4341
|
+
adj4 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4342
|
+
}
|
|
4343
|
+
else if (sAdj_name === 'adj5') {
|
|
4344
|
+
adj5 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
const hc = w / 2,
|
|
4349
|
+
vc = h / 2,
|
|
4350
|
+
wd2 = w / 2,
|
|
4351
|
+
hd2 = h / 2
|
|
4352
|
+
const ss = Math.min(w, h)
|
|
4353
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
4354
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
4355
|
+
const rdAngVal1 = (1 / 60000) * Math.PI / 180
|
|
4356
|
+
const rdAngVal2 = (21599999 / 60000) * Math.PI / 180
|
|
4357
|
+
const rdAngVal3 = 2 * Math.PI
|
|
4358
|
+
const a5 = (adj5 < 0) ? 0 : (adj5 > cnstVal1) ? cnstVal1 : adj5
|
|
4359
|
+
const maxAdj1 = a5 * 2
|
|
4360
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
4361
|
+
const enAng = (adj3 < rdAngVal1) ? rdAngVal1 : (adj3 > rdAngVal2) ? rdAngVal2 : adj3
|
|
4362
|
+
const stAng = (adj4 < 0) ? 0 : (adj4 > rdAngVal2) ? rdAngVal2 : adj4
|
|
4363
|
+
const th = ss * a1 / cnstVal2
|
|
4364
|
+
const thh = ss * a5 / cnstVal2
|
|
4365
|
+
const th2 = th / 2
|
|
4366
|
+
const rw1 = wd2 + th2 - thh
|
|
4367
|
+
const rh1 = hd2 + th2 - thh
|
|
4368
|
+
const rw2 = rw1 - th
|
|
4369
|
+
const rh2 = rh1 - th
|
|
4370
|
+
const rw3 = rw2 + th2
|
|
4371
|
+
const rh3 = rh2 + th2
|
|
4372
|
+
const wtH = rw3 * Math.sin(enAng)
|
|
4373
|
+
const htH = rh3 * Math.cos(enAng)
|
|
4374
|
+
const dxH = rw3 * Math.cos(Math.atan2(wtH, htH))
|
|
4375
|
+
const dyH = rh3 * Math.sin(Math.atan2(wtH, htH))
|
|
4376
|
+
const xH = hc + dxH
|
|
4377
|
+
const yH = vc + dyH
|
|
4378
|
+
const rI = Math.min(rw2, rh2)
|
|
4379
|
+
const u8 = 1 - (((dxH * dxH - rI * rI) * (dyH * dyH - rI * rI)) / (dxH * dxH * dyH * dyH))
|
|
4380
|
+
const u9 = Math.sqrt(u8)
|
|
4381
|
+
const u12 = (1 + u9) / (((dxH * dxH - rI * rI) / dxH) / dyH)
|
|
4382
|
+
const u15 = Math.atan2(u12, 1) > 0 ? Math.atan2(u12, 1) : Math.atan2(u12, 1) + rdAngVal3
|
|
4383
|
+
const u18 = (u15 - enAng > 0) ? u15 - enAng : u15 - enAng + rdAngVal3
|
|
4384
|
+
const u21 = (u18 - Math.PI > 0) ? u18 - rdAngVal3 : u18
|
|
4385
|
+
const maxAng = Math.abs(u21)
|
|
4386
|
+
const aAng = (adj2 < 0) ? 0 : (adj2 > maxAng) ? maxAng : adj2
|
|
4387
|
+
const ptAng = enAng + aAng
|
|
4388
|
+
const wtA = rw3 * Math.sin(ptAng)
|
|
4389
|
+
const htA = rh3 * Math.cos(ptAng)
|
|
4390
|
+
const dxA = rw3 * Math.cos(Math.atan2(wtA, htA))
|
|
4391
|
+
const dyA = rh3 * Math.sin(Math.atan2(wtA, htA))
|
|
4392
|
+
const xA = hc + dxA
|
|
4393
|
+
const yA = vc + dyA
|
|
4394
|
+
const dxG = thh * Math.cos(ptAng)
|
|
4395
|
+
const dyG = thh * Math.sin(ptAng)
|
|
4396
|
+
const xG = xH + dxG
|
|
4397
|
+
const yG = yH + dyG
|
|
4398
|
+
const dxB = thh * Math.cos(ptAng)
|
|
4399
|
+
const dyB = thh * Math.sin(ptAng)
|
|
4400
|
+
const xB = xH - dxB
|
|
4401
|
+
const yB = yH - dyB
|
|
4402
|
+
const sx1 = xB - hc
|
|
4403
|
+
const sy1 = yB - vc
|
|
4404
|
+
const sx2 = xG - hc
|
|
4405
|
+
const sy2 = yG - vc
|
|
4406
|
+
const rO = Math.min(rw1, rh1)
|
|
4407
|
+
const x1O = sx1 * rO / rw1
|
|
4408
|
+
const y1O = sy1 * rO / rh1
|
|
4409
|
+
const x2O = sx2 * rO / rw1
|
|
4410
|
+
const y2O = sy2 * rO / rh1
|
|
4411
|
+
const dxO = x2O - x1O
|
|
4412
|
+
const dyO = y2O - y1O
|
|
4413
|
+
const dO = Math.sqrt(dxO * dxO + dyO * dyO)
|
|
4414
|
+
const DO = x1O * y2O - x2O * y1O
|
|
4415
|
+
const sdelO = Math.sqrt(Math.max(0, rO * rO * dO * dO - DO * DO))
|
|
4416
|
+
const sdyO = (dyO * -1 > 0) ? -1 : 1
|
|
4417
|
+
const dxF1 = (DO * dyO + sdyO * dxO * sdelO) / (dO * dO)
|
|
4418
|
+
const dxF2 = (DO * dyO - sdyO * dxO * sdelO) / (dO * dO)
|
|
4419
|
+
const dyF1 = (-DO * dxO + Math.abs(dyO) * sdelO) / (dO * dO)
|
|
4420
|
+
const dyF2 = (-DO * dxO - Math.abs(dyO) * sdelO) / (dO * dO)
|
|
4421
|
+
const q22 = Math.sqrt((x2O - dxF2) ** 2 + (y2O - dyF2) ** 2) - Math.sqrt((x2O - dxF1) ** 2 + (y2O - dyF1) ** 2)
|
|
4422
|
+
const dxF = (q22 > 0) ? dxF1 : dxF2
|
|
4423
|
+
const dyF = (q22 > 0) ? dyF1 : dyF2
|
|
4424
|
+
const xF = hc + (dxF * rw1 / rO)
|
|
4425
|
+
const yF = vc + (dyF * rh1 / rO)
|
|
4426
|
+
const x1I = sx1 * rI / rw2
|
|
4427
|
+
const y1I = sy1 * rI / rh2
|
|
4428
|
+
const x2I = sx2 * rI / rw2
|
|
4429
|
+
const y2I = sy2 * rI / rh2
|
|
4430
|
+
const dxI = x2I - x1I
|
|
4431
|
+
const dyI = y2I - y1I
|
|
4432
|
+
const dI = Math.sqrt(dxI * dxI + dyI * dyI)
|
|
4433
|
+
const DI = x1I * y2I - x2I * y1I
|
|
4434
|
+
const sdelI = Math.sqrt(Math.max(0, rI * rI * dI * dI - DI * DI))
|
|
4435
|
+
const dxC1 = (DI * dyI + sdyO * dxI * sdelI) / (dI * dI)
|
|
4436
|
+
const dxC2 = (DI * dyI - sdyO * dxI * sdelI) / (dI * dI)
|
|
4437
|
+
const dyC1 = (-DI * dxI + Math.abs(dyI) * sdelI) / (dI * dI)
|
|
4438
|
+
const dyC2 = (-DI * dxI - Math.abs(dyI) * sdelI) / (dI * dI)
|
|
4439
|
+
const v22 = Math.sqrt((x1I - dxC2) ** 2 + (y1I - dyC2) ** 2) - Math.sqrt((x1I - dxC1) ** 2 + (y1I - dyC1) ** 2)
|
|
4440
|
+
const dxC = (v22 > 0) ? dxC1 : dxC2
|
|
4441
|
+
const dyC = (v22 > 0) ? dyC1 : dyC2
|
|
4442
|
+
const xC = hc + (dxC * rw2 / rI)
|
|
4443
|
+
const yC = vc + (dyC * rh2 / rI)
|
|
4444
|
+
const ist0 = Math.atan2(dyC * rh2 / rI, dxC * rw2 / rI)
|
|
4445
|
+
const istAng = (ist0 > 0) ? ist0 : ist0 + rdAngVal3
|
|
4446
|
+
const isw1 = stAng - istAng
|
|
4447
|
+
const iswAng = (isw1 > 0) ? isw1 - rdAngVal3 : isw1
|
|
4448
|
+
const p5 = Math.sqrt((xF - xC) ** 2 + (yF - yC) ** 2) / 2 - thh
|
|
4449
|
+
const xGp = (p5 > 0) ? xF : xG
|
|
4450
|
+
const yGp = (p5 > 0) ? yF : yG
|
|
4451
|
+
const xBp = (p5 > 0) ? xC : xB
|
|
4452
|
+
const yBp = (p5 > 0) ? yC : yB
|
|
4453
|
+
const en0 = Math.atan2((yF - vc), (xF - hc))
|
|
4454
|
+
const en2 = (en0 > 0) ? en0 : en0 + rdAngVal3
|
|
4455
|
+
const sw0 = en2 - stAng
|
|
4456
|
+
const swAng = (sw0 > 0) ? sw0 : sw0 + rdAngVal3
|
|
4457
|
+
const strtAng = stAng * 180 / Math.PI
|
|
4458
|
+
const endAngVal = strtAng + (swAng * 180 / Math.PI)
|
|
4459
|
+
const stiAng = istAng * 180 / Math.PI
|
|
4460
|
+
const ediAng = stiAng + (iswAng * 180 / Math.PI)
|
|
4461
|
+
pathData = `${shapeArc(w / 2, h / 2, rw1, rh1, strtAng, endAngVal, false)} L ${xGp},${yGp} L ${xA},${yA} L ${xBp},${yBp} L ${xC},${yC} ${shapeArc(w / 2, h / 2, rw2, rh2, stiAng, ediAng, false).replace('M', 'L')} z`
|
|
4462
|
+
}
|
|
4463
|
+
break
|
|
4464
|
+
case 'leftCircularArrow':
|
|
4465
|
+
{
|
|
4466
|
+
const shapAdjst_ary = getTextByPathList(node, ['p:spPr', 'a:prstGeom', 'a:avLst', 'a:gd'])
|
|
4467
|
+
let adj1 = 12500 * RATIO_EMUs_Points
|
|
4468
|
+
let adj2 = (-1142319 / 60000) * Math.PI / 180
|
|
4469
|
+
let adj3 = (1142319 / 60000) * Math.PI / 180
|
|
4470
|
+
let adj4 = (10800000 / 60000) * Math.PI / 180
|
|
4471
|
+
let adj5 = 12500 * RATIO_EMUs_Points
|
|
4472
|
+
if (shapAdjst_ary) {
|
|
4473
|
+
for (const adj of shapAdjst_ary) {
|
|
4474
|
+
const sAdj_name = getTextByPathList(adj, ['attrs', 'name'])
|
|
4475
|
+
if (sAdj_name === 'adj1') {
|
|
4476
|
+
adj1 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
4477
|
+
}
|
|
4478
|
+
else if (sAdj_name === 'adj2') {
|
|
4479
|
+
adj2 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4480
|
+
}
|
|
4481
|
+
else if (sAdj_name === 'adj3') {
|
|
4482
|
+
adj3 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4483
|
+
}
|
|
4484
|
+
else if (sAdj_name === 'adj4') {
|
|
4485
|
+
adj4 = (parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) / 60000) * Math.PI / 180
|
|
4486
|
+
}
|
|
4487
|
+
else if (sAdj_name === 'adj5') {
|
|
4488
|
+
adj5 = parseInt(getTextByPathList(adj, ['attrs', 'fmla']).substring(4)) * RATIO_EMUs_Points
|
|
4489
|
+
}
|
|
4490
|
+
}
|
|
4491
|
+
}
|
|
4492
|
+
const hc = w / 2,
|
|
4493
|
+
vc = h / 2,
|
|
4494
|
+
wd2 = w / 2,
|
|
4495
|
+
hd2 = h / 2
|
|
4496
|
+
const ss = Math.min(w, h)
|
|
4497
|
+
const cnstVal1 = 25000 * RATIO_EMUs_Points
|
|
4498
|
+
const cnstVal2 = 100000 * RATIO_EMUs_Points
|
|
4499
|
+
const rdAngVal1 = (1 / 60000) * Math.PI / 180
|
|
4500
|
+
const rdAngVal2 = (21599999 / 60000) * Math.PI / 180
|
|
4501
|
+
const rdAngVal3 = 2 * Math.PI
|
|
4502
|
+
const a5 = (adj5 < 0) ? 0 : (adj5 > cnstVal1) ? cnstVal1 : adj5
|
|
4503
|
+
const maxAdj1 = a5 * 2
|
|
4504
|
+
const a1 = (adj1 < 0) ? 0 : (adj1 > maxAdj1) ? maxAdj1 : adj1
|
|
4505
|
+
const enAng = (adj3 < rdAngVal1) ? rdAngVal1 : (adj3 > rdAngVal2) ? rdAngVal2 : adj3
|
|
4506
|
+
const stAng = (adj4 < 0) ? 0 : (adj4 > rdAngVal2) ? rdAngVal2 : adj4
|
|
4507
|
+
const th = ss * a1 / cnstVal2
|
|
4508
|
+
const thh = ss * a5 / cnstVal2
|
|
4509
|
+
const th2 = th / 2
|
|
4510
|
+
const rw1 = wd2 + th2 - thh
|
|
4511
|
+
const rh1 = hd2 + th2 - thh
|
|
4512
|
+
const rw2 = rw1 - th
|
|
4513
|
+
const rh2 = rh1 - th
|
|
4514
|
+
const rw3 = rw2 + th2
|
|
4515
|
+
const rh3 = rh2 + th2
|
|
4516
|
+
const dxH = rw3 * Math.cos(enAng)
|
|
4517
|
+
const dyH = rh3 * Math.sin(enAng)
|
|
4518
|
+
const xH = hc + dxH
|
|
4519
|
+
const yH = vc + dyH
|
|
4520
|
+
const rI = Math.min(rw2, rh2)
|
|
4521
|
+
const u8 = 1 - (((dxH * dxH - rI * rI) * (dyH * dyH - rI * rI)) / (dxH * dxH * dyH * dyH))
|
|
4522
|
+
const u9 = Math.sqrt(u8)
|
|
4523
|
+
const u12 = (1 + u9) / (((dxH * dxH - rI * rI) / dxH) / dyH)
|
|
4524
|
+
const u15 = Math.atan2(u12, 1) > 0 ? Math.atan2(u12, 1) : Math.atan2(u12, 1) + rdAngVal3
|
|
4525
|
+
const u18 = (u15 - enAng > 0) ? u15 - enAng : u15 - enAng + rdAngVal3
|
|
4526
|
+
const u21 = (u18 - Math.PI > 0) ? u18 - rdAngVal3 : u18
|
|
4527
|
+
const minAng = -Math.abs(u21)
|
|
4528
|
+
const aAng = (adj2 < minAng) ? minAng : (adj2 > 0) ? 0 : adj2
|
|
4529
|
+
const ptAng = enAng + aAng
|
|
4530
|
+
const dxA = rw3 * Math.cos(ptAng)
|
|
4531
|
+
const dyA = rh3 * Math.sin(ptAng)
|
|
4532
|
+
const xA = hc + dxA
|
|
4533
|
+
const yA = vc + dyA
|
|
4534
|
+
const dxE = rw1 * Math.cos(stAng)
|
|
4535
|
+
const dyE = rh1 * Math.sin(stAng)
|
|
4536
|
+
const xE = hc + dxE
|
|
4537
|
+
const yE = vc + dyE
|
|
4538
|
+
const dxD = rw2 * Math.cos(stAng)
|
|
4539
|
+
const dyD = rh2 * Math.sin(stAng)
|
|
4540
|
+
const xD = hc + dxD
|
|
4541
|
+
const yD = vc + dyD
|
|
4542
|
+
const dxG = thh * Math.cos(ptAng)
|
|
4543
|
+
const dyG = thh * Math.sin(ptAng)
|
|
4544
|
+
const xG = xH + dxG
|
|
4545
|
+
const yG = yH + dyG
|
|
4546
|
+
const dxB = thh * Math.cos(ptAng)
|
|
4547
|
+
const dyB = thh * Math.sin(ptAng)
|
|
4548
|
+
const xB = xH - dxB
|
|
4549
|
+
const yB = yH - dyB
|
|
4550
|
+
const sx1 = xB - hc
|
|
4551
|
+
const sy1 = yB - vc
|
|
4552
|
+
const sx2 = xG - hc
|
|
4553
|
+
const sy2 = yG - vc
|
|
4554
|
+
const rO = Math.min(rw1, rh1)
|
|
4555
|
+
const x1O = sx1 * rO / rw1
|
|
4556
|
+
const y1O = sy1 * rO / rh1
|
|
4557
|
+
const x2O = sx2 * rO / rw1
|
|
4558
|
+
const y2O = sy2 * rO / rh1
|
|
4559
|
+
const dxO = x2O - x1O
|
|
4560
|
+
const dyO = y2O - y1O
|
|
4561
|
+
const dO = Math.sqrt(dxO * dxO + dyO * dyO)
|
|
4562
|
+
const DO = x1O * y2O - x2O * y1O
|
|
4563
|
+
const sdelO = Math.sqrt(Math.max(0, rO * rO * dO * dO - DO * DO))
|
|
4564
|
+
const sdyO = (dyO * -1 > 0) ? -1 : 1
|
|
4565
|
+
const dxF1 = (DO * dyO + sdyO * dxO * sdelO) / (dO * dO)
|
|
4566
|
+
const dxF2 = (DO * dyO - sdyO * dxO * sdelO) / (dO * dO)
|
|
4567
|
+
const dyF1 = (-DO * dxO + Math.abs(dyO) * sdelO) / (dO * dO)
|
|
4568
|
+
const dyF2 = (-DO * dxO - Math.abs(dyO) * sdelO) / (dO * dO)
|
|
4569
|
+
const q22 = Math.sqrt((x2O - dxF2) ** 2 + (y2O - dyF2) ** 2) - Math.sqrt((x2O - dxF1) ** 2 + (y2O - dyF1) ** 2)
|
|
4570
|
+
const dxF = (q22 > 0) ? dxF1 : dxF2
|
|
4571
|
+
const dyF = (q22 > 0) ? dyF1 : dyF2
|
|
4572
|
+
const xF = hc + (dxF * rw1 / rO)
|
|
4573
|
+
const yF = vc + (dyF * rh1 / rO)
|
|
4574
|
+
const x1I = sx1 * rI / rw2
|
|
4575
|
+
const y1I = sy1 * rI / rh2
|
|
4576
|
+
const x2I = sx2 * rI / rw2
|
|
4577
|
+
const y2I = sy2 * rI / rh2
|
|
4578
|
+
const dxI = x2I - x1I
|
|
4579
|
+
const dyI = y2I - y1I
|
|
4580
|
+
const dI = Math.sqrt(dxI * dxI + dyI * dyI)
|
|
4581
|
+
const DI = x1I * y2I - x2I * y1I
|
|
4582
|
+
const sdelI = Math.sqrt(Math.max(0, rI * rI * dI * dI - DI * DI))
|
|
4583
|
+
const dxC1 = (DI * dyI + sdyO * dxI * sdelI) / (dI * dI)
|
|
4584
|
+
const dxC2 = (DI * dyI - sdyO * dxI * sdelI) / (dI * dI)
|
|
4585
|
+
const dyC1 = (-DI * dxI + Math.abs(dyI) * sdelI) / (dI * dI)
|
|
4586
|
+
const dyC2 = (-DI * dxI - Math.abs(dyI) * sdelI) / (dI * dI)
|
|
4587
|
+
const v22 = Math.sqrt((x1I - dxC2) ** 2 + (y1I - dyC2) ** 2) - Math.sqrt((x1I - dxC1) ** 2 + (y1I - dyC1) ** 2)
|
|
4588
|
+
const dxC = (v22 > 0) ? dxC1 : dxC2
|
|
4589
|
+
const dyC = (v22 > 0) ? dyC1 : dyC2
|
|
4590
|
+
const xC = hc + (dxC * rw2 / rI)
|
|
4591
|
+
const yC = vc + (dyC * rh2 / rI)
|
|
4592
|
+
const ist0 = Math.atan2(dyC * rh2 / rI, dxC * rw2 / rI)
|
|
4593
|
+
const istAng0 = (ist0 > 0) ? ist0 : ist0 + rdAngVal3
|
|
4594
|
+
const isw1 = stAng - istAng0
|
|
4595
|
+
const iswAng0 = (isw1 > 0) ? isw1 : isw1 + rdAngVal3
|
|
4596
|
+
const istAng = istAng0 + iswAng0
|
|
4597
|
+
const iswAng = -iswAng0
|
|
4598
|
+
const p5 = Math.sqrt((xF - xC) ** 2 + (yF - yC) ** 2) / 2 - thh
|
|
4599
|
+
const xGp = (p5 > 0) ? xF : xG
|
|
4600
|
+
const yGp = (p5 > 0) ? yF : yG
|
|
4601
|
+
const xBp = (p5 > 0) ? xC : xB
|
|
4602
|
+
const yBp = (p5 > 0) ? yC : yB
|
|
4603
|
+
const en0 = Math.atan2((yF - vc), (xF - hc))
|
|
4604
|
+
const en2 = (en0 > 0) ? en0 : en0 + rdAngVal3
|
|
4605
|
+
const sw0 = en2 - stAng
|
|
4606
|
+
const swAng = (sw0 > 0) ? sw0 - rdAngVal3 : sw0
|
|
4607
|
+
const stAng0 = stAng + swAng
|
|
4608
|
+
const strtAng = stAng0 * 180 / Math.PI
|
|
4609
|
+
const endAngVal = stAng * 180 / Math.PI
|
|
4610
|
+
const stiAng = istAng * 180 / Math.PI
|
|
4611
|
+
const ediAng = stiAng + (iswAng * 180 / Math.PI)
|
|
4612
|
+
pathData = `M ${xE},${yE} L ${xD},${yD} ${shapeArc(w / 2, h / 2, rw2, rh2, stiAng, ediAng, false).replace('M', 'L')} L ${xBp},${yBp} L ${xA},${yA} L ${xGp},${yGp} L ${xF},${yF} ${shapeArc(w / 2, h / 2, rw1, rh1, strtAng, endAngVal, false).replace('M', 'L')} z`
|
|
4613
|
+
}
|
|
4614
|
+
break
|
|
4615
|
+
case 'leftRightCircularArrow':
|
|
4616
|
+
case 'chartPlus':
|
|
4617
|
+
case 'chartStar':
|
|
4618
|
+
case 'chartX':
|
|
4619
|
+
case 'cornerTabs':
|
|
4620
|
+
case 'flowChartOfflineStorage':
|
|
4621
|
+
case 'folderCorner':
|
|
4622
|
+
case 'funnel':
|
|
4623
|
+
case 'lineInv':
|
|
4624
|
+
case 'nonIsoscelesTrapezoid':
|
|
4625
|
+
case 'plaqueTabs':
|
|
4626
|
+
case 'squareTabs':
|
|
4627
|
+
case 'upDownArrowCallout':
|
|
4628
|
+
pathData = `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z`
|
|
4629
|
+
break
|
|
4630
|
+
default:
|
|
4631
|
+
pathData = `M 0 0 L ${w} 0 L ${w} ${h} L 0 ${h} Z`
|
|
4632
|
+
}
|
|
4633
|
+
|
|
4634
|
+
return pathData
|
|
4635
|
+
}
|