forked from sleepy-zone/fabritor-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e24ec81
commit b72fe42
Showing
7 changed files
with
79 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import hotkeys from 'hotkeys-js'; | ||
import { copyObjecy, pasteObject, removeObject } from '@/utils/helper'; | ||
let _clipboard; | ||
export default function initHotKey (canvas) { | ||
// @ts-ignore | ||
hotkeys('ctrl+c,command+c', async (event) => { | ||
event.preventDefault(); | ||
_clipboard = await copyObjecy(canvas); | ||
}); | ||
hotkeys('ctrl+v,command+v', (event) => { | ||
event.preventDefault(); | ||
if (_clipboard) { | ||
pasteObject(_clipboard, canvas); | ||
} | ||
}); | ||
hotkeys('delete,del,backspace', (event) => { | ||
event.preventDefault(); | ||
removeObject(canvas.getActiveObject(), canvas); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters