@shotstack/shotstack-canvas 1.1.2 → 1.1.4

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.
@@ -529,7 +529,7 @@ async function buildDrawOps(p) {
529
529
  height: p.canvas.height,
530
530
  pixelRatio: p.canvas.pixelRatio,
531
531
  clear: true,
532
- bg: p.background ? { color: p.background.color, opacity: p.background.opacity, radius: p.background.borderRadius } : void 0
532
+ bg: p.background && p.background.color ? { color: p.background.color, opacity: p.background.opacity, radius: p.background.borderRadius } : void 0
533
533
  });
534
534
  if (p.lines.length === 0) return ops;
535
535
  const upem = Math.max(1, await p.getUnitsPerEm());
@@ -1159,6 +1159,7 @@ async function createNodePainter(opts) {
1159
1159
  const globalBox = computeGlobalTextBounds(ops);
1160
1160
  for (const op of ops) {
1161
1161
  if (op.op === "BeginFrame") {
1162
+ if (op.clear) ctx.clearRect(0, 0, op.width, op.height);
1162
1163
  const dpr = op.pixelRatio ?? opts.pixelRatio;
1163
1164
  const wantW = Math.floor(op.width * dpr);
1164
1165
  const wantH = Math.floor(op.height * dpr);
@@ -1167,8 +1168,7 @@ async function createNodePainter(opts) {
1167
1168
  canvas.height = wantH;
1168
1169
  }
1169
1170
  ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1170
- if (op.clear) ctx.clearRect(0, 0, op.width, op.height);
1171
- if (op.bg) {
1171
+ if (op.bg && op.bg.color) {
1172
1172
  const { color, opacity, radius } = op.bg;
1173
1173
  if (color) {
1174
1174
  const c = parseHex6(color, opacity);