Skip to content

🎥 Make videos programmatically with React

Hide scale controls for tiny outlines

JonnyBurgerd27663db53f4
diff --git a/packages/studio/src/components/selected-outline-control-layout.ts b/packages/studio/src/components/selected-outline-control-layout.ts
index 85b2c3c58b..4fb6f34b12 100644
--- a/packages/studio/src/components/selected-outline-control-layout.ts
+++ b/packages/studio/src/components/selected-outline-control-layout.ts
@@ -91,16 +91,11 @@ export const getSelectedOutlineControlLayout = (
const rotationHandleRadius = Math.max(targetHalfSizeX, targetHalfSizeY) * 1.5;
const scaleEdges = (['top', 'right', 'bottom', 'left'] as const).filter(
(edge) => {
- // Preserve one scale control per axis when opposite edge targets would overlap.
- if (edge === 'top') {
+ if (edge === 'top' || edge === 'bottom') {
return !isTinyY;
}
- if (edge === 'left') {
- return !isTinyX;
- }
-
- return true;
+ return !isTinyX;
},
);
const rotationCorners = (
diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.ts
index 60cc77ca06..2b3caad683 100644
--- a/packages/studio/src/test/timeline-selection.test.ts
+++ b/packages/studio/src/test/timeline-selection.test.ts
@@ -7214,6 +7214,12 @@ test('Selected outline controls adapt to the screen-space outline size', () => {
{x: 8, y: 40},
{x: 0, y: 40},
]);
+ const flat = getSelectedOutlineControlLayout([
+ {x: 0, y: 0},
+ {x: 40, y: 0},
+ {x: 40, y: 8},
+ {x: 0, y: 8},
+ ]);
expect(normal.scaleEdges).toEqual(['top', 'right', 'bottom', 'left']);
expect(normal.scaleHitWidth).toEqual({horizontal: 9, vertical: 9});
@@ -7224,11 +7230,14 @@ test('Selected outline controls adapt to the screen-space outline size', () => {
expect(small.scaleHitWidth).toEqual({horizontal: 4.5, vertical: 4.5});
expect(small.rotationHandleRadius).toBe(3.375);
expect(small.rotationCorners).toHaveLength(4);
- expect(tiny.scaleEdges).toEqual(['right', 'bottom']);
+ expect(tiny.scaleEdges).toEqual([]);
expect(tiny.rotationCorners).toEqual([]);
- expect(thin.scaleEdges).toEqual(['top', 'right', 'bottom']);
+ expect(thin.scaleEdges).toEqual(['top', 'bottom']);
expect(thin.scaleHitWidth).toEqual({horizontal: 9, vertical: 4.5});
expect(thin.rotationCorners).toEqual([]);
+ expect(flat.scaleEdges).toEqual(['right', 'left']);
+ expect(flat.scaleHitWidth).toEqual({horizontal: 4.5, vertical: 9});
+ expect(flat.rotationCorners).toEqual([]);
});
test('Selected outline rotation pivot follows transform origin', () => {