summaryrefslogtreecommitdiff
path: root/src/Canvas.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-29 20:44:11 -0500
committersanine <sanine.not@pm.me>2022-05-29 20:44:11 -0500
commit9ccb4a7bc728fd0e85c04fddb802fde02b73cfe2 (patch)
tree97af7969f2a7809543e5c70c20e62061f294771a /src/Canvas.js
parent76d7e6c00ec11a72adfcb10fbfad6d92a873b253 (diff)
add basic color brushing demo
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 */