Skip to content

Feature request - Custom keybindings #31

@ghost

Description

I would like the ability to set custom keybindings for the application. Currently, the code responsible for handling keybindings is as follows:

document.addEventListener('keyup', function(e) {
    // alt + Z or z
    if ((e.keyCode == 90 || e.keyCode == 122) && e.altKey) {
		e.preventDefault();
        ts_undo();
    }
    // /
    if (e.key === ".") {
        clear_canvas();
    }
	// ,
    if (e.key === ",") {
        switch_visibility();
    }
    // alt + C or c
    if ((e.key === "c" || e.key === "C") && e.altKey) {
        e.preventDefault();
        switch_drawing_mode();
    }
        // alt + X or x
    if ((e.key === "x" || e.key === "X") && e.altKey) {
        e.preventDefault();
        switch_perfect_freehand();
    }
    if ((e.key === "b" || e.key === "B") && e.altKey) {
        e.preventDefault();
        switch_small_canvas();
    }
})

I am not very experienced in JavaScript, but would it be possible to modify this to allow custom keybindings?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions