Full Screen mode (#1212)

This commit is contained in:
Mohit kumar Bajoria 2020-04-06 03:17:13 +05:30 committed by GitHub
parent 81b38d8808
commit 2de4fe29ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 7 deletions

View file

@ -4,6 +4,8 @@ import { ToolButton } from "../components/ToolButton";
import { t } from "../i18n";
import { showSelectedShapeActions } from "../element";
import { register } from "./register";
import { allowFullScreen, exitFullScreen, isFullScreen } from "../utils";
import { KEYS } from "../keys";
export const actionToggleCanvasMenu = register({
name: "toggleCanvasMenu",
@ -45,3 +47,19 @@ export const actionToggleEditMenu = register({
/>
),
});
export const actionFullScreen = register({
name: "toggleFullScreen",
perform: () => {
if (!isFullScreen()) {
allowFullScreen();
}
if (isFullScreen()) {
exitFullScreen();
}
return {
commitToHistory: false,
};
},
keyTest: (event) => event.keyCode === KEYS.F_KEY_CODE,
});

View file

@ -36,4 +36,8 @@ export {
} from "./actionExport";
export { actionCopyStyles, actionPasteStyles } from "./actionStyles";
export { actionToggleCanvasMenu, actionToggleEditMenu } from "./actionMenu";
export {
actionToggleCanvasMenu,
actionToggleEditMenu,
actionFullScreen,
} from "./actionMenu";

View file

@ -48,7 +48,8 @@ export type ActionName =
| "zoomIn"
| "zoomOut"
| "resetZoom"
| "changeFontFamily";
| "changeFontFamily"
| "toggleFullScreen";
export interface Action {
name: ActionName;