Skip to content

🎥 Make videos programmatically with React

outline same as before

Jonny Burgere86a6db9baa9
diff --git a/packages/web-renderer/src/drawing/draw-outline.ts b/packages/web-renderer/src/drawing/draw-outline.ts
index 866c96cc5e..d1528879a5 100644
--- a/packages/web-renderer/src/drawing/draw-outline.ts
+++ b/packages/web-renderer/src/drawing/draw-outline.ts
@@ -64,13 +64,60 @@ export const drawOutline = ({
const outlineY = rect.top - offset;
const outlineW = rect.width + offset * 2;
const outlineH = rect.height + offset * 2;
+
+ // Adjust border radius for the outline offset
+ // When outline-offset is positive, we need to expand the radius
+ // When outline-offset is negative, we need to shrink the radius
+ const adjustedBorderRadius = {
+ topLeft: {
+ horizontal:
+ borderRadius.topLeft.horizontal === 0
+ ? 0
+ : Math.max(0, borderRadius.topLeft.horizontal + offset),
+ vertical:
+ borderRadius.topLeft.vertical === 0
+ ? 0
+ : Math.max(0, borderRadius.topLeft.vertical + offset),
+ },
+ topRight: {
+ horizontal:
+ borderRadius.topRight.horizontal === 0
+ ? 0
+ : Math.max(0, borderRadius.topRight.horizontal + offset),
+ vertical:
+ borderRadius.topRight.vertical === 0
+ ? 0
+ : Math.max(0, borderRadius.topRight.vertical + offset),
+ },
+ bottomRight: {
+ horizontal:
+ borderRadius.bottomRight.horizontal === 0
+ ? 0
+ : Math.max(0, borderRadius.bottomRight.horizontal + offset),
+ vertical:
+ borderRadius.bottomRight.vertical === 0
+ ? 0
+ : Math.max(0, borderRadius.bottomRight.vertical + offset),
+ },
+ bottomLeft: {
+ horizontal:
+ borderRadius.bottomLeft.horizontal === 0
+ ? 0
+ : Math.max(0, borderRadius.bottomLeft.horizontal + offset),
+ vertical:
+ borderRadius.bottomLeft.vertical === 0
+ ? 0
+ : Math.max(0, borderRadius.bottomLeft.vertical + offset),
+ },
+ };
+
drawRoundedRectPath({
ctx,
x: outlineX,
y: outlineY,
width: outlineW,
height: outlineH,
- borderRadius,
+ borderRadius: adjustedBorderRadius,
});
ctx.stroke();
diff --git a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-chromium-darwin.png b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-chromium-darwin.png
index 5f5072a2b5..578c26e7eb 100644
Binary files a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-chromium-darwin.png and b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-chromium-darwin.png differ
diff --git a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-firefox-darwin.png b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-firefox-darwin.png
index 80ff63f0f8..4b5754354f 100644
Binary files a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-firefox-darwin.png and b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-firefox-darwin.png differ
diff --git a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-webkit-darwin.png b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-webkit-darwin.png
index df23cd34cb..aba4e36739 100644
Binary files a/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-webkit-darwin.png and b/packages/web-renderer/src/test/__screenshots__/outline.test.tsx/outline-webkit-darwin.png differ