Skip to content

🎥 Make videos programmatically with React

Merge remote-tracking branch 'origin/main' into codex/8308-selected-arrow-keys

Jonny Burger9438c5c50577
diff --cc packages/studio/src/test/timeline-selection.test.ts
index 773f48fb86,3fa3412c4a..2524ac220f
--- a/packages/studio/src/test/timeline-selection.test.ts
+++ b/packages/studio/src/test/timeline-selection.test.ts
@@@ -1977,70 -1979,27 +1980,91 @@@ test('Selected outline dragging can loc
).toEqual({deltaX: 12, deltaY: 13});
});
+test('Selected outline keyboard nudging moves horizontally by one or ten pixels', () => {
+ const schema = {
+ 'style.translate': {type: 'translate', default: '0px 0px'},
+ } satisfies SequenceSchema;
+ const nodePath = makeKey(['body', 0]);
+ const dragStates = [
+ {
+ defaultValue: JSON.stringify('0px 0px'),
+ key: Internals.makeSequencePropsSubscriptionKey(nodePath),
+ sourceFrame: 12,
+ startX: 10,
+ startY: 20,
+ target: {
+ clientId: 'client',
+ propStatus: {status: 'static', codeValue: '10px 20px'},
+ fieldDefault: '0px 0px',
+ keyframeDisplayOffset: 30,
+ nodePath,
+ schema,
+ },
+ },
+ ] satisfies SelectedOutlineDragState[];
+
+ expect(
+ getSelectedOutlineKeyboardNudgeDelta({
+ direction: 'left',
+ shiftKey: false,
+ }),
+ ).toBe(-1);
+ expect(
+ getSelectedOutlineKeyboardNudgeDelta({
+ direction: 'right',
+ shiftKey: true,
+ }),
+ ).toBe(10);
+
+ const lastValues = getSelectedOutlineDragValues({
+ dragStates,
+ deltaX: getSelectedOutlineKeyboardNudgeDelta({
+ direction: 'right',
+ shiftKey: true,
+ }),
+ deltaY: 0,
+ });
+
+ expect(lastValues.get(dragStates[0].key)).toBe('20px 20px');
+ expect(
+ getSelectedOutlineDragChanges({
+ dragStates,
+ lastValues,
+ }),
+ ).toEqual([
+ {
+ type: 'static',
+ fileName: '/project/src/Comp.tsx',
+ nodePath,
+ fieldKey: 'style.translate',
+ value: '20px 20px',
+ defaultValue: JSON.stringify('0px 0px'),
+ schema,
+ },
+ ]);
+});
+
+ test('Selected outline dragging starts after a screen pixel threshold', () => {
+ expect(
+ isSelectedOutlineDragPastThreshold({
+ deltaX: selectedOutlineDragThresholdPx - 0.1,
+ deltaY: 0,
+ }),
+ ).toBe(false);
+ expect(
+ isSelectedOutlineDragPastThreshold({
+ deltaX: selectedOutlineDragThresholdPx,
+ deltaY: 0,
+ }),
+ ).toBe(true);
+ expect(
+ isSelectedOutlineDragPastThreshold({
+ deltaX: 3,
+ deltaY: 3,
+ }),
+ ).toBe(true);
+ });
+
test('Selected outline dragging keyframed translate adds a keyframe at the source frame', () => {
const schema = {
'style.translate': {type: 'translate', default: '0px 0px'},