Skip to content

🎥 Make videos programmatically with React

Update draw-border.ts

JonnyBurger45e806829bc2
diff --git a/packages/web-renderer/src/drawing/draw-border.ts b/packages/web-renderer/src/drawing/draw-border.ts
index 6c230fda31..965035e261 100644
--- a/packages/web-renderer/src/drawing/draw-border.ts
+++ b/packages/web-renderer/src/drawing/draw-border.ts
@@ -24,23 +24,31 @@ const getBorderSideProperties = (
return {
top: {
width: parseBorderWidth(computedStyle.borderTopWidth),
- color: computedStyle.borderTopColor || computedStyle.borderColor || 'black',
- style: computedStyle.borderTopStyle || computedStyle.borderStyle || 'solid',
+ color:
+ computedStyle.borderTopColor || computedStyle.borderColor || 'black',
+ style:
+ computedStyle.borderTopStyle || computedStyle.borderStyle || 'solid',
},
right: {
width: parseBorderWidth(computedStyle.borderRightWidth),
- color: computedStyle.borderRightColor || computedStyle.borderColor || 'black',
- style: computedStyle.borderRightStyle || computedStyle.borderStyle || 'solid',
+ color:
+ computedStyle.borderRightColor || computedStyle.borderColor || 'black',
+ style:
+ computedStyle.borderRightStyle || computedStyle.borderStyle || 'solid',
},
bottom: {
width: parseBorderWidth(computedStyle.borderBottomWidth),
- color: computedStyle.borderBottomColor || computedStyle.borderColor || 'black',
- style: computedStyle.borderBottomStyle || computedStyle.borderStyle || 'solid',
+ color:
+ computedStyle.borderBottomColor || computedStyle.borderColor || 'black',
+ style:
+ computedStyle.borderBottomStyle || computedStyle.borderStyle || 'solid',
},
left: {
width: parseBorderWidth(computedStyle.borderLeftWidth),
- color: computedStyle.borderLeftColor || computedStyle.borderColor || 'black',
- style: computedStyle.borderLeftStyle || computedStyle.borderStyle || 'solid',
+ color:
+ computedStyle.borderLeftColor || computedStyle.borderColor || 'black',
+ style:
+ computedStyle.borderLeftStyle || computedStyle.borderStyle || 'solid',
},
};
};
@@ -49,9 +57,11 @@ const getLineDashPattern = (style: string, width: number): number[] => {
if (style === 'dashed') {
return [width * 2, width];
}
+
if (style === 'dotted') {
return [width, width];
}
+
return [];
};
@@ -208,8 +218,10 @@ const drawCorner = ({
// Draw corner arc - use the average of the two adjacent borders
// In a more sophisticated implementation, we could blend the two borders
const avgWidth = (border1.width + border2.width) / 2;
- const useColor = border1.width >= border2.width ? border1.color : border2.color;
- const useStyle = border1.width >= border2.width ? border1.style : border2.style;
+ const useColor =
+ border1.width >= border2.width ? border1.color : border2.color;
+ const useStyle =
+ border1.width >= border2.width ? border1.style : border2.style;
if (avgWidth > 0 && useStyle !== 'none' && useStyle !== 'hidden') {
ctx.beginPath();