🎥 Make videos programmatically with React
Use larger steps for round font weights
Jonny Burgerd45eb5a8f97e
diff --git a/packages/example/e2e/font-weight-controls.test.mts b/packages/example/e2e/font-weight-controls.test.mtsindex 9e1e075b9d..8ed56c16bc 100644--- a/packages/example/e2e/font-weight-controls.test.mts+++ b/packages/example/e2e/font-weight-controls.test.mts@@ -31,6 +31,21 @@ test.describe('font weight controls', () => {await page.goto(`${STUDIO_URL}/font-weight-controls`);await expect(page).toHaveURL(/font-weight-controls/, {timeout: 15_000});+ await page+ .locator('[data-timeline-marquee-item][title="Hundreds font weight"]')+ .click();+ const hundredsControl = page.getByRole('button', {+ name: '700',+ exact: true,+ });+ await expect(hundredsControl).toBeVisible();+ await hundredsControl.click();+ await page.locator('input[value="700"]').press('ArrowUp');+ await page.keyboard.press('Enter');+ await expect+ .poll(() => fs.readFileSync(compositionFile, 'utf-8'))+ .toContain('fontWeight: 800');+await page.locator('[data-timeline-marquee-item][title="Numeric font weight"]').click();@@ -40,11 +55,11 @@ test.describe('font weight controls', () => {});await expect(numericControl).toBeVisible();await numericControl.click();- await page.locator('input[value="650"]').fill('675');+ await page.locator('input[value="650"]').fill('450');await page.keyboard.press('Enter');await expect.poll(() => fs.readFileSync(compositionFile, 'utf-8'))- .toContain('fontWeight: 675');+ .toContain('fontWeight: 450');await page.locator('[data-timeline-marquee-item][title="String font weight"]')diff --git a/packages/example/src/VisualModeTests/FontWeightControls.tsx b/packages/example/src/VisualModeTests/FontWeightControls.tsxindex 41febf1bd8..899f1f3191 100644--- a/packages/example/src/VisualModeTests/FontWeightControls.tsx+++ b/packages/example/src/VisualModeTests/FontWeightControls.tsx@@ -7,7 +7,7 @@ const rowStyle: React.CSSProperties = {display: 'flex',flex: 1,fontFamily: 'sans-serif',- fontSize: 64,+ fontSize: 48,justifyContent: 'center',};@@ -17,10 +17,20 @@ export const FontWeightControls: React.FC = () => {style={{backgroundColor: '#0f172a',color: '#f8fafc',- gap: 24,- padding: 80,+ gap: 16,+ padding: 60,}}>+ <Interactive.Div+ name="Hundreds font weight"+ style={{+ ...rowStyle,+ backgroundColor: '#0369a1',+ fontWeight: 700,+ }}+ >+ Hundreds: 700+ </Interactive.Div><Interactive.Divname="Numeric font weight"style={{diff --git a/packages/studio/src/components/Timeline/TimelineNumberField.tsx b/packages/studio/src/components/Timeline/TimelineNumberField.tsxindex 1a25e7fec6..97d3f43db6 100644--- a/packages/studio/src/components/Timeline/TimelineNumberField.tsx+++ b/packages/studio/src/components/Timeline/TimelineNumberField.tsx@@ -64,8 +64,13 @@ export const TimelineNumberField: React.FC<{const configuredStep =field.fieldSchema.type === 'number' ? field.fieldSchema.step : undefined;- const step = configuredStep ?? 1;+ const currentValue = dragValue ?? (effectiveValue as number);+ const step =+ field.fieldSchema.type === 'font-weight' && currentValue % 100 === 0+ ? 100+ : (configuredStep ?? 1);const allowStepMismatch =+ field.fieldSchema.type === 'font-weight' ||field.group === 'crop' ||('kind' in field && field.kind === 'effect-field');@@ -82,7 +87,7 @@ export const TimelineNumberField: React.FC<{return (<InputDraggertype="number"- value={dragValue ?? (effectiveValue as number)}+ value={currentValue}buttonStyle={leftAlignedDraggerStyle}style={draggerStyle}status="ok"