@shotstack/shotstack-canvas 1.6.1 → 1.6.2

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.
@@ -2604,9 +2604,13 @@ async function createTextEngine(opts = {}) {
2604
2604
  console.log(
2605
2605
  `\u{1F3A8} Video settings: Animation=${hasAnimation}, Background=${hasBackground}, BorderRadius=${hasBorderRadius}, Alpha=${needsAlpha}`
2606
2606
  );
2607
+ const padding = asset.padding ? typeof asset.padding === "number" ? { left: asset.padding, right: asset.padding, top: asset.padding, bottom: asset.padding } : asset.padding : { left: 0, right: 0, top: 0, bottom: 0 };
2608
+ const borderWidth = asset.border?.width ?? 0;
2609
+ const canvasWidth = (asset.width ?? width) + padding.left + padding.right + borderWidth * 2;
2610
+ const canvasHeight = (asset.height ?? height) + padding.top + padding.bottom + borderWidth * 2;
2607
2611
  const finalOptions = {
2608
- width: asset.width ?? width,
2609
- height: asset.height ?? height,
2612
+ width: canvasWidth,
2613
+ height: canvasHeight,
2610
2614
  fps,
2611
2615
  duration: options.duration ?? 3,
2612
2616
  outputPath: options.outputPath ?? "output.mp4",
@@ -2565,9 +2565,13 @@ async function createTextEngine(opts = {}) {
2565
2565
  console.log(
2566
2566
  `\u{1F3A8} Video settings: Animation=${hasAnimation}, Background=${hasBackground}, BorderRadius=${hasBorderRadius}, Alpha=${needsAlpha}`
2567
2567
  );
2568
+ const padding = asset.padding ? typeof asset.padding === "number" ? { left: asset.padding, right: asset.padding, top: asset.padding, bottom: asset.padding } : asset.padding : { left: 0, right: 0, top: 0, bottom: 0 };
2569
+ const borderWidth = asset.border?.width ?? 0;
2570
+ const canvasWidth = (asset.width ?? width) + padding.left + padding.right + borderWidth * 2;
2571
+ const canvasHeight = (asset.height ?? height) + padding.top + padding.bottom + borderWidth * 2;
2568
2572
  const finalOptions = {
2569
- width: asset.width ?? width,
2570
- height: asset.height ?? height,
2573
+ width: canvasWidth,
2574
+ height: canvasHeight,
2571
2575
  fps,
2572
2576
  duration: options.duration ?? 3,
2573
2577
  outputPath: options.outputPath ?? "output.mp4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/shotstack-canvas",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "description": "Text layout & animation engine (HarfBuzz) for Node & Web - fully self-contained.",
5
5
  "type": "module",
6
6
  "main": "./dist/entry.node.cjs",