Skip to content

🎥 Make videos programmatically with React

fix tests

Jonny Burger9167c729cd18
diff --git a/packages/shapes/src/test/make-circle.test.ts b/packages/shapes/src/test/make-circle.test.ts
index 3001fb8240..722d2467c1 100644
--- a/packages/shapes/src/test/make-circle.test.ts
+++ b/packages/shapes/src/test/make-circle.test.ts
@@ -7,5 +7,6 @@ test('Should be able to make a circle path', () => {
height: 100,
width: 100,
path: 'M 50 50 m -50 0 a 50 50 0 1 0 100 0 50 50 0 1 0 -100 0',
+ transformOrigin: '50 50',
});
});
diff --git a/packages/shapes/src/test/make-ellipse.test.ts b/packages/shapes/src/test/make-ellipse.test.ts
index 3f71bfb84c..f7e7de0903 100644
--- a/packages/shapes/src/test/make-ellipse.test.ts
+++ b/packages/shapes/src/test/make-ellipse.test.ts
@@ -7,5 +7,6 @@ test('Should be able to make a circle path', () => {
path: 'M 100 0 a 100 50 0 1 0 1 0',
height: 100,
width: 200,
+ transformOrigin: '100 50',
});
});
diff --git a/packages/shapes/src/test/make-rect.test.ts b/packages/shapes/src/test/make-rect.test.ts
index cc09416c8f..602481edb9 100644
--- a/packages/shapes/src/test/make-rect.test.ts
+++ b/packages/shapes/src/test/make-rect.test.ts
@@ -7,5 +7,6 @@ test('Should be able to make a rect path', () => {
height: 100,
width: 100,
path: 'M 0 0 l 100 0 l 0 100 l -100 0 Z',
+ transformOrigin: '50 50',
});
});
diff --git a/packages/shapes/src/test/make-triangle.test.ts b/packages/shapes/src/test/make-triangle.test.ts
index 4b7a166319..5a735b14e8 100644
--- a/packages/shapes/src/test/make-triangle.test.ts
+++ b/packages/shapes/src/test/make-triangle.test.ts
@@ -10,5 +10,6 @@ test('Should be able to make a triangle path', () => {
width: 86.60254037844386,
height: 100,
path: 'M 0 0 L 0 100 L 86.60254037844386 50 z',
+ transformOrigin: '28.867513459481287 50',
});
});
diff --git a/packages/shapes/src/utils/make-circle.ts b/packages/shapes/src/utils/make-circle.ts
index b39215625e..416406c532 100644
--- a/packages/shapes/src/utils/make-circle.ts
+++ b/packages/shapes/src/utils/make-circle.ts
@@ -1,4 +1,3 @@
-import {makeEllipse} from './make-ellipse';
import type {ShapeInfo} from './shape-info';
export type MakeCircleProps = {
@@ -6,5 +5,12 @@ export type MakeCircleProps = {
};
export const makeCircle = ({radius}: MakeCircleProps): ShapeInfo => {
- return makeEllipse({rx: radius, ry: radius});
+ return {
+ height: radius * 2,
+ width: radius * 2,
+ path: `M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${
+ (radius as number) * 2
+ } 0 ${radius} ${radius} 0 1 0 ${-radius * 2} 0`,
+ transformOrigin: `${radius} ${radius}`,
+ };
};