|
|
|
@ -173,7 +173,7 @@ function mousedown(e, state, context) {
@@ -173,7 +173,7 @@ function mousedown(e, state, context) {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (e.button !== 0) { |
|
|
|
|
if (e.button !== 0 && e.button !== 1) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -186,9 +186,14 @@ function mousedown(e, state, context) {
@@ -186,9 +186,14 @@ function mousedown(e, state, context) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (state.spacedown) { |
|
|
|
|
if (state.spacedown || e.button === 1) { |
|
|
|
|
state.moving = true; |
|
|
|
|
context.canvas.classList.add('moving'); |
|
|
|
|
|
|
|
|
|
if (e.button === 1) { |
|
|
|
|
context.canvas.classList.add('mousemoving'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -258,7 +263,7 @@ function mousemove(e, state, context) {
@@ -258,7 +263,7 @@ function mousemove(e, state, context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function mouseup(e, state, context) { |
|
|
|
|
if (e.button !== 0) { |
|
|
|
|
if (e.button !== 0 && e.button !== 1) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -269,9 +274,14 @@ function mouseup(e, state, context) {
@@ -269,9 +274,14 @@ function mouseup(e, state, context) {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (state.moving) { |
|
|
|
|
if (state.moving || e.button === 1) { |
|
|
|
|
state.moving = false; |
|
|
|
|
context.canvas.classList.remove('moving'); |
|
|
|
|
|
|
|
|
|
if (e.button === 1) { |
|
|
|
|
context.canvas.classList.remove('mousemoving'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -279,9 +289,12 @@ function mouseup(e, state, context) {
@@ -279,9 +289,12 @@ function mouseup(e, state, context) {
|
|
|
|
|
const stroke = geometry_prepare_stroke(state); |
|
|
|
|
|
|
|
|
|
if (stroke) { |
|
|
|
|
// TODO: be able to add a baked stroke locally
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//geometry_add_stroke(state, context, stroke, 0);
|
|
|
|
|
queue_event(state, stroke_event(state)); |
|
|
|
|
geometry_clear_player(state, context, state.me); |
|
|
|
|
//geometry_clear_player(state, context, state.me);
|
|
|
|
|
schedule_draw(state, context); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -479,10 +492,8 @@ function touchend(e, state, context) {
@@ -479,10 +492,8 @@ function touchend(e, state, context) {
|
|
|
|
|
|
|
|
|
|
const stroke = geometry_prepare_stroke(state); |
|
|
|
|
|
|
|
|
|
if (false && stroke) { // TODO: FIX!
|
|
|
|
|
geometry_add_stroke(state, context, stroke, 0); // TODO: stroke index
|
|
|
|
|
if (stroke) { |
|
|
|
|
queue_event(state, stroke_event(state)); |
|
|
|
|
geometry_clear_player(state, context, state.me); |
|
|
|
|
schedule_draw(state, context); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|