@shotstack/shotstack-canvas 1.1.2 → 1.1.3
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/entry.node.cjs +6 -3
- package/dist/entry.node.cjs.map +1 -1
- package/dist/entry.node.js +6 -3
- package/dist/entry.node.js.map +1 -1
- package/dist/entry.web.js +2 -2
- package/dist/entry.web.js.map +1 -1
- package/package.json +1 -1
package/dist/entry.node.js
CHANGED
|
@@ -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,10 @@ async function createNodePainter(opts) {
|
|
|
1167
1168
|
canvas.height = wantH;
|
|
1168
1169
|
}
|
|
1169
1170
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
1170
|
-
|
|
1171
|
-
|
|
1171
|
+
ctx.save();
|
|
1172
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
1173
|
+
ctx.restore();
|
|
1174
|
+
if (op.bg && op.bg.color) {
|
|
1172
1175
|
const { color, opacity, radius } = op.bg;
|
|
1173
1176
|
if (color) {
|
|
1174
1177
|
const c = parseHex6(color, opacity);
|