|
|
|
@ -116,6 +116,12 @@ async function paste(e, state, context) {
@@ -116,6 +116,12 @@ async function paste(e, state, context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function keydown(e, state, context) { |
|
|
|
|
if (config.debug_print) { |
|
|
|
|
console.debug('keydown', e.code); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const doing_things = (state.moving || state.drawing || state.erasing || state.colorpicking || state.imagemoving || state.imagescaling || state.linedrawing); |
|
|
|
|
|
|
|
|
|
if (e.code === 'Space' && !state.drawing) { |
|
|
|
|
state.spacedown = true; |
|
|
|
|
context.canvas.classList.add('movemode'); |
|
|
|
@ -124,18 +130,41 @@ function keydown(e, state, context) {
@@ -124,18 +130,41 @@ function keydown(e, state, context) {
|
|
|
|
|
zenmode(); |
|
|
|
|
} else if (e.code === 'ControlLeft' || e.paddingcode === 'ControlRight') { |
|
|
|
|
enter_picker_mode(state, context); |
|
|
|
|
} else if (e.code === 'KeyD') { |
|
|
|
|
} else if (e.code === 'Slash') { |
|
|
|
|
document.querySelector('.debug-window').classList.toggle('dhide'); |
|
|
|
|
e.preventDefault(); |
|
|
|
|
} else if (e.code === 'KeyZ') { |
|
|
|
|
if (e.ctrlKey) { |
|
|
|
|
queue_event(state, undo_event(state)); |
|
|
|
|
} else { |
|
|
|
|
state.zoomdown = true; |
|
|
|
|
} |
|
|
|
|
} else if (e.code === 'KeyS') { |
|
|
|
|
if (!doing_things) { |
|
|
|
|
switch_tool(state, document.querySelector('.tool[data-tool="pointer"]')); |
|
|
|
|
} |
|
|
|
|
} else if (e.code === 'KeyD') { |
|
|
|
|
if (!doing_things) { |
|
|
|
|
switch_tool(state, document.querySelector('.tool[data-tool="pencil"]')); |
|
|
|
|
} |
|
|
|
|
} else if (e.code === 'KeyE') { |
|
|
|
|
if (!doing_things) { |
|
|
|
|
switch_tool(state, document.querySelector('.tool[data-tool="eraser"]')); |
|
|
|
|
} |
|
|
|
|
} else if (e.code === 'KeyR') { |
|
|
|
|
if (!doing_things) { |
|
|
|
|
switch_tool(state, document.querySelector('.tool[data-tool="ruler"]')); |
|
|
|
|
} |
|
|
|
|
} else if (e.code === 'Esc') { |
|
|
|
|
cancel_everything(state, context); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function keyup(e, state, context) { |
|
|
|
|
if (config.debug_print) { |
|
|
|
|
console.debug('keydown', e.code); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (e.code === 'Space' && state.spacedown) { |
|
|
|
|
state.spacedown = false; |
|
|
|
|
state.moving = false; |
|
|
|
@ -784,3 +813,7 @@ async function on_drop(e, state, context) {
@@ -784,3 +813,7 @@ async function on_drop(e, state, context) {
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function cancel_everything(state, context) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|