mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Add Zen mode for distraction free drawing (#1450)
This commit is contained in:
parent
71e7f130bc
commit
1866074c07
16 changed files with 222 additions and 39 deletions
|
@ -192,6 +192,7 @@ class App extends React.Component<any, AppState> {
|
|||
}
|
||||
|
||||
public render() {
|
||||
const { zenModeEnabled } = this.state;
|
||||
const canvasDOMWidth = window.innerWidth;
|
||||
const canvasDOMHeight = window.innerHeight;
|
||||
|
||||
|
@ -217,6 +218,8 @@ class App extends React.Component<any, AppState> {
|
|||
});
|
||||
}}
|
||||
onLockToggle={this.toggleLock}
|
||||
zenModeEnabled={zenModeEnabled}
|
||||
toggleZenMode={this.toggleZenMode}
|
||||
/>
|
||||
<main>
|
||||
<canvas
|
||||
|
@ -771,6 +774,12 @@ class App extends React.Component<any, AppState> {
|
|||
}));
|
||||
};
|
||||
|
||||
toggleZenMode = () => {
|
||||
this.setState({
|
||||
zenModeEnabled: !this.state.zenModeEnabled,
|
||||
});
|
||||
};
|
||||
|
||||
private destroySocketClient = () => {
|
||||
this.setState({
|
||||
isCollaborating: false,
|
||||
|
@ -1072,6 +1081,14 @@ class App extends React.Component<any, AppState> {
|
|||
});
|
||||
}
|
||||
|
||||
if (
|
||||
!event[KEYS.CTRL_OR_CMD] &&
|
||||
event.altKey &&
|
||||
event.keyCode === KEYS.Z_KEY_CODE
|
||||
) {
|
||||
this.toggleZenMode();
|
||||
}
|
||||
|
||||
if (event.code === "KeyC" && event.altKey && event.shiftKey) {
|
||||
this.copyToClipboardAsPng();
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue