jpfun 0.6.0 → 0.8.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/Bravura-LICENSE.txt +93 -0
- package/README.md +49 -146
- package/dist/Bravura-LICENSE.txt +93 -0
- package/dist/converter/midi/convert.d.ts +3 -11
- package/dist/converter/midi/convert.js +89 -67
- package/dist/converter/musicxml/features.d.ts +34 -12
- package/dist/converter/musicxml/features.js +131 -24
- package/dist/converter/musicxml/index.js +221 -54
- package/dist/converter/musicxml/model.d.ts +24 -0
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1 -0
- package/dist/diagnostic.d.ts +7 -1
- package/dist/diagnostic.js +40 -88
- package/dist/fraction.js +3 -2
- package/dist/functions/ASTtypes.d.ts +2 -18
- package/dist/functions/ASTtypes.js +0 -16
- package/dist/functions/arpeggio/index.js +17 -22
- package/dist/functions/arpeggio/shape.d.ts +1 -1
- package/dist/functions/arpeggio/shape.js +27 -21
- package/dist/functions/bar/index.d.ts +8 -0
- package/dist/functions/bar/index.js +139 -36
- package/dist/functions/beam/auto.d.ts +1 -2
- package/dist/functions/beam/auto.js +44 -27
- package/dist/functions/beam/index.js +2 -3
- package/dist/functions/beam/layout.d.ts +1 -1
- package/dist/functions/beam/layout.js +16 -24
- package/dist/functions/br/index.d.ts +34 -2
- package/dist/functions/br/index.js +8 -8
- package/dist/functions/dash/index.js +6 -6
- package/dist/functions/default.js +10 -5
- package/dist/functions/div/index.d.ts +1 -0
- package/dist/functions/div/index.js +8 -4
- package/dist/functions/dot/index.js +2 -2
- package/dist/functions/dyn/index.js +49 -31
- package/dist/functions/gliss/index.d.ts +2 -0
- package/dist/functions/gliss/index.js +202 -0
- package/dist/functions/grace/index.d.ts +1 -7
- package/dist/functions/grace/index.js +11 -19
- package/dist/functions/head/index.js +41 -60
- package/dist/functions/key/index.js +8 -10
- package/dist/functions/meter/index.d.ts +56 -1
- package/dist/functions/meter/index.js +30 -24
- package/dist/functions/note/accidentals.js +10 -16
- package/dist/functions/note/index.js +18 -8
- package/dist/functions/note/noteName.d.ts +16 -0
- package/dist/functions/note/noteName.js +88 -0
- package/dist/functions/note/source-transform.js +6 -5
- package/dist/functions/ottava/index.d.ts +2 -0
- package/dist/functions/ottava/index.js +233 -0
- package/dist/functions/page/index.d.ts +1 -0
- package/dist/functions/page/index.js +22 -13
- package/dist/functions/pagebreak/index.d.ts +2 -0
- package/dist/functions/pagebreak/index.js +36 -0
- package/dist/functions/rest/index.js +15 -15
- package/dist/functions/set/index.js +4 -4
- package/dist/functions/slide/index.d.ts +2 -0
- package/dist/functions/slide/index.js +132 -0
- package/dist/functions/stack/index.js +8 -15
- package/dist/functions/symbol/index.d.ts +30 -2
- package/dist/functions/symbol/index.js +93 -19
- package/dist/functions/symbol/ornament.d.ts +1 -2
- package/dist/functions/symbol/ornament.js +14 -19
- package/dist/functions/symbol/shape.d.ts +6 -0
- package/dist/functions/symbol/shape.js +20 -4
- package/dist/functions/symbol/symbols/coda.d.ts +4 -0
- package/dist/functions/symbol/symbols/coda.js +56 -0
- package/dist/functions/symbol/symbols/dynamics.d.ts +1 -1
- package/dist/functions/symbol/symbols/dynamics.js +18 -8
- package/dist/functions/symbol/symbols/fine.js +1 -1
- package/dist/functions/symbol/symbols/harmonic.d.ts +2 -0
- package/dist/functions/symbol/symbols/harmonic.js +11 -0
- package/dist/functions/symbol/symbols/marcato.d.ts +2 -0
- package/dist/functions/symbol/symbols/marcato.js +22 -0
- package/dist/functions/symbol/symbols/staccato.d.ts +2 -0
- package/dist/functions/symbol/symbols/staccato.js +24 -0
- package/dist/functions/symbol/symbols/tenuto.d.ts +2 -0
- package/dist/functions/symbol/symbols/tenuto.js +11 -0
- package/dist/functions/symbol/symbols/tocoda.d.ts +2 -0
- package/dist/functions/symbol/symbols/tocoda.js +16 -0
- package/dist/functions/symbol/symbols/tr.js +46 -1
- package/dist/functions/symbol/symbols/turn.d.ts +3 -0
- package/dist/functions/symbol/symbols/turn.js +50 -0
- package/dist/functions/symbol/symbols/wheel.d.ts +2 -0
- package/dist/functions/symbol/symbols/wheel.js +36 -0
- package/dist/functions/temporal.d.ts +17 -6
- package/dist/functions/temporal.js +17 -6
- package/dist/functions/text/index.js +15 -6
- package/dist/functions/tie/index.js +64 -30
- package/dist/functions/tremolo/index.d.ts +2 -0
- package/dist/functions/tremolo/index.js +319 -0
- package/dist/functions/tuplet/index.js +4 -8
- package/dist/functions/up/index.js +7 -9
- package/dist/functions/voice/connections.js +7 -5
- package/dist/functions/voice/index.js +19 -11
- package/dist/functions/volta/index.js +41 -21
- package/dist/jpfun.core.min.js +64 -80
- package/dist/jpfun.from-midi.min.js +5 -5
- package/dist/jpfun.from-musicxml.min.js +8 -8
- package/dist/jpfun.min.js +69 -85
- package/dist/layout/default.d.ts +0 -1
- package/dist/layout/default.js +0 -1
- package/dist/layout/engine.d.ts +1 -0
- package/dist/layout/engine.js +42 -11
- package/dist/layout/page.d.ts +3 -2
- package/dist/layout/page.js +6 -5
- package/dist/layout/types.d.ts +4 -0
- package/dist/lowering/loweringContext.d.ts +11 -13
- package/dist/lowering/loweringContext.js +30 -197
- package/dist/lowering/types.d.ts +1 -3
- package/dist/parser/parse-utils/note-utils.d.ts +1 -1
- package/dist/parser/parse-utils/note-utils.js +8 -9
- package/dist/parser/parse-utils/string-utils.d.ts +3 -2
- package/dist/parser/parse-utils/string-utils.js +16 -3
- package/dist/parser/parserContext.d.ts +2 -0
- package/dist/parser/parserContext.js +36 -8
- package/dist/pipeline.js +0 -1
- package/dist/playback/compile.js +131 -72
- package/dist/playback/event.d.ts +1 -1
- package/dist/playback/event.js +9 -9
- package/dist/playback/time.js +42 -31
- package/dist/playback/types.d.ts +7 -3
- package/dist/render/canvas.d.ts +2 -0
- package/dist/render/canvas.js +25 -22
- package/dist/render/recording.js +1 -4
- package/dist/render/svg.js +1 -0
- package/dist/render/text.d.ts +1 -1
- package/dist/render/text.js +3 -2
- package/dist/render/translate.d.ts +0 -1
- package/dist/render/translate.js +6 -23
- package/dist/render/types.d.ts +1 -0
- package/grammar.md +52 -25
- package/package.json +3 -3
- package/dist/functions/note/noteNameFSM.d.ts +0 -8
- package/dist/functions/note/noteNameFSM.js +0 -181
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { symbolBounds } from "../shape.js";
|
|
1
2
|
import { ornament } from "../ornament.js";
|
|
2
3
|
export const trSymbol = {
|
|
3
4
|
name: "tr",
|
|
4
|
-
description:
|
|
5
|
+
description: '颤音:本音与调内上方二度交替。可写为 `$tr++`,每个紧接的 `+` 添加一截波浪尾巴',
|
|
6
|
+
pattern: {
|
|
7
|
+
regex: /^tr(\++)/,
|
|
8
|
+
resolve: match => {
|
|
9
|
+
const shapes = [...trSymbol.shapes];
|
|
10
|
+
for (let i = 0; i < match[1].length; i++) {
|
|
11
|
+
shapes.push({ ...tailShape, dx: 14.11212 + i * 5.95219 });
|
|
12
|
+
}
|
|
13
|
+
return { ...trSymbol, name: match[0], anchor: trAnchor, shapes };
|
|
14
|
+
},
|
|
15
|
+
},
|
|
5
16
|
shapes: [
|
|
6
17
|
{
|
|
7
18
|
path: [
|
|
@@ -69,3 +80,37 @@ export const trSymbol = {
|
|
|
69
80
|
],
|
|
70
81
|
emitPlayback: emitter => emitter.affectFollowing(ornament({ body: [0, 1], repeat: true })),
|
|
71
82
|
};
|
|
83
|
+
const trBounds = symbolBounds(trSymbol.shapes);
|
|
84
|
+
const trAnchor = trBounds.x + trBounds.w / 2;
|
|
85
|
+
// MuseScore 导出的 TrillSegment,按 tr 字形高度归一化,保留片段之间的重叠。
|
|
86
|
+
const tailShape = {
|
|
87
|
+
path: [
|
|
88
|
+
{ op: "M", x: 7.03619, y: 4.89762 },
|
|
89
|
+
{ op: "C", cx1: 7.03619, cy1: 4.89762, cx2: 6.87351, cy2: 4.70878, x: 6.65687, y: 4.5183 },
|
|
90
|
+
{ op: "C", cx1: 6.57594, cy1: 4.43737, cx2: 6.46721, cy2: 4.41039, x: 6.38546, y: 4.41039 },
|
|
91
|
+
{ op: "C", cx1: 6.30535, cy1: 4.41039, cx2: 6.25058, cy2: 4.43737, x: 6.19662, y: 4.49132 },
|
|
92
|
+
{ op: "L", x: 5.89905, y: 4.78889 },
|
|
93
|
+
{ op: "C", cx1: 5.8451, cy1: 4.84367, cx2: 5.79033, cy2: 4.87064, x: 5.73719, y: 4.87064 },
|
|
94
|
+
{ op: "C", cx1: 5.62846, cy1: 4.87064, cx2: 5.57451, cy2: 4.78889, x: 5.57451, y: 4.78889 },
|
|
95
|
+
{ op: "C", cx1: 5.57451, cy1: 4.78889, cx2: 3.84223, cy2: 3.30105, x: 3.57164, y: 3.05662 },
|
|
96
|
+
{ op: "C", cx1: 3.27407, cy1: 2.8408, cx2: 2.9765, cy2: 2.75905, x: 2.70591, y: 2.75905 },
|
|
97
|
+
{ op: "C", cx1: 2.13857, cy1: 2.75905, cx2: 1.62355, cy2: 3.08523, x: 1.40773, y: 3.32721 },
|
|
98
|
+
{ op: "L", x: 0.10873, y: 4.62703 },
|
|
99
|
+
{ op: "C", cx1: 0.02698, cy1: 4.70878, cx2: 0, cy2: 4.76192, x: 0, y: 4.84367 },
|
|
100
|
+
{ op: "C", cx1: 0, cy1: 4.97773, cx2: 0.10873, cy2: 5.08646, x: 0.10873, y: 5.08646 },
|
|
101
|
+
{ op: "C", cx1: 0.10873, cy1: 5.08646, cx2: 0.27141, cy2: 5.2753, x: 0.48723, y: 5.46578 },
|
|
102
|
+
{ op: "C", cx1: 0.56898, cy1: 5.54671, cx2: 0.64909, cy2: 5.57451, x: 0.73084, y: 5.57451 },
|
|
103
|
+
{ op: "C", cx1: 0.81259, cy1: 5.57451, cx2: 0.86655, cy2: 5.54671, x: 0.91968, y: 5.49276 },
|
|
104
|
+
{ op: "L", x: 1.21725, y: 5.19519 },
|
|
105
|
+
{ op: "C", cx1: 1.27284, cy1: 5.14123, cx2: 1.32598, cy2: 5.11344, x: 1.37993, y: 5.11344 },
|
|
106
|
+
{ op: "C", cx1: 1.48866, cy1: 5.11344, cx2: 1.57041, cy2: 5.19519, x: 1.57041, y: 5.19519 },
|
|
107
|
+
{ op: "C", cx1: 1.57041, cy1: 5.19519, cx2: 3.30105, cy2: 6.65605, x: 3.57164, y: 6.89885 },
|
|
108
|
+
{ op: "C", cx1: 3.86921, cy1: 7.1163, cx2: 4.16678, cy2: 7.19805, x: 4.43819, y: 7.19805 },
|
|
109
|
+
{ op: "C", cx1: 5.00635, cy1: 7.19805, cx2: 5.51973, cy2: 6.87187, x: 5.73719, y: 6.62989 },
|
|
110
|
+
{ op: "L", x: 7.03619, y: 5.33008 },
|
|
111
|
+
{ op: "C", cx1: 7.1163, cy1: 5.24833, cx2: 7.1441, cy2: 5.16821, x: 7.1441, y: 5.11344 },
|
|
112
|
+
{ op: "C", cx1: 7.1441, cy1: 4.97773, cx2: 7.03619, cy2: 4.89762, x: 7.03619, y: 4.89762 },
|
|
113
|
+
{ op: "Z" },
|
|
114
|
+
],
|
|
115
|
+
style: { fill: "#000" },
|
|
116
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ornament } from "../ornament.js";
|
|
2
|
+
/*!
|
|
3
|
+
* Bravura 1.482 ornamentTurn (U+E567), Y axis flipped; https://github.com/steinbergmedia/bravura
|
|
4
|
+
* Copyright (c) 2026, Steinberg Media Technologies GmbH. Reserved Font Name "Bravura".
|
|
5
|
+
* SPDX-License-Identifier: OFL-1.1
|
|
6
|
+
* Full license: Bravura-LICENSE.txt in the package root and dist.
|
|
7
|
+
*/
|
|
8
|
+
const turnPath = [
|
|
9
|
+
{ op: "M", x: 371, y: -218 },
|
|
10
|
+
{ op: "C", cx1: 340, cy1: -218, cx2: 315, cy2: -204, x: 315, y: -174 },
|
|
11
|
+
{ op: "C", cx1: 315, cy1: -152, cx2: 330, cy2: -138, x: 351, y: -138 },
|
|
12
|
+
{ op: "C", cx1: 380, cy1: -138, cx2: 381, cy2: -161, x: 402, y: -161 },
|
|
13
|
+
{ op: "C", cx1: 419, cy1: -161, cx2: 435, cy2: -140, x: 435, y: -114 },
|
|
14
|
+
{ op: "C", cx1: 435, cy1: -71, cx2: 405, cy2: -50, x: 370, y: -50 },
|
|
15
|
+
{ op: "C", cx1: 338, cy1: -50, cx2: 305, cy2: -77, x: 262, y: -125 },
|
|
16
|
+
{ op: "C", cx1: 213, cy1: -179, cx2: 169, cy2: -217, x: 104, y: -217 },
|
|
17
|
+
{ op: "C", cx1: 38, cy1: -217, cx2: 0, cy2: -167, x: 0, y: -103 },
|
|
18
|
+
{ op: "C", cx1: 0, cy1: -31, cx2: 46, cy2: 0, x: 89, y: 0 },
|
|
19
|
+
{ op: "C", cx1: 120, cy1: 0, cx2: 145, cy2: -14, x: 145, y: -44 },
|
|
20
|
+
{ op: "C", cx1: 145, cy1: -66, cx2: 130, cy2: -80, x: 109, y: -80 },
|
|
21
|
+
{ op: "C", cx1: 80, cy1: -80, cx2: 79, cy2: -57, x: 58, y: -57 },
|
|
22
|
+
{ op: "C", cx1: 41, cy1: -57, cx2: 25, cy2: -78, x: 25, y: -104 },
|
|
23
|
+
{ op: "C", cx1: 25, cy1: -147, cx2: 55, cy2: -168, x: 90, y: -168 },
|
|
24
|
+
{ op: "C", cx1: 122, cy1: -168, cx2: 155, cy2: -141, x: 198, y: -93 },
|
|
25
|
+
{ op: "C", cx1: 247, cy1: -39, cx2: 291, cy2: -1, x: 356, y: -1 },
|
|
26
|
+
{ op: "C", cx1: 422, cy1: -1, cx2: 460, cy2: -51, x: 460, y: -115 },
|
|
27
|
+
{ op: "C", cx1: 460, cy1: -187, cx2: 414, cy2: -218, x: 371, y: -218 },
|
|
28
|
+
{ op: "Z" },
|
|
29
|
+
];
|
|
30
|
+
const turnShape = { path: turnPath, style: { fill: "#000" } };
|
|
31
|
+
export const turnSymbol = {
|
|
32
|
+
name: "turn",
|
|
33
|
+
description: "回音",
|
|
34
|
+
weight: 0.55,
|
|
35
|
+
shapes: [turnShape],
|
|
36
|
+
emitPlayback: emitter => emitter.affectFollowing(ornament({ body: [1, 0, -1, 0] })),
|
|
37
|
+
};
|
|
38
|
+
export const iturnSymbol = {
|
|
39
|
+
name: "iturn",
|
|
40
|
+
description: "逆回音",
|
|
41
|
+
weight: 0.55 * 396 / 218,
|
|
42
|
+
shapes: [
|
|
43
|
+
turnShape,
|
|
44
|
+
{
|
|
45
|
+
line: { x1: 230, y1: -290, x2: 230, y2: 74 },
|
|
46
|
+
style: { stroke: "#000", strokeWidth: 32 },
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
emitPlayback: emitter => emitter.affectFollowing(ornament({ body: [-1, 0, 1, 0] })),
|
|
50
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const wheelSymbol = {
|
|
2
|
+
name: "wheel",
|
|
3
|
+
description: "轮指",
|
|
4
|
+
shapes: [
|
|
5
|
+
{
|
|
6
|
+
path: [
|
|
7
|
+
{ op: "M", x: 8.8, y: 0 },
|
|
8
|
+
{ op: "L", x: 11.2, y: 0 },
|
|
9
|
+
{ op: "L", x: 11.2, y: 6 },
|
|
10
|
+
{ op: "L", x: 8.8, y: 6 },
|
|
11
|
+
{ op: "Z" },
|
|
12
|
+
{ op: "M", x: 13.43341, y: 7.62266 },
|
|
13
|
+
{ op: "L", x: 19.13974, y: 5.76856 },
|
|
14
|
+
{ op: "L", x: 19.88139, y: 8.0511 },
|
|
15
|
+
{ op: "L", x: 14.17505, y: 9.9052 },
|
|
16
|
+
{ op: "Z" },
|
|
17
|
+
{ op: "M", x: 11.38032, y: 13.94141 },
|
|
18
|
+
{ op: "L", x: 14.90703, y: 18.79551 },
|
|
19
|
+
{ op: "L", x: 16.84867, y: 17.38483 },
|
|
20
|
+
{ op: "L", x: 13.32196, y: 12.53073 },
|
|
21
|
+
{ op: "Z" },
|
|
22
|
+
{ op: "M", x: 8.61968, y: 13.94141 },
|
|
23
|
+
{ op: "L", x: 5.09297, y: 18.79551 },
|
|
24
|
+
{ op: "L", x: 3.15133, y: 17.38483 },
|
|
25
|
+
{ op: "L", x: 6.67804, y: 12.53073 },
|
|
26
|
+
{ op: "Z" },
|
|
27
|
+
{ op: "M", x: 6.56659, y: 7.62266 },
|
|
28
|
+
{ op: "L", x: 0.86026, y: 5.76856 },
|
|
29
|
+
{ op: "L", x: 0.11861, y: 8.0511 },
|
|
30
|
+
{ op: "L", x: 5.82495, y: 9.9052 },
|
|
31
|
+
{ op: "Z" },
|
|
32
|
+
],
|
|
33
|
+
style: { fill: "#000" },
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
@@ -23,17 +23,27 @@ export interface TimeState {
|
|
|
23
23
|
program: number;
|
|
24
24
|
/** 当前小节时长(QN);尚无显式拍号或散板时为 undefined */
|
|
25
25
|
meter?: Fraction;
|
|
26
|
+
/** 当前执行的全局事件;复合体内部回调共用该位置 */
|
|
27
|
+
currentEvent?: TemporalNodeBase;
|
|
26
28
|
[key: string]: any;
|
|
27
29
|
}
|
|
28
30
|
export declare const DEFAULT_BPM = 120;
|
|
29
31
|
export declare const DEFAULT_VELOCITY = 80;
|
|
30
32
|
export declare const DEFAULT_TONALITY = "C4";
|
|
31
33
|
export declare const DEFAULT_PROGRAM = 0;
|
|
34
|
+
/** 每个事件的可选语义声明;核心字段与函数私有的 @键分开 */
|
|
35
|
+
export interface TemporalAddon {
|
|
36
|
+
/** 请求在当前时间列之前换几行,缺省为 0 */
|
|
37
|
+
breakBefore?: number;
|
|
38
|
+
/** 在所属行之前强制换页;配合 breakBefore 使用,布尔值控制上一页的余白分配 */
|
|
39
|
+
pageBreakBefore?: boolean;
|
|
40
|
+
[key: `@${string}`]: unknown;
|
|
41
|
+
}
|
|
32
42
|
/**
|
|
33
43
|
* 事件的合并组:同一时刻 mergeKey 相等的事件归并成一列
|
|
34
44
|
*
|
|
35
45
|
* 缺省取事件自身的 order,因而互不相等、各自独占一列;需要合并的显式取相同的值。
|
|
36
|
-
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1
|
|
46
|
+
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1 换行/换页,-2 声部名
|
|
37
47
|
*/
|
|
38
48
|
/** 时间对齐点(小节线);必须是最小值,最先出队 */
|
|
39
49
|
export declare const ANCHOR_KEY: number;
|
|
@@ -50,12 +60,12 @@ export declare class TemporalNodeBase implements TimeLineEvent {
|
|
|
50
60
|
track: Track;
|
|
51
61
|
ast: ASTNodeBase;
|
|
52
62
|
order: number;
|
|
53
|
-
addon?:
|
|
63
|
+
addon?: TemporalAddon;
|
|
54
64
|
/**
|
|
55
65
|
* 时间列合并组:同一时刻 mergeKey 相等的事件归并成一列
|
|
56
66
|
*
|
|
57
67
|
* 缺省取事件自身的 order,因而互不相等、各自独占一列;需要合并的显式取相同的值。
|
|
58
|
-
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1
|
|
68
|
+
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1 换行/换页,-2 声部名
|
|
59
69
|
*/
|
|
60
70
|
mergeKey: number;
|
|
61
71
|
/**
|
|
@@ -65,8 +75,6 @@ export declare class TemporalNodeBase implements TimeLineEvent {
|
|
|
65
75
|
* 按全局事件工作的消费者可以沿链上溯到宿主。
|
|
66
76
|
*/
|
|
67
77
|
foldedInto?: TemporalNodeBase;
|
|
68
|
-
/** 请求在自己所在时间列之前换几行,默认 0 */
|
|
69
|
-
breakBefore: number;
|
|
70
78
|
/** 由 LoweringContext 在列归并后固化的谱面行号 */
|
|
71
79
|
layoutLine: number;
|
|
72
80
|
/** 不可见状态事件保持 undefined */
|
|
@@ -82,13 +90,14 @@ export declare class TemporalNodeBase implements TimeLineEvent {
|
|
|
82
90
|
* 装饰与关系函数使用的命名局部坐标,相对 box 左上角,每轮布局重建。
|
|
83
91
|
*
|
|
84
92
|
* 当前内置端口:
|
|
85
|
-
* - body.left / body.right:主体核心左右边界,供 div、tuplet、volta 使用;缺省为盒左右边界。
|
|
93
|
+
* - body.left / body.right:主体核心左右边界,供 div、tuplet、volta、ottava 使用;缺省为盒左右边界。
|
|
86
94
|
* - decoration.below:下方装饰排列起点(只读 y);缺省为正文 box.h。
|
|
87
95
|
* - shoulder:倚音的纵向定位基准(只读 y);音符提供数字顶边,缺省为盒顶。
|
|
88
96
|
* - tie.top:连音线端点;缺省为 anchor 与内容上沿,up 提供最上层成员的端点。
|
|
89
97
|
* - div.{level}.left / div.{level}.right:从 0 编号的减时线端点,由 div.place 发布,供 beam 接管。
|
|
90
98
|
* - dot:附点起点;缺省为盒右边界与 visualAxis,音符覆盖为字形附近的位置。
|
|
91
99
|
* - lyric:歌词对齐点(voice 只读 x);未提供则不作为歌词目标,note 在 finalizeLayout 发布。
|
|
100
|
+
* - bar.number:多声部连谱号顶部的行首小节号锚点。
|
|
92
101
|
*
|
|
93
102
|
* up、grace、arpeggio 转发宿主端口并换算局部坐标;端口不表达装饰是否存在。
|
|
94
103
|
*/
|
|
@@ -147,6 +156,8 @@ export declare class TemporalNodeBase implements TimeLineEvent {
|
|
|
147
156
|
/** 只执行绘制,不允许在这里重新测量或改变 LayoutBox */
|
|
148
157
|
paint(_painter: Painter): void;
|
|
149
158
|
}
|
|
159
|
+
/** 复合体下放函数语义时,核心声明仍留在全局事件上 */
|
|
160
|
+
export declare function transferFunctionAddons(source: TemporalNodeBase, target: TemporalNodeBase): void;
|
|
150
161
|
/** 可以进入视觉布局的 Temporal,同时满足 decoration 所需的 LayoutHost 协议 */
|
|
151
162
|
export type VisualTemporalNode = TemporalNodeBase & LayoutHost;
|
|
152
163
|
export declare function isVisualTemporalNode(node: TemporalNodeBase): node is VisualTemporalNode;
|
|
@@ -7,7 +7,7 @@ export const DEFAULT_PROGRAM = 0;
|
|
|
7
7
|
* 事件的合并组:同一时刻 mergeKey 相等的事件归并成一列
|
|
8
8
|
*
|
|
9
9
|
* 缺省取事件自身的 order,因而互不相等、各自独占一列;需要合并的显式取相同的值。
|
|
10
|
-
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1
|
|
10
|
+
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1 换行/换页,-2 声部名
|
|
11
11
|
*/
|
|
12
12
|
/** 时间对齐点(小节线);必须是最小值,最先出队 */
|
|
13
13
|
export const ANCHOR_KEY = -Infinity;
|
|
@@ -26,12 +26,12 @@ export class TemporalNodeBase {
|
|
|
26
26
|
track; // 所在的纵向音轨;同轨判断使用引用相等
|
|
27
27
|
ast; // 对应的 AST 节点
|
|
28
28
|
order; // 事件创建序号,作为id。可用于区分同时发生的父子、排序同一时刻发生的事件
|
|
29
|
-
addon; //
|
|
29
|
+
addon; // 仅在存在语义声明时创建,比如换行或 div 和 dot 的数目
|
|
30
30
|
/**
|
|
31
31
|
* 时间列合并组:同一时刻 mergeKey 相等的事件归并成一列
|
|
32
32
|
*
|
|
33
33
|
* 缺省取事件自身的 order,因而互不相等、各自独占一列;需要合并的显式取相同的值。
|
|
34
|
-
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1
|
|
34
|
+
* 数值同时决定同时刻的列先后,越小越靠左。已占用的共享常量:-1 换行/换页,-2 声部名
|
|
35
35
|
*/
|
|
36
36
|
mergeKey;
|
|
37
37
|
/**
|
|
@@ -41,8 +41,6 @@ export class TemporalNodeBase {
|
|
|
41
41
|
* 按全局事件工作的消费者可以沿链上溯到宿主。
|
|
42
42
|
*/
|
|
43
43
|
foldedInto;
|
|
44
|
-
/** 请求在自己所在时间列之前换几行,默认 0 */
|
|
45
|
-
breakBefore = 0;
|
|
46
44
|
/** 由 LoweringContext 在列归并后固化的谱面行号 */
|
|
47
45
|
layoutLine = 0;
|
|
48
46
|
/** 不可见状态事件保持 undefined */
|
|
@@ -56,13 +54,14 @@ export class TemporalNodeBase {
|
|
|
56
54
|
* 装饰与关系函数使用的命名局部坐标,相对 box 左上角,每轮布局重建。
|
|
57
55
|
*
|
|
58
56
|
* 当前内置端口:
|
|
59
|
-
* - body.left / body.right:主体核心左右边界,供 div、tuplet、volta 使用;缺省为盒左右边界。
|
|
57
|
+
* - body.left / body.right:主体核心左右边界,供 div、tuplet、volta、ottava 使用;缺省为盒左右边界。
|
|
60
58
|
* - decoration.below:下方装饰排列起点(只读 y);缺省为正文 box.h。
|
|
61
59
|
* - shoulder:倚音的纵向定位基准(只读 y);音符提供数字顶边,缺省为盒顶。
|
|
62
60
|
* - tie.top:连音线端点;缺省为 anchor 与内容上沿,up 提供最上层成员的端点。
|
|
63
61
|
* - div.{level}.left / div.{level}.right:从 0 编号的减时线端点,由 div.place 发布,供 beam 接管。
|
|
64
62
|
* - dot:附点起点;缺省为盒右边界与 visualAxis,音符覆盖为字形附近的位置。
|
|
65
63
|
* - lyric:歌词对齐点(voice 只读 x);未提供则不作为歌词目标,note 在 finalizeLayout 发布。
|
|
64
|
+
* - bar.number:多声部连谱号顶部的行首小节号锚点。
|
|
66
65
|
*
|
|
67
66
|
* up、grace、arpeggio 转发宿主端口并换算局部坐标;端口不表达装饰是否存在。
|
|
68
67
|
*/
|
|
@@ -106,6 +105,18 @@ export class TemporalNodeBase {
|
|
|
106
105
|
/** 只执行绘制,不允许在这里重新测量或改变 LayoutBox */
|
|
107
106
|
paint(_painter) { }
|
|
108
107
|
}
|
|
108
|
+
/** 复合体下放函数语义时,核心声明仍留在全局事件上 */
|
|
109
|
+
export function transferFunctionAddons(source, target) {
|
|
110
|
+
const addon = source.addon;
|
|
111
|
+
if (!addon)
|
|
112
|
+
return;
|
|
113
|
+
for (const key of Object.keys(addon).filter((key) => key.startsWith("@"))) {
|
|
114
|
+
(target.addon ??= {})[key] = addon[key];
|
|
115
|
+
delete addon[key];
|
|
116
|
+
}
|
|
117
|
+
if (!Object.keys(addon).length)
|
|
118
|
+
source.addon = undefined;
|
|
119
|
+
}
|
|
109
120
|
export function isVisualTemporalNode(node) {
|
|
110
121
|
return node.box !== undefined;
|
|
111
122
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ASTFunctionNode } from "../ASTtypes.js";
|
|
2
2
|
import { ErrorDiagnostic } from "../../diagnostic.js";
|
|
3
|
-
import { findClosingQuote, quote
|
|
3
|
+
import { findClosingQuote, quote } from "../../parser/parse-utils/string-utils.js";
|
|
4
4
|
import { DEFAULT_KEY, TemporalNodeBase } from "../temporal.js";
|
|
5
5
|
class TextFunction extends ASTFunctionNode {
|
|
6
6
|
static def = {
|
|
@@ -10,7 +10,9 @@ class TextFunction extends ASTFunctionNode {
|
|
|
10
10
|
~~~jpfun
|
|
11
11
|
@text(进入主题, size=0.8em, align=center)
|
|
12
12
|
~~~
|
|
13
|
-
**简写**:直接写双引号文本,如 \`"进入主题"
|
|
13
|
+
**简写**:直接写双引号文本,如 \`"进入主题"\`;可跨行,双引号须配对。
|
|
14
|
+
|
|
15
|
+
支持 JSON 风格的 Unicode 转义,如 \`\\uE050\`;显示字面反斜杠须写 \`\\\\\`。`,
|
|
14
16
|
allowExtraArgs: false,
|
|
15
17
|
args: [
|
|
16
18
|
{
|
|
@@ -54,15 +56,22 @@ class TextFunction extends ASTFunctionNode {
|
|
|
54
56
|
if (close < 0)
|
|
55
57
|
return null; // 未闭合就不去糖,与预处理“配对才算字符串”一致
|
|
56
58
|
const node = {
|
|
57
|
-
kind: "
|
|
58
|
-
|
|
59
|
-
name: "text",
|
|
60
|
-
args: new Map([[0, removeQuote(source.slice(start, close + 1))]]),
|
|
59
|
+
kind: "sugar",
|
|
60
|
+
data: TextFunction,
|
|
61
61
|
span: { start, end: close + 1 },
|
|
62
62
|
syntaxKind: "string",
|
|
63
63
|
};
|
|
64
64
|
return { next: close + 1, node };
|
|
65
65
|
}
|
|
66
|
+
static deSugarRelation(ctx, nodes, at) {
|
|
67
|
+
const node = nodes[at];
|
|
68
|
+
if (node.data !== TextFunction)
|
|
69
|
+
return null;
|
|
70
|
+
// 之所以不在 deSugarAtom 里直接解码返回 typed call,是因为字符串转义可能产生诊断(如非法 \u 转义):
|
|
71
|
+
// 第一轮 deSugarAtom 没有 ctx(抛异常则会中断词法扫描),放到第二轮才能复用 parseArgWithType 记录警告并回退原文
|
|
72
|
+
ctx.pushNode(new TextFunction(node.span, new Map([[0, ctx.parseArgWithType(node.span, "string")]]), ctx, null));
|
|
73
|
+
return at + 1;
|
|
74
|
+
}
|
|
66
75
|
lines;
|
|
67
76
|
size;
|
|
68
77
|
lineAdvance;
|
|
@@ -3,10 +3,36 @@ import { Diagnostic, ErrorDiagnostic } from "../../diagnostic.js";
|
|
|
3
3
|
import { isVisualTemporalNode, } from "../temporal.js";
|
|
4
4
|
import { pathBounds } from "../../layout/path.js";
|
|
5
5
|
import { getLayoutBounds } from "../../layout/engine.js";
|
|
6
|
+
/** 仅索引被 @tie 引用过的端点,避免为全谱无关音符分配数组与 Map 节点 */
|
|
7
|
+
const tieEndpoints = new WeakSet();
|
|
8
|
+
const notesByOriginNode = new WeakMap();
|
|
9
|
+
function endpointNotes(notes, endpoint) {
|
|
10
|
+
let index = notesByOriginNode.get(notes);
|
|
11
|
+
if (!index) {
|
|
12
|
+
index = new Map();
|
|
13
|
+
for (const note of notes) {
|
|
14
|
+
for (const { node } of note.origins) {
|
|
15
|
+
if (!tieEndpoints.has(node))
|
|
16
|
+
continue;
|
|
17
|
+
const group = index.get(node);
|
|
18
|
+
if (group)
|
|
19
|
+
group.push(note);
|
|
20
|
+
else
|
|
21
|
+
index.set(node, [note]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
notesByOriginNode.set(notes, index);
|
|
25
|
+
}
|
|
26
|
+
return index.get(endpoint) ?? [];
|
|
27
|
+
}
|
|
6
28
|
/** 三次贝塞尔控制点的抬高系数:两个控制点同高时,实际弧高恰好是抬高的 3/4 */
|
|
7
29
|
const CUBIC_LIFT = 4 / 3;
|
|
8
30
|
/** 弧带中部最大厚度与字号之比 */
|
|
9
31
|
const THICKNESS_RATIO = 0.09;
|
|
32
|
+
/** 参考弧线的跨度约为弧高的 5 倍;在 2.5em 处平滑达到 0.5em 上限 */
|
|
33
|
+
const AUTO_SPAN_RATIO = 2.5;
|
|
34
|
+
const AUTO_HEIGHT_RATIO = 0.5;
|
|
35
|
+
const CROSS_LINE_HEIGHT_RATIO = 0.45;
|
|
10
36
|
class TieFunction extends ASTFunctionNode {
|
|
11
37
|
static def = {
|
|
12
38
|
name: ["tie"],
|
|
@@ -16,21 +42,22 @@ class TieFunction extends ASTFunctionNode {
|
|
|
16
42
|
1@a 2 3@b @tie(a, b, height=0.5em)
|
|
17
43
|
~~~
|
|
18
44
|
- **位置参数**:端点标签,可传多个,按顺序连接;省略时查找最近的可标记对象,包括增时线
|
|
19
|
-
- **height**:仅命名的弧线高度参数,默认 \`0.5em
|
|
45
|
+
- **height**:仅命名的弧线高度参数,默认 \`0\`(自动);非正数按水平跨度自动调整,在 \`2.5em\` 跨度处平滑达到 \`0.5em\` 上限,正数指定固定弧高。em 相对调用处字号;可用 \`@set(tie.height=0.8em)\` 设置局部默认值,显式传参优先
|
|
20
46
|
|
|
21
|
-
|
|
47
|
+
同行端点用一条弧线连接,自动高度按水平跨度计算;跨行时自动拆成多段,自动模式下各段统一使用 \`0.45em\` 高度。同轨同音且时间连续的音段建立播放连接:未另加修饰的后继音段并入前段共同展开(如 \`1 ^ $tr 1 @tie()\` 全程颤音),带独立修饰的后继音段从自身起点生效(如 \`1 1 ^ $tr @tie()\` 从第二拍开始颤音)。涉及增时线的连接仅绘制,不合并播放音符。`,
|
|
22
48
|
allowExtraArgs: true,
|
|
23
49
|
extraArgType: "label",
|
|
24
50
|
args: [{
|
|
25
51
|
name: "height",
|
|
26
52
|
namedOnly: true,
|
|
27
|
-
description: "弧线高度,支持 px/em;em
|
|
53
|
+
description: "弧线高度,支持 px/em;em 相对调用处字号,非正数自动调整,最高 0.5em",
|
|
28
54
|
type: "length",
|
|
29
|
-
default: { value: 0
|
|
55
|
+
default: { value: 0, unit: "em" },
|
|
30
56
|
}]
|
|
31
57
|
};
|
|
32
58
|
endPoints = [];
|
|
33
59
|
height;
|
|
60
|
+
fontSize;
|
|
34
61
|
constructor(sourceSpan, args, ctx, parent = null) {
|
|
35
62
|
super(sourceSpan, parent);
|
|
36
63
|
// 命名选项统一解析默认值,位置参数仍全部作为端点
|
|
@@ -52,9 +79,11 @@ class TieFunction extends ASTFunctionNode {
|
|
|
52
79
|
continue;
|
|
53
80
|
this.endPoints.unshift(candidate);
|
|
54
81
|
}
|
|
55
|
-
if (this.endPoints.length < 2)
|
|
56
|
-
throw new ErrorDiagnostic("E_NOT_ENOUGH_ARGS", "@
|
|
82
|
+
if (this.endPoints.length < 2) {
|
|
83
|
+
throw new ErrorDiagnostic("E_NOT_ENOUGH_ARGS", "@{fn} 连音线需要至少两个端点", sourceSpan, { fn: "tie" });
|
|
84
|
+
}
|
|
57
85
|
this.height = Math.max(0, ctx.length2px(height));
|
|
86
|
+
this.fontSize = ctx.variables.fontsize;
|
|
58
87
|
}
|
|
59
88
|
/**
|
|
60
89
|
* tie 不推进时间
|
|
@@ -72,7 +101,7 @@ class TieFunction extends ASTFunctionNode {
|
|
|
72
101
|
ctx.diagnostics.push(Diagnostic.warning.UnresolvedEndpoint("tie", this.sourceSpan));
|
|
73
102
|
return [];
|
|
74
103
|
}
|
|
75
|
-
ctx.addAttachment(new TieLayoutAttachment(endPoints, this.height, this.sourceSpan));
|
|
104
|
+
ctx.addAttachment(new TieLayoutAttachment(endPoints, this.height, this.fontSize, this.sourceSpan));
|
|
76
105
|
return [];
|
|
77
106
|
}
|
|
78
107
|
toString(source) {
|
|
@@ -88,11 +117,15 @@ class TieLayoutAttachment {
|
|
|
88
117
|
sourceSpan;
|
|
89
118
|
endPoints;
|
|
90
119
|
height;
|
|
120
|
+
fontSize;
|
|
91
121
|
/** 弧带中部厚度;两端收尖到 0。端点字号不随布局变化,可以一次算定 */
|
|
92
122
|
thickness;
|
|
93
|
-
constructor(endPoints, height, sourceSpan) {
|
|
123
|
+
constructor(endPoints, height, fontSize, sourceSpan) {
|
|
94
124
|
this.endPoints = endPoints;
|
|
125
|
+
for (const endpoint of endPoints)
|
|
126
|
+
tieEndpoints.add(endpoint);
|
|
95
127
|
this.height = height;
|
|
128
|
+
this.fontSize = fontSize;
|
|
96
129
|
this.sourceSpan = sourceSpan;
|
|
97
130
|
const size = endPoints.reduce((current, endpoint) => Math.max(current, endpoint.ast.size), 0);
|
|
98
131
|
this.thickness = Math.max(1.2, size * THICKNESS_RATIO);
|
|
@@ -103,13 +136,12 @@ class TieLayoutAttachment {
|
|
|
103
136
|
*/
|
|
104
137
|
applyPlayback(context) {
|
|
105
138
|
// 整体端点可能包含和弦多个成员或多遍访问,每个首段分别寻找自己的连接链。
|
|
106
|
-
for (const head of context.notes
|
|
139
|
+
for (const head of endpointNotes(context.notes, this.endPoints[0])) {
|
|
107
140
|
let previous = head;
|
|
108
141
|
// 按显式端点顺序延续;某一端点没有相接音段就停止,不能跨过缺口连接。
|
|
109
142
|
for (let index = 1; index < this.endPoints.length; index++) {
|
|
110
143
|
// connect 同时认领候选:配对冲突时继续找其他成员,重复声明可复用原配对。
|
|
111
|
-
const next = context.notes.find(note => note !== previous
|
|
112
|
-
&& note.origins.some(origin => origin.node === this.endPoints[index])
|
|
144
|
+
const next = endpointNotes(context.notes, this.endPoints[index]).find(note => note !== previous
|
|
113
145
|
&& note.track === previous.track
|
|
114
146
|
&& note.midi === previous.midi
|
|
115
147
|
&& note.percussion === previous.percussion
|
|
@@ -176,24 +208,29 @@ class TieLayoutAttachment {
|
|
|
176
208
|
const start = this.tiePort(startNode);
|
|
177
209
|
const end = this.tiePort(endNode);
|
|
178
210
|
if (startNode.layoutLine === endNode.layoutLine) {
|
|
179
|
-
const startTop =
|
|
180
|
-
|
|
181
|
-
const endTop = context.getVisualAxis(endNode.layoutLine, endNode.track)
|
|
182
|
-
+ (context.getHostExtent(endNode.layoutLine, endNode.track)?.top ?? 0);
|
|
211
|
+
const startTop = this.hostTop(context, startNode.layoutLine, startNode.track);
|
|
212
|
+
const endTop = this.hostTop(context, endNode.layoutLine, endNode.track);
|
|
183
213
|
segments.push(this.arcSegment(start, end, startNode.layoutLine, startTop <= endTop ? startNode.track : endNode.track));
|
|
184
214
|
continue;
|
|
185
215
|
}
|
|
216
|
+
const height = this.height > 0 ? this.height : this.fontSize * CROSS_LINE_HEIGHT_RATIO;
|
|
186
217
|
// 首行先起弧,再沿水平段延伸到当前谱面行最右侧
|
|
187
|
-
segments.push(this.openingSegment(start, this.lineRightX(context, startNode.layoutLine),
|
|
218
|
+
segments.push(this.openingSegment(start, this.lineRightX(context, startNode.layoutLine), height, startNode.layoutLine, startNode.track));
|
|
188
219
|
// 中间行可能没有任何可见对象,仍然需要逐行补一段水平线
|
|
189
220
|
for (let line = startNode.layoutLine + 1; line < endNode.layoutLine; line++) {
|
|
190
|
-
segments.push(this.horizontalSegment(this.lineEntryX(context, line, startNode.track), this.lineRightX(context, line), this.
|
|
221
|
+
segments.push(this.horizontalSegment(this.lineEntryX(context, line, startNode.track), this.lineRightX(context, line), this.hostTop(context, line, startNode.track) - height, line, startNode.track));
|
|
191
222
|
}
|
|
192
223
|
// 跳过声部名、大括号等位于端点列之前的系统前缀,再落弧到终点
|
|
193
|
-
segments.push(this.closingSegment(this.lineEntryX(context, endNode.layoutLine, endNode.track), end,
|
|
224
|
+
segments.push(this.closingSegment(this.lineEntryX(context, endNode.layoutLine, endNode.track), end, height, endNode.layoutLine, endNode.track));
|
|
194
225
|
}
|
|
195
226
|
return segments;
|
|
196
227
|
}
|
|
228
|
+
resolveHeight(span) {
|
|
229
|
+
if (this.height > 0)
|
|
230
|
+
return this.height;
|
|
231
|
+
const ratio = Math.min(1, span / (this.fontSize * AUTO_SPAN_RATIO));
|
|
232
|
+
return this.fontSize * AUTO_HEIGHT_RATIO * ratio * (2 - ratio);
|
|
233
|
+
}
|
|
197
234
|
lineEntryX(context, lineIndex, track) {
|
|
198
235
|
const line = context.lines[lineIndex];
|
|
199
236
|
const host = line.trackRuns.get(track)?.find(host => !host.T.isZero());
|
|
@@ -210,13 +247,8 @@ class TieLayoutAttachment {
|
|
|
210
247
|
}
|
|
211
248
|
return right;
|
|
212
249
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (Number.isFinite(endpointY))
|
|
216
|
-
return endpointY - this.height;
|
|
217
|
-
const axis = context.getVisualAxis(line, track);
|
|
218
|
-
const hostTop = context.getHostExtent(line, track)?.top ?? 0;
|
|
219
|
-
return axis + hostTop - this.height;
|
|
250
|
+
hostTop(context, line, track) {
|
|
251
|
+
return context.getVisualAxis(line, track) + (context.getHostExtent(line, track)?.top ?? 0);
|
|
220
252
|
}
|
|
221
253
|
/** 一条三次贝塞尔的外缘配上反向内缘,得到两端收尖、中部最厚的乐谱弧线 */
|
|
222
254
|
arcSegment(startInput, endInput, line, track) {
|
|
@@ -227,7 +259,7 @@ class TieLayoutAttachment {
|
|
|
227
259
|
const run = (end.x - start.x) * 0.25;
|
|
228
260
|
const leftX = start.x + run;
|
|
229
261
|
const rightX = end.x - run;
|
|
230
|
-
const lift = this.
|
|
262
|
+
const lift = this.resolveHeight(end.x - start.x) * CUBIC_LIFT;
|
|
231
263
|
const inner = Math.max(0, lift - this.thickness * CUBIC_LIFT);
|
|
232
264
|
const commands = [
|
|
233
265
|
{ op: "M", x: start.x, y: start.y },
|
|
@@ -238,8 +270,9 @@ class TieLayoutAttachment {
|
|
|
238
270
|
return makeSegment(commands, line, track);
|
|
239
271
|
}
|
|
240
272
|
/** 跨行首段:从端点起弧,随后水平延伸到右边界 */
|
|
241
|
-
openingSegment(start, right,
|
|
242
|
-
const
|
|
273
|
+
openingSegment(start, right, height, line, track) {
|
|
274
|
+
const plateauY = start.y - height;
|
|
275
|
+
const run = height * 1.2;
|
|
243
276
|
right = Math.max(right, start.x + run);
|
|
244
277
|
const curveX = start.x + run;
|
|
245
278
|
const controlX = start.x + run * 0.45;
|
|
@@ -255,8 +288,9 @@ class TieLayoutAttachment {
|
|
|
255
288
|
], line, track);
|
|
256
289
|
}
|
|
257
290
|
/** 跨行末段:从左边界水平进入,最后落弧到端点 */
|
|
258
|
-
closingSegment(left, end,
|
|
259
|
-
const
|
|
291
|
+
closingSegment(left, end, height, line, track) {
|
|
292
|
+
const plateauY = end.y - height;
|
|
293
|
+
const run = height * 1.2;
|
|
260
294
|
left = Math.min(left, end.x - run);
|
|
261
295
|
const curveX = end.x - run;
|
|
262
296
|
const controlX = end.x - run * 0.45;
|