@clypra/engine 1.1.0 → 1.1.1
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.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ __export(index_exports, {
|
|
|
87
87
|
createPulseOpacityTrack: () => createPulseOpacityTrack,
|
|
88
88
|
defaultConfig: () => defaultConfig,
|
|
89
89
|
deleteKeyframe: () => deleteKeyframe,
|
|
90
|
+
disposeSharedCompositor: () => disposeSharedCompositor,
|
|
90
91
|
downloadDotLottie: () => downloadDotLottie,
|
|
91
92
|
downloadLottieJson: () => downloadLottieJson,
|
|
92
93
|
downloadPngSequenceZip: () => downloadPngSequenceZip,
|
|
@@ -296,7 +297,7 @@ function layoutWithFontSize(ctx, cfg, fontSize, lines) {
|
|
|
296
297
|
ctx.font = fontStr;
|
|
297
298
|
const lineWidths = lines.map((line) => measureLine(ctx, line, letterSpacing));
|
|
298
299
|
const maxLineWidth = Math.max(...lineWidths, 1);
|
|
299
|
-
const textBlockHeight = fontSize
|
|
300
|
+
const textBlockHeight = lines.length === 1 ? fontSize : (lines.length - 1) * fontSize * lineHeight + fontSize;
|
|
300
301
|
let align = "center";
|
|
301
302
|
let startX = cWidth / 2;
|
|
302
303
|
if (cfg.textPosX === "left") {
|
|
@@ -557,9 +558,8 @@ function createCanvas(width, height) {
|
|
|
557
558
|
}
|
|
558
559
|
function releaseCanvas(canvas) {
|
|
559
560
|
if (canvas instanceof OffscreenCanvas) return;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}
|
|
561
|
+
canvas.width = 0;
|
|
562
|
+
canvas.height = 0;
|
|
563
563
|
}
|
|
564
564
|
function _resetPlatformCache() {
|
|
565
565
|
_ctxFilter = null;
|
|
@@ -2086,7 +2086,7 @@ function renderTextEffectCore(ctx, cfg) {
|
|
|
2086
2086
|
ctx.globalCompositeOperation = "source-atop";
|
|
2087
2087
|
const renderCount = Math.max(1, Math.min(20, layer2.strength ?? 1));
|
|
2088
2088
|
for (let i = 0; i < renderCount; i++) {
|
|
2089
|
-
renderWithShadowTrick("fill", layer2.color, layer2.blur, 0, 0, layer2.opacity, "
|
|
2089
|
+
renderWithShadowTrick("fill", layer2.color, layer2.blur, 0, 0, layer2.opacity, "#000000", layer2.spread ?? 0);
|
|
2090
2090
|
}
|
|
2091
2091
|
ctx.restore();
|
|
2092
2092
|
}
|
|
@@ -2094,7 +2094,7 @@ function renderTextEffectCore(ctx, cfg) {
|
|
|
2094
2094
|
if (shadowEnabled && shadowType === "inner" && shadowOpacity > 0) {
|
|
2095
2095
|
ctx.save();
|
|
2096
2096
|
ctx.globalCompositeOperation = "source-atop";
|
|
2097
|
-
renderWithShadowTrick("fill", shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, "
|
|
2097
|
+
renderWithShadowTrick("fill", shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, "#000000");
|
|
2098
2098
|
ctx.restore();
|
|
2099
2099
|
}
|
|
2100
2100
|
if (isGlitch) {
|
|
@@ -2527,12 +2527,8 @@ async function initializeFontSystem() {
|
|
|
2527
2527
|
}
|
|
2528
2528
|
}
|
|
2529
2529
|
function checkFontVariant(variantName) {
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
if (!ctx) return false;
|
|
2533
|
-
ctx.font = `16px "${variantName}"`;
|
|
2534
|
-
const metrics = ctx.measureText("Test");
|
|
2535
|
-
return metrics.width > 0;
|
|
2530
|
+
if (typeof document === "undefined" || !document.fonts) return false;
|
|
2531
|
+
return document.fonts.check(`16px "${variantName}"`);
|
|
2536
2532
|
}
|
|
2537
2533
|
|
|
2538
2534
|
// src/engine/timelineDefaults.ts
|
|
@@ -3190,6 +3186,10 @@ function getCompositor() {
|
|
|
3190
3186
|
}
|
|
3191
3187
|
return sharedCompositor;
|
|
3192
3188
|
}
|
|
3189
|
+
function disposeSharedCompositor() {
|
|
3190
|
+
sharedCompositor?.dispose();
|
|
3191
|
+
sharedCompositor = null;
|
|
3192
|
+
}
|
|
3193
3193
|
function evaluateScene(doc, time, ctx, options = {}) {
|
|
3194
3194
|
const animated = applyTimelineAtTime(doc, time);
|
|
3195
3195
|
const cfg = sceneToConfig(animated);
|
|
@@ -6284,6 +6284,7 @@ function duplicateTrackAtPlayhead(doc, trackIndex, previewTime) {
|
|
|
6284
6284
|
createPulseOpacityTrack,
|
|
6285
6285
|
defaultConfig,
|
|
6286
6286
|
deleteKeyframe,
|
|
6287
|
+
disposeSharedCompositor,
|
|
6287
6288
|
downloadDotLottie,
|
|
6288
6289
|
downloadLottieJson,
|
|
6289
6290
|
downloadPngSequenceZip,
|