|
|
|
@ -3,6 +3,7 @@ function on_down(e) {
@@ -3,6 +3,7 @@ function on_down(e) {
|
|
|
|
|
elements.cursor.classList.add('dhide'); |
|
|
|
|
elements.canvas0.classList.add('moving'); |
|
|
|
|
storage.state.moving = true; |
|
|
|
|
storage.state.mousedown = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -11,6 +12,7 @@ function on_down(e) {
@@ -11,6 +12,7 @@ function on_down(e) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (storage.state.moving) { |
|
|
|
|
storage.state.mousedown = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -53,7 +55,7 @@ function on_move(e) {
@@ -53,7 +55,7 @@ function on_move(e) {
|
|
|
|
|
storage.current_stroke.push(predraw); |
|
|
|
|
|
|
|
|
|
fire_event(predraw); |
|
|
|
|
} else if (storage.state.moving) { |
|
|
|
|
} else if (storage.state.moving && storage.state.mousedown) { |
|
|
|
|
storage.canvas.offset_x -= e.movementX; |
|
|
|
|
storage.canvas.offset_y -= e.movementY; |
|
|
|
|
|
|
|
|
@ -71,10 +73,14 @@ function on_move(e) {
@@ -71,10 +73,14 @@ function on_move(e) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function on_up(e) { |
|
|
|
|
if (storage.state.moving && e.button === 1) { |
|
|
|
|
elements.cursor.classList.remove('dhide'); |
|
|
|
|
elements.canvas0.classList.remove('moving'); |
|
|
|
|
storage.state.moving = false; |
|
|
|
|
if (storage.state.moving && (e.button === 1 || e.button === 0)) { |
|
|
|
|
storage.state.mousedown = false; |
|
|
|
|
if (!storage.state.spacedown) { |
|
|
|
|
elements.cursor.classList.remove('dhide'); |
|
|
|
|
elements.canvas0.classList.remove('moving'); |
|
|
|
|
storage.state.moving = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (storage.state.drawing && e.button === 0) { |
|
|
|
@ -82,6 +88,7 @@ async function on_up(e) {
@@ -82,6 +88,7 @@ async function on_up(e) {
|
|
|
|
|
const event = stroke_event(); |
|
|
|
|
storage.current_stroke = []; |
|
|
|
|
await queue_event(event); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -90,6 +97,7 @@ function on_keydown(e) {
@@ -90,6 +97,7 @@ function on_keydown(e) {
|
|
|
|
|
elements.cursor.classList.add('dhide'); |
|
|
|
|
elements.canvas0.classList.add('moving'); |
|
|
|
|
storage.state.moving = true; |
|
|
|
|
storage.state.spacedown = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -98,6 +106,7 @@ function on_keyup(e) {
@@ -98,6 +106,7 @@ function on_keyup(e) {
|
|
|
|
|
elements.cursor.classList.remove('dhide'); |
|
|
|
|
elements.canvas0.classList.remove('moving'); |
|
|
|
|
storage.state.moving = false; |
|
|
|
|
storage.state.spacedown = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -106,6 +115,7 @@ function on_leave(e) {
@@ -106,6 +115,7 @@ function on_leave(e) {
|
|
|
|
|
elements.cursor.classList.remove('dhide'); |
|
|
|
|
elements.canvas0.classList.remove('moving'); |
|
|
|
|
storage.state.moving = false; |
|
|
|
|
storage.state.holding = false; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|