@meframe/core 0.5.8 → 0.5.10
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/meframe-service/node_modules/.pnpm/mp4-muxer@5.2.2/node_modules/mp4-muxer/build/mp4-muxer.js.map +1 -0
- package/dist/meframe-service/node_modules/.pnpm/mp4box@0.5.4/node_modules/mp4box/dist/mp4box.all.js.map +1 -0
- package/dist/model/CompositionModel.js +2 -2
- package/dist/model/CompositionModel.js.map +1 -1
- package/dist/model/types.d.ts +1 -1
- package/dist/model/types.d.ts.map +1 -1
- package/dist/model/types.js.map +1 -1
- package/dist/orchestrator/CompositionPlanner.d.ts.map +1 -1
- package/dist/orchestrator/CompositionPlanner.js +14 -3
- package/dist/orchestrator/CompositionPlanner.js.map +1 -1
- package/dist/stages/compose/font-system/FontManager.js +1 -1
- package/dist/stages/compose/font-system/FontManager.js.map +1 -1
- package/dist/stages/compose/font-system/font-templates.js +4 -4
- package/dist/stages/compose/font-system/font-templates.js.map +1 -1
- package/dist/stages/compose/font-system/types.d.ts +1 -1
- package/dist/stages/compose/font-system/types.d.ts.map +1 -1
- package/dist/stages/compose/instructions.d.ts +2 -2
- package/dist/stages/compose/instructions.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/basic-text-renderer.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/basic-text-renderer.js +9 -21
- package/dist/stages/compose/text-renderers/basic-text-renderer.js.map +1 -1
- package/dist/stages/compose/text-renderers/caption-stagger-entrance-renderer.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/caption-stagger-entrance-renderer.js +12 -21
- package/dist/stages/compose/text-renderers/caption-stagger-entrance-renderer.js.map +1 -1
- package/dist/stages/compose/text-renderers/character-ktv-renderer.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/character-ktv-renderer.js +9 -21
- package/dist/stages/compose/text-renderers/character-ktv-renderer.js.map +1 -1
- package/dist/stages/compose/text-renderers/word-by-word-renderer.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/word-by-word-renderer.js +13 -25
- package/dist/stages/compose/text-renderers/word-by-word-renderer.js.map +1 -1
- package/dist/stages/compose/text-renderers/word-fancy-renderer.d.ts.map +1 -1
- package/dist/stages/compose/text-renderers/word-fancy-renderer.js +9 -21
- package/dist/stages/compose/text-renderers/word-fancy-renderer.js.map +1 -1
- package/dist/stages/compose/text-utils/caption-layout.d.ts +1 -1
- package/dist/stages/compose/text-utils/caption-layout.d.ts.map +1 -1
- package/dist/stages/compose/text-utils/caption-layout.js +1 -1
- package/dist/stages/compose/text-utils/caption-layout.js.map +1 -1
- package/dist/stages/compose/text-utils/caption-position.d.ts +12 -0
- package/dist/stages/compose/text-utils/caption-position.d.ts.map +1 -0
- package/dist/stages/compose/text-utils/caption-position.js +21 -0
- package/dist/stages/compose/text-utils/caption-position.js.map +1 -0
- package/dist/stages/compose/text-utils/text-layout-cache.js +1 -1
- package/dist/stages/compose/text-utils/text-layout-cache.js.map +1 -1
- package/dist/stages/compose/types.d.ts +2 -2
- package/dist/stages/compose/types.d.ts.map +1 -1
- package/dist/stages/mux/MP4Muxer.js +1 -1
- package/dist/utils/mp4box.js +2 -3
- package/dist/workers/stages/export/{export.worker.p7X_YtxQ.js → export.worker.XX9XDu3o.js} +66 -111
- package/dist/workers/stages/export/export.worker.XX9XDu3o.js.map +1 -0
- package/dist/workers/worker-manifest.json +1 -1
- package/package.json +1 -1
- package/dist/medeo-fe/node_modules/.pnpm/mp4-muxer@5.2.2/node_modules/mp4-muxer/build/mp4-muxer.js.map +0 -1
- package/dist/medeo-fe/node_modules/.pnpm/mp4box@0.5.4/node_modules/mp4box/dist/mp4box.all.js.map +0 -1
- package/dist/workers/stages/export/export.worker.p7X_YtxQ.js.map +0 -1
- /package/dist/{medeo-fe → meframe-service}/node_modules/.pnpm/mp4-muxer@5.2.2/node_modules/mp4-muxer/build/mp4-muxer.js +0 -0
- /package/dist/{medeo-fe → meframe-service}/node_modules/.pnpm/mp4box@0.5.4/node_modules/mp4box/dist/mp4box.all.js +0 -0
|
@@ -525,6 +525,23 @@ function textAnimationFrameForTextLayer(layer, fallbackFrame, fps) {
|
|
|
525
525
|
}
|
|
526
526
|
return fallbackFrame;
|
|
527
527
|
}
|
|
528
|
+
function calculateCaptionStartY(canvasHeight, totalHeight, globalPosition) {
|
|
529
|
+
if (!globalPosition) {
|
|
530
|
+
return canvasHeight / 2 - totalHeight / 2;
|
|
531
|
+
}
|
|
532
|
+
if (globalPosition.top) {
|
|
533
|
+
const centerPercent = parseFloat(globalPosition.top) / 100;
|
|
534
|
+
return canvasHeight * centerPercent - totalHeight / 2;
|
|
535
|
+
}
|
|
536
|
+
if (globalPosition.bottom) {
|
|
537
|
+
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
538
|
+
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
539
|
+
}
|
|
540
|
+
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
541
|
+
return canvasHeight / 2 - totalHeight / 2;
|
|
542
|
+
}
|
|
543
|
+
return canvasHeight / 2 - totalHeight / 2;
|
|
544
|
+
}
|
|
528
545
|
function measureTextWidth(ctx, text, fontSize, fontFamily, fontWeight = 400) {
|
|
529
546
|
ctx.save();
|
|
530
547
|
ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
@@ -735,7 +752,7 @@ function basicTextRasterKey(layer, canvasWidth, canvasHeight) {
|
|
|
735
752
|
ts?.fontFamily,
|
|
736
753
|
ts?.fontWeight,
|
|
737
754
|
ts?.fill,
|
|
738
|
-
ts?.
|
|
755
|
+
ts?.strokeColor,
|
|
739
756
|
ts?.strokeWidth,
|
|
740
757
|
ts?.lineHeight,
|
|
741
758
|
JSON.stringify(layer.fontConfig?.globalPosition ?? null)
|
|
@@ -847,23 +864,6 @@ function needsSpaceBetweenWords(locale, text) {
|
|
|
847
864
|
}
|
|
848
865
|
return !["zh-CN", "ja-JP", "ko-KR"].includes(locale);
|
|
849
866
|
}
|
|
850
|
-
function calculateYPosition$4(canvasHeight, totalHeight, globalPosition) {
|
|
851
|
-
if (!globalPosition) {
|
|
852
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
853
|
-
}
|
|
854
|
-
if (globalPosition.top) {
|
|
855
|
-
const topPercent = parseFloat(globalPosition.top) / 100;
|
|
856
|
-
return canvasHeight * topPercent;
|
|
857
|
-
}
|
|
858
|
-
if (globalPosition.bottom) {
|
|
859
|
-
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
860
|
-
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
861
|
-
}
|
|
862
|
-
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
863
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
864
|
-
}
|
|
865
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
866
|
-
}
|
|
867
867
|
function drawBasicTextLines(ctx, layer, canvasWidth, canvasHeight, lines) {
|
|
868
868
|
const fontConfig = layer.fontConfig?.textStyle;
|
|
869
869
|
if (!fontConfig) return;
|
|
@@ -871,7 +871,7 @@ function drawBasicTextLines(ctx, layer, canvasWidth, canvasHeight, lines) {
|
|
|
871
871
|
const fontFamily = fontConfig.fontFamily;
|
|
872
872
|
const fontWeight = fontConfig.fontWeight;
|
|
873
873
|
const fill = fontConfig.fill;
|
|
874
|
-
const
|
|
874
|
+
const strokeColor = fontConfig.strokeColor;
|
|
875
875
|
const strokeWidth = fontConfig.strokeWidth || 0;
|
|
876
876
|
const lineHeight = fontConfig.lineHeight || 1.2;
|
|
877
877
|
ctx.save();
|
|
@@ -881,12 +881,16 @@ function drawBasicTextLines(ctx, layer, canvasWidth, canvasHeight, lines) {
|
|
|
881
881
|
ctx.lineJoin = "round";
|
|
882
882
|
ctx.lineCap = "round";
|
|
883
883
|
const totalHeight = lines.length * fontSize * lineHeight;
|
|
884
|
-
const startY =
|
|
884
|
+
const startY = calculateCaptionStartY(
|
|
885
|
+
canvasHeight,
|
|
886
|
+
totalHeight,
|
|
887
|
+
layer.fontConfig?.globalPosition
|
|
888
|
+
);
|
|
885
889
|
for (let i = 0; i < lines.length; i++) {
|
|
886
890
|
const line = lines[i];
|
|
887
891
|
const y = startY + i * fontSize * lineHeight + fontSize / 2;
|
|
888
|
-
if (
|
|
889
|
-
ctx.strokeStyle =
|
|
892
|
+
if (strokeColor && strokeWidth > 0) {
|
|
893
|
+
ctx.strokeStyle = strokeColor;
|
|
890
894
|
ctx.lineWidth = strokeWidth;
|
|
891
895
|
ctx.strokeText(line, canvasWidth / 2, y);
|
|
892
896
|
}
|
|
@@ -949,23 +953,6 @@ function easeOutExpo(t) {
|
|
|
949
953
|
if (t >= 1) return 1;
|
|
950
954
|
return 1 - Math.pow(2, -10 * t);
|
|
951
955
|
}
|
|
952
|
-
function calculateYPosition$3(canvasHeight, totalHeight, globalPosition) {
|
|
953
|
-
if (!globalPosition) {
|
|
954
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
955
|
-
}
|
|
956
|
-
if (globalPosition.top) {
|
|
957
|
-
const topPercent = parseFloat(globalPosition.top) / 100;
|
|
958
|
-
return canvasHeight * topPercent;
|
|
959
|
-
}
|
|
960
|
-
if (globalPosition.bottom) {
|
|
961
|
-
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
962
|
-
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
963
|
-
}
|
|
964
|
-
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
965
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
966
|
-
}
|
|
967
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
968
|
-
}
|
|
969
956
|
function charProgress(relativeFrame, fps, charIndex, staggerMs, durationMs) {
|
|
970
957
|
const tMs = relativeFrame / fps * 1e3;
|
|
971
958
|
const startMs = charIndex * staggerMs;
|
|
@@ -986,6 +973,9 @@ function layoutCacheKey(layer, canvasWidth, canvasHeight) {
|
|
|
986
973
|
ts?.fontSize,
|
|
987
974
|
ts?.fontFamily,
|
|
988
975
|
ts?.fontWeight,
|
|
976
|
+
ts?.fill,
|
|
977
|
+
ts?.strokeColor,
|
|
978
|
+
ts?.strokeWidth,
|
|
989
979
|
ts?.lineHeight,
|
|
990
980
|
JSON.stringify(layer.fontConfig?.globalPosition ?? null)
|
|
991
981
|
].join("");
|
|
@@ -1027,7 +1017,11 @@ function buildCharSlots(ctx, layer, canvasWidth, canvasHeight) {
|
|
|
1027
1017
|
lines = getCachedWrapText(ctx, text, maxWidth, fontSize, fontFamily, fontWeight);
|
|
1028
1018
|
}
|
|
1029
1019
|
const totalHeight = lines.length * fontSize * lineHeight;
|
|
1030
|
-
const startY =
|
|
1020
|
+
const startY = calculateCaptionStartY(
|
|
1021
|
+
canvasHeight,
|
|
1022
|
+
totalHeight,
|
|
1023
|
+
layer.fontConfig?.globalPosition
|
|
1024
|
+
);
|
|
1031
1025
|
ctx.save();
|
|
1032
1026
|
ctx.font = `${fontWeight} ${fontSize}px ${fontFamily}`;
|
|
1033
1027
|
const slots = [];
|
|
@@ -1070,7 +1064,7 @@ function drawStaggerEntranceFrame(ctx, layer, built, relativeFrame, fps, preset)
|
|
|
1070
1064
|
const fontFamily = fontConfig.fontFamily;
|
|
1071
1065
|
const fontWeight = fontConfig.fontWeight;
|
|
1072
1066
|
const fill = fontConfig.fill;
|
|
1073
|
-
const
|
|
1067
|
+
const strokeColor = fontConfig.strokeColor;
|
|
1074
1068
|
const strokeWidth = fontConfig.strokeWidth || 0;
|
|
1075
1069
|
const scalePx = fontSize / FONT_REF_PX;
|
|
1076
1070
|
const staggerMs = DEFAULT_STAGGER_MS;
|
|
@@ -1145,8 +1139,8 @@ function drawStaggerEntranceFrame(ctx, layer, built, relativeFrame, fps, preset)
|
|
|
1145
1139
|
} else {
|
|
1146
1140
|
ctx.scale(sc, sc);
|
|
1147
1141
|
}
|
|
1148
|
-
if (
|
|
1149
|
-
ctx.strokeStyle =
|
|
1142
|
+
if (strokeColor && strokeWidth > 0) {
|
|
1143
|
+
ctx.strokeStyle = strokeColor;
|
|
1150
1144
|
ctx.lineWidth = strokeWidth;
|
|
1151
1145
|
ctx.strokeText(slot.ch, 0, 0);
|
|
1152
1146
|
}
|
|
@@ -1190,23 +1184,6 @@ function renderCaptionStaggerEntrance(ctx, layer, canvasWidth, canvasHeight, rel
|
|
|
1190
1184
|
function usToFrame$2(us, fps) {
|
|
1191
1185
|
return Math.floor(us / (1e6 / fps));
|
|
1192
1186
|
}
|
|
1193
|
-
function calculateYPosition$2(canvasHeight, totalHeight, globalPosition) {
|
|
1194
|
-
if (!globalPosition) {
|
|
1195
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1196
|
-
}
|
|
1197
|
-
if (globalPosition.top) {
|
|
1198
|
-
const topPercent = parseFloat(globalPosition.top) / 100;
|
|
1199
|
-
return canvasHeight * topPercent;
|
|
1200
|
-
}
|
|
1201
|
-
if (globalPosition.bottom) {
|
|
1202
|
-
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
1203
|
-
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
1204
|
-
}
|
|
1205
|
-
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
1206
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1207
|
-
}
|
|
1208
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1209
|
-
}
|
|
1210
1187
|
function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame, fps = 30) {
|
|
1211
1188
|
const fontConfig = layer.fontConfig?.textStyle;
|
|
1212
1189
|
if (!fontConfig) return;
|
|
@@ -1214,11 +1191,11 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1214
1191
|
const fontFamily = fontConfig.fontFamily;
|
|
1215
1192
|
const fontWeight = fontConfig.fontWeight;
|
|
1216
1193
|
const fill = fontConfig.fill;
|
|
1217
|
-
const
|
|
1194
|
+
const strokeColor = fontConfig.strokeColor;
|
|
1218
1195
|
const strokeWidth = fontConfig.strokeWidth || 0;
|
|
1219
1196
|
const lineHeight = fontConfig.lineHeight || 1.2;
|
|
1220
1197
|
const highlightFill = layer.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)";
|
|
1221
|
-
const highlightStroke = layer.animation?.highlightTextStyle?.
|
|
1198
|
+
const highlightStroke = layer.animation?.highlightTextStyle?.strokeColor || strokeColor;
|
|
1222
1199
|
const maxWidth = canvasWidth * 0.64;
|
|
1223
1200
|
const text = getLetterCaseText(layer.text, layer.letterCase);
|
|
1224
1201
|
const needsSpace = needsSpaceBetweenWords(layer.localeCode || "en-US", text);
|
|
@@ -1235,7 +1212,11 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1235
1212
|
const wordPositions = [];
|
|
1236
1213
|
let wordIndex = 0;
|
|
1237
1214
|
const totalHeight = lines.length * fontSize * lineHeight;
|
|
1238
|
-
const startY =
|
|
1215
|
+
const startY = calculateCaptionStartY(
|
|
1216
|
+
canvasHeight,
|
|
1217
|
+
totalHeight,
|
|
1218
|
+
layer.fontConfig?.globalPosition
|
|
1219
|
+
);
|
|
1239
1220
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
1240
1221
|
const line = lines[lineIndex];
|
|
1241
1222
|
const lineWords = line.split(needsSpace ? /\s+/ : "");
|
|
@@ -1269,7 +1250,7 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1269
1250
|
ctx.lineCap = "round";
|
|
1270
1251
|
for (const wordPos of wordPositions) {
|
|
1271
1252
|
let currentFill = fill;
|
|
1272
|
-
let currentStroke =
|
|
1253
|
+
let currentStroke = strokeColor;
|
|
1273
1254
|
if (wordPos.timing) {
|
|
1274
1255
|
const { startFrame, endFrame } = wordPos.timing;
|
|
1275
1256
|
if (relativeFrame >= startFrame && relativeFrame <= endFrame) {
|
|
@@ -1283,8 +1264,8 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1283
1264
|
}
|
|
1284
1265
|
);
|
|
1285
1266
|
currentFill = interpolateColor(fill, highlightFill, transitionProgressIn);
|
|
1286
|
-
if (
|
|
1287
|
-
currentStroke = interpolateColor(
|
|
1267
|
+
if (strokeColor && highlightStroke) {
|
|
1268
|
+
currentStroke = interpolateColor(strokeColor, highlightStroke, transitionProgressIn);
|
|
1288
1269
|
}
|
|
1289
1270
|
} else if (relativeFrame > endFrame) {
|
|
1290
1271
|
const transitionProgressOut = interpolate(relativeFrame, [endFrame, endFrame + 3], [1, 0], {
|
|
@@ -1292,8 +1273,8 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1292
1273
|
extrapolateRight: "clamp"
|
|
1293
1274
|
});
|
|
1294
1275
|
currentFill = interpolateColor(fill, highlightFill, transitionProgressOut);
|
|
1295
|
-
if (
|
|
1296
|
-
currentStroke = interpolateColor(
|
|
1276
|
+
if (strokeColor && highlightStroke) {
|
|
1277
|
+
currentStroke = interpolateColor(strokeColor, highlightStroke, transitionProgressOut);
|
|
1297
1278
|
}
|
|
1298
1279
|
}
|
|
1299
1280
|
}
|
|
@@ -1310,23 +1291,6 @@ function renderWordByWord(ctx, layer, canvasWidth, canvasHeight, relativeFrame,
|
|
|
1310
1291
|
function usToFrame$1(us, fps) {
|
|
1311
1292
|
return Math.floor(us / (1e6 / fps));
|
|
1312
1293
|
}
|
|
1313
|
-
function calculateYPosition$1(canvasHeight, totalHeight, globalPosition) {
|
|
1314
|
-
if (!globalPosition) {
|
|
1315
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1316
|
-
}
|
|
1317
|
-
if (globalPosition.top) {
|
|
1318
|
-
const topPercent = parseFloat(globalPosition.top) / 100;
|
|
1319
|
-
return canvasHeight * topPercent;
|
|
1320
|
-
}
|
|
1321
|
-
if (globalPosition.bottom) {
|
|
1322
|
-
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
1323
|
-
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
1324
|
-
}
|
|
1325
|
-
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
1326
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1327
|
-
}
|
|
1328
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1329
|
-
}
|
|
1330
1294
|
function renderCharacterKTV(ctx, layer, canvasWidth, canvasHeight, relativeFrame, fps = 30) {
|
|
1331
1295
|
const fontConfig = layer.fontConfig?.textStyle;
|
|
1332
1296
|
if (!fontConfig) return;
|
|
@@ -1334,7 +1298,7 @@ function renderCharacterKTV(ctx, layer, canvasWidth, canvasHeight, relativeFrame
|
|
|
1334
1298
|
const fontFamily = fontConfig.fontFamily;
|
|
1335
1299
|
const fontWeight = fontConfig.fontWeight;
|
|
1336
1300
|
const baseFill = fontConfig.fill;
|
|
1337
|
-
const
|
|
1301
|
+
const strokeColor = fontConfig.strokeColor;
|
|
1338
1302
|
const strokeWidth = fontConfig.strokeWidth || 0;
|
|
1339
1303
|
const lineHeight = fontConfig.lineHeight || 1.2;
|
|
1340
1304
|
const highlightFill = layer.animation?.highlightTextStyle?.fill || "rgb(255, 215, 0)";
|
|
@@ -1398,7 +1362,11 @@ function renderCharacterKTV(ctx, layer, canvasWidth, canvasHeight, relativeFrame
|
|
|
1398
1362
|
ctx.lineJoin = "round";
|
|
1399
1363
|
ctx.lineCap = "round";
|
|
1400
1364
|
const totalHeight = fullTextLines.length * fontSize * lineHeight;
|
|
1401
|
-
const startY =
|
|
1365
|
+
const startY = calculateCaptionStartY(
|
|
1366
|
+
canvasHeight,
|
|
1367
|
+
totalHeight,
|
|
1368
|
+
layer.fontConfig?.globalPosition
|
|
1369
|
+
);
|
|
1402
1370
|
let charIndexInText = 0;
|
|
1403
1371
|
for (let lineIndex = 0; lineIndex < fullTextLines.length; lineIndex++) {
|
|
1404
1372
|
const line = fullTextLines[lineIndex];
|
|
@@ -1418,8 +1386,8 @@ function renderCharacterKTV(ctx, layer, canvasWidth, canvasHeight, relativeFrame
|
|
|
1418
1386
|
} else {
|
|
1419
1387
|
ctx.shadowBlur = 0;
|
|
1420
1388
|
}
|
|
1421
|
-
if (
|
|
1422
|
-
ctx.strokeStyle =
|
|
1389
|
+
if (strokeColor && strokeWidth > 0) {
|
|
1390
|
+
ctx.strokeStyle = strokeColor;
|
|
1423
1391
|
ctx.lineWidth = strokeWidth;
|
|
1424
1392
|
ctx.strokeText(char, currentX, y);
|
|
1425
1393
|
}
|
|
@@ -1435,23 +1403,6 @@ function renderCharacterKTV(ctx, layer, canvasWidth, canvasHeight, relativeFrame
|
|
|
1435
1403
|
function usToFrame(us, fps) {
|
|
1436
1404
|
return Math.floor(us / (1e6 / fps));
|
|
1437
1405
|
}
|
|
1438
|
-
function calculateYPosition(canvasHeight, totalHeight, globalPosition) {
|
|
1439
|
-
if (!globalPosition) {
|
|
1440
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1441
|
-
}
|
|
1442
|
-
if (globalPosition.top) {
|
|
1443
|
-
const topPercent = parseFloat(globalPosition.top) / 100;
|
|
1444
|
-
return canvasHeight * topPercent;
|
|
1445
|
-
}
|
|
1446
|
-
if (globalPosition.bottom) {
|
|
1447
|
-
const bottomPercent = parseFloat(globalPosition.bottom) / 100;
|
|
1448
|
-
return canvasHeight * (1 - bottomPercent) - totalHeight;
|
|
1449
|
-
}
|
|
1450
|
-
if (globalPosition.justifyContent === "center" || globalPosition.alignItems === "center") {
|
|
1451
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1452
|
-
}
|
|
1453
|
-
return canvasHeight / 2 - totalHeight / 2;
|
|
1454
|
-
}
|
|
1455
1406
|
function renderWordByWordFancy(ctx, layer, canvasWidth, canvasHeight, relativeFrame, fps = 30) {
|
|
1456
1407
|
const fontConfig = layer.fontConfig?.textStyle;
|
|
1457
1408
|
if (!fontConfig) return;
|
|
@@ -1459,7 +1410,7 @@ function renderWordByWordFancy(ctx, layer, canvasWidth, canvasHeight, relativeFr
|
|
|
1459
1410
|
const fontFamily = fontConfig.fontFamily;
|
|
1460
1411
|
const fontWeight = fontConfig.fontWeight;
|
|
1461
1412
|
const fill = fontConfig.fill;
|
|
1462
|
-
const
|
|
1413
|
+
const strokeColor = fontConfig.strokeColor;
|
|
1463
1414
|
const strokeWidth = fontConfig.strokeWidth || 0;
|
|
1464
1415
|
const lineHeight = fontConfig.lineHeight || 1.2;
|
|
1465
1416
|
const highlightBackgroundColor = layer.animation?.highlightColor || "rgb(255, 215, 0)";
|
|
@@ -1479,7 +1430,11 @@ function renderWordByWordFancy(ctx, layer, canvasWidth, canvasHeight, relativeFr
|
|
|
1479
1430
|
const wordPositions = [];
|
|
1480
1431
|
let wordIndex = 0;
|
|
1481
1432
|
const totalHeight = lines.length * fontSize * lineHeight;
|
|
1482
|
-
const startY =
|
|
1433
|
+
const startY = calculateCaptionStartY(
|
|
1434
|
+
canvasHeight,
|
|
1435
|
+
totalHeight,
|
|
1436
|
+
layer.fontConfig?.globalPosition
|
|
1437
|
+
);
|
|
1483
1438
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
|
|
1484
1439
|
const line = lines[lineIndex];
|
|
1485
1440
|
const lineWords = line.split(needsSpace ? /\s+/ : "");
|
|
@@ -1549,8 +1504,8 @@ function renderWordByWordFancy(ctx, layer, canvasWidth, canvasHeight, relativeFr
|
|
|
1549
1504
|
ctx.restore();
|
|
1550
1505
|
}
|
|
1551
1506
|
}
|
|
1552
|
-
if (
|
|
1553
|
-
ctx.strokeStyle =
|
|
1507
|
+
if (strokeColor && strokeWidth > 0) {
|
|
1508
|
+
ctx.strokeStyle = strokeColor;
|
|
1554
1509
|
ctx.lineWidth = strokeWidth;
|
|
1555
1510
|
ctx.strokeText(wordPos.text, wordPos.x, wordPos.y);
|
|
1556
1511
|
}
|
|
@@ -3545,4 +3500,4 @@ const export_worker = null;
|
|
|
3545
3500
|
export {
|
|
3546
3501
|
export_worker as default
|
|
3547
3502
|
};
|
|
3548
|
-
//# sourceMappingURL=export.worker.
|
|
3503
|
+
//# sourceMappingURL=export.worker.XX9XDu3o.js.map
|