|
|
@ -3,10 +3,10 @@ function init_listeners(state, context) { |
|
|
|
window.addEventListener('keyup', (e) => keyup(e, state, context)); |
|
|
|
window.addEventListener('keyup', (e) => keyup(e, state, context)); |
|
|
|
window.addEventListener('paste', (e) => paste(e, state, context)); |
|
|
|
window.addEventListener('paste', (e) => paste(e, state, context)); |
|
|
|
|
|
|
|
|
|
|
|
context.canvas.addEventListener('mousedown', (e) => mousedown(e, state, context)); |
|
|
|
context.canvas.addEventListener('pointerdown', (e) => mousedown(e, state, context)); |
|
|
|
context.canvas.addEventListener('mousemove', (e) => mousemove(e, state, context)); |
|
|
|
context.canvas.addEventListener('pointermove', (e) => mousemove(e, state, context)); |
|
|
|
context.canvas.addEventListener('mouseup', (e) => mouseup(e, state, context)); |
|
|
|
context.canvas.addEventListener('pointerup', (e) => mouseup(e, state, context)); |
|
|
|
context.canvas.addEventListener('mouseleave', (e) => mouseup(e, state, context)); |
|
|
|
context.canvas.addEventListener('pointerleave', (e) => mouseup(e, state, context)); |
|
|
|
context.canvas.addEventListener('contextmenu', cancel); |
|
|
|
context.canvas.addEventListener('contextmenu', cancel); |
|
|
|
context.canvas.addEventListener('wheel', (e) => wheel(e, state, context)); |
|
|
|
context.canvas.addEventListener('wheel', (e) => wheel(e, state, context)); |
|
|
|
|
|
|
|
|
|
|
@ -246,6 +246,7 @@ function mousemove(e, state, context) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (state.drawing) { |
|
|
|
if (state.drawing) { |
|
|
|
|
|
|
|
//console.log(e.pressure);
|
|
|
|
geometry_add_point(state, context, state.me, canvasp); |
|
|
|
geometry_add_point(state, context, state.me, canvasp); |
|
|
|
fire_event(state, predraw_event(canvasp.x, canvasp.y)); |
|
|
|
fire_event(state, predraw_event(canvasp.x, canvasp.y)); |
|
|
|
do_draw = true; |
|
|
|
do_draw = true; |
|
|
@ -518,6 +519,7 @@ function touchend(e, state, context) { |
|
|
|
|
|
|
|
|
|
|
|
if (stroke) { |
|
|
|
if (stroke) { |
|
|
|
queue_event(state, stroke_event(state)); |
|
|
|
queue_event(state, stroke_event(state)); |
|
|
|
|
|
|
|
//geometry_clear_player(state, context, state.me);
|
|
|
|
schedule_draw(state, context); |
|
|
|
schedule_draw(state, context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|