@p10node/diagram 0.9.0 → 0.12.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/dist/index.js +71 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -347,36 +347,61 @@ function e(e, t, n, r) {
|
|
|
347
347
|
i.push({
|
|
348
348
|
x: Z.get(`${r[r.length - 1]}:t:${n}`) ?? s.x,
|
|
349
349
|
y: s.y - C[r[r.length - 1]] / 2
|
|
350
|
-
}), a.push(!1)
|
|
351
|
-
let l = [];
|
|
352
|
-
for (let e = 1; e <
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
}), a.push(!1);
|
|
351
|
+
let l = i.length, u = Array(l).fill(0), d = (e) => (i[e + 1].x - i[e].x) / Math.max(.5, i[e + 1].y - i[e].y);
|
|
352
|
+
for (let e = 1; e + 1 < l; e++) {
|
|
353
|
+
if (a[e - 1] || a[e]) continue;
|
|
354
|
+
let t = d(e - 1), n = d(e);
|
|
355
|
+
if (t * n <= 0) continue;
|
|
356
|
+
let r = i[e].y - i[e - 1].y, o = i[e + 1].y - i[e].y;
|
|
357
|
+
u[e] = 3 * (r + o) / ((2 * o + r) / t + (o + 2 * r) / n);
|
|
358
|
+
}
|
|
359
|
+
let f = [];
|
|
360
|
+
for (let e = 1; e < l; e++) {
|
|
361
|
+
let t = i[e - 1], n = i[e], r = (n.y - t.y) / 3;
|
|
362
|
+
a[e - 1] || Math.abs(t.x - n.x) < .5 && !u[e - 1] && !u[e] ? f.push({
|
|
355
363
|
c: "L",
|
|
356
364
|
p: [n]
|
|
365
|
+
}) : f.push({
|
|
366
|
+
c: "C",
|
|
367
|
+
p: [
|
|
368
|
+
{
|
|
369
|
+
x: t.x + u[e - 1] * r,
|
|
370
|
+
y: t.y + r
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
x: n.x - u[e] * r,
|
|
374
|
+
y: n.y - r
|
|
375
|
+
},
|
|
376
|
+
n
|
|
377
|
+
]
|
|
357
378
|
});
|
|
358
|
-
else {
|
|
359
|
-
let e = (t.y + n.y) / 2;
|
|
360
|
-
l.push({
|
|
361
|
-
c: "C",
|
|
362
|
-
p: [
|
|
363
|
-
{
|
|
364
|
-
x: t.x,
|
|
365
|
-
y: e
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
x: n.x,
|
|
369
|
-
y: e
|
|
370
|
-
},
|
|
371
|
-
n
|
|
372
|
-
]
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
379
|
}
|
|
376
|
-
|
|
380
|
+
let p = ne[n] >= 0 ? X(ne[n]) : void 0;
|
|
381
|
+
if (!c[n]) return {
|
|
377
382
|
start: i[0],
|
|
378
|
-
segs:
|
|
379
|
-
label:
|
|
383
|
+
segs: f,
|
|
384
|
+
label: p
|
|
385
|
+
};
|
|
386
|
+
let m = [];
|
|
387
|
+
for (let e = l - 1; e >= 1; e--) {
|
|
388
|
+
let t = f[e - 1];
|
|
389
|
+
m.push(t.c === "C" ? {
|
|
390
|
+
c: "C",
|
|
391
|
+
p: [
|
|
392
|
+
t.p[1],
|
|
393
|
+
t.p[0],
|
|
394
|
+
i[e - 1]
|
|
395
|
+
]
|
|
396
|
+
} : {
|
|
397
|
+
c: "L",
|
|
398
|
+
p: [i[e - 1]]
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return {
|
|
402
|
+
start: i[l - 1],
|
|
403
|
+
segs: m,
|
|
404
|
+
label: p
|
|
380
405
|
};
|
|
381
406
|
}), xe = n.map((e, t) => {
|
|
382
407
|
if (N[t] > P[t]) return null;
|
|
@@ -1161,10 +1186,16 @@ function M(e, t, n) {
|
|
|
1161
1186
|
x: i.x - a.x * n,
|
|
1162
1187
|
y: i.y - a.y * n
|
|
1163
1188
|
};
|
|
1164
|
-
r.p[r.p.length - 1] = e, r.c === "C"
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1189
|
+
if (r.p[r.p.length - 1] = e, r.c === "C") {
|
|
1190
|
+
let e = {
|
|
1191
|
+
x: r.p[1].x - a.x * Math.min(n, 6),
|
|
1192
|
+
y: r.p[1].y - a.y * Math.min(n, 6)
|
|
1193
|
+
}, t = Math.min(0, (e.x - r.p[0].x) * a.x + (e.y - r.p[0].y) * a.y);
|
|
1194
|
+
r.p[1] = {
|
|
1195
|
+
x: e.x - a.x * t,
|
|
1196
|
+
y: e.y - a.y * t
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1168
1199
|
}
|
|
1169
1200
|
return a;
|
|
1170
1201
|
}
|
|
@@ -1403,10 +1434,17 @@ function F(t) {
|
|
|
1403
1434
|
x: l.start.x - S.x * T,
|
|
1404
1435
|
y: l.start.y - S.y * T
|
|
1405
1436
|
} : l.start;
|
|
1406
|
-
if (T && x.c === "C"
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1437
|
+
if (T && x.c === "C") {
|
|
1438
|
+
let e = {
|
|
1439
|
+
x: x.p[0].x - S.x * Math.min(T, 6),
|
|
1440
|
+
y: x.p[0].y - S.y * Math.min(T, 6)
|
|
1441
|
+
}, t = Math.max(0, (x.p[1].x - e.x) * S.x + (x.p[1].y - e.y) * S.y);
|
|
1442
|
+
x.p[0] = {
|
|
1443
|
+
x: e.x + S.x * t,
|
|
1444
|
+
y: e.y + S.y * t
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
if (s.path(m([{
|
|
1410
1448
|
c: "M",
|
|
1411
1449
|
p: [E]
|
|
1412
1450
|
}, ...l.segs.map((e) => ({
|