Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ const SHORTCUTS: ShortcutEntry[] = [
description: __( 'Rotate 90° clockwise' ),
keyCombination: { character: 'R' },
},
{
description: __( 'Rotate 90° counter-clockwise' ),
keyCombination: { modifier: 'shift', character: 'R' },
},
{
description: __( 'Flip horizontal' ),
keyCombination: { character: 'H' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,11 +896,11 @@ export class InteractionController {
}
case 'r':
case 'R': {
if ( e.metaKey || e.ctrlKey || e.altKey || e.shiftKey ) {
if ( e.metaKey || e.ctrlKey || e.altKey ) {
break;
}
e.preventDefault();
this.options.actions.snapRotate90( 1 );
this.options.actions.snapRotate90( e.shiftKey ? -1 : 1 );
break;
}
case 'h':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,18 @@ describe( 'InteractionController', () => {
expect( actionMocks.snapRotate90 ).toHaveBeenCalledWith( 1 );
} );

it.each( [ 'metaKey', 'ctrlKey', 'altKey', 'shiftKey' ] )(
it( 'calls snapRotate90 counter-clockwise on shift+r', () => {
const state = makeState( { rotation: 0 } );
const { controller } = createController( state );

controller.handleKeyDown(
createKeyboardEvent( 'r', { shiftKey: true } )
);

expect( actionMocks.snapRotate90 ).toHaveBeenCalledWith( -1 );
} );

it.each( [ 'metaKey', 'ctrlKey', 'altKey' ] )(
'does not rotate when %s is held with r',
( modifier ) => {
const state = makeState( { rotation: 0 } );
Expand Down
Loading