summaryrefslogtreecommitdiff
path: root/src/Canvas.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/Canvas.js')
-rw-r--r--src/Canvas.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Canvas.js b/src/Canvas.js
index 7f6404b..6dff7bd 100644
--- a/src/Canvas.js
+++ b/src/Canvas.js
@@ -22,6 +22,8 @@ class Canvas {
/* callbacks */
this.onDraw = null;
this.onMouseMove = null;
+ this.onMouseDown = null;
+ this.onMouseUp = null;
/* register event listeners */
@@ -53,9 +55,11 @@ class Canvas {
this.element.addEventListener('mousedown', e => {
e.preventDefault();
if (e.button === 1) this.panning = true;
+ if (this.onMouseDown) this.onMouseDown(e);
});
this.element.addEventListener('mouseup', e => {
if (e.button === 1) this.panning = false;
+ if (this.onMouseUp) this.onMouseUp(e);
});
/* mouse leave */