|
|
|
@ -145,7 +145,7 @@ function keydown(e, state, context) {
@@ -145,7 +145,7 @@ function keydown(e, state, context) {
|
|
|
|
|
} else if (e.code === 'Tab') { |
|
|
|
|
e.preventDefault(); |
|
|
|
|
zenmode(); |
|
|
|
|
} else if (e.code === 'ControlLeft' || e.code === 'ControlRight') { |
|
|
|
|
} else if (e.code === 'ControlLeft' || e.paddingcode === 'ControlRight') { |
|
|
|
|
enter_picker_mode(state, context); |
|
|
|
|
} else if (e.code === 'KeyD') { |
|
|
|
|
document.querySelector('.debug-window').classList.toggle('dhide'); |
|
|
|
@ -217,10 +217,11 @@ function mousedown(e, state, context) {
@@ -217,10 +217,11 @@ function mousedown(e, state, context) {
|
|
|
|
|
} else if (state.tools.active === 'eraser') { |
|
|
|
|
state.erasing = true; |
|
|
|
|
} else if (state.tools.active === 'pointer') { |
|
|
|
|
const image_event = image_at(state, canvasp.x, canvasp.y); |
|
|
|
|
const image_event = image_at(context, canvasp.x, canvasp.y); |
|
|
|
|
|
|
|
|
|
if (image_event) { |
|
|
|
|
context.active_image = image_event.image_id; |
|
|
|
|
context.active_image = image_event.key; |
|
|
|
|
state.moving_image = image_event.key; |
|
|
|
|
} else { |
|
|
|
|
context.active_image = null; |
|
|
|
|
} |
|
|
|
@ -308,10 +309,19 @@ function mousemove(e, state, context) {
@@ -308,10 +309,19 @@ function mousemove(e, state, context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (state.moving_image) { |
|
|
|
|
state.moving_image.x += e.movementX / state.canvas.zoom; |
|
|
|
|
state.moving_image.y += e.movementY / state.canvas.zoom; |
|
|
|
|
move_image(context, state.moving_image); |
|
|
|
|
do_draw = true; |
|
|
|
|
const image = get_image(context, state.moving_image); |
|
|
|
|
|
|
|
|
|
if (image !== null) { |
|
|
|
|
const dx = e.movementX / state.canvas.zoom; |
|
|
|
|
const dy = e.movementY / state.canvas.zoom; |
|
|
|
|
|
|
|
|
|
image.at.x += dx; |
|
|
|
|
image.at.y += dy; |
|
|
|
|
|
|
|
|
|
//move_image(context, state.moving_image);
|
|
|
|
|
|
|
|
|
|
do_draw = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (state.drawing) { |
|
|
|
@ -356,7 +366,7 @@ function mouseup(e, state, context) {
@@ -356,7 +366,7 @@ function mouseup(e, state, context) {
|
|
|
|
|
|
|
|
|
|
if (state.moving_image) { |
|
|
|
|
schedule_draw(state, context); |
|
|
|
|
queue_event(state, image_move_event(context.active_image, state.moving_image.x, state.moving_image.y)); |
|
|
|
|
//queue_event(state, image_move_event(context.active_image, state.moving_image.x, state.moving_image.y));
|
|
|
|
|
state.moving_image = null; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|