mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 19:10:47 +02:00
Fix #5982 Behaviour of ctrl+r altered to support rotate on desktop, while the web version continue to use refresh as default.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { useViewer } from "@app/contexts/ViewerContext"
|
||||
import { useCallback } from "react";
|
||||
|
||||
export function useViewerKeyCommand(): (event: KeyboardEvent) => boolean {
|
||||
const { rotationActions } = useViewer();
|
||||
return useCallback((event:KeyboardEvent): boolean => {
|
||||
switch (event.key) {
|
||||
case 'r':
|
||||
case 'R':
|
||||
event.preventDefault();
|
||||
if (event.shiftKey) {
|
||||
rotationActions.rotateBackward();
|
||||
} else {
|
||||
rotationActions.rotateForward();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, [rotationActions]);
|
||||
}
|
||||
Reference in New Issue
Block a user