Hi frens,
I want to register the mouseDragged Function to a canvas in instance mode (within a react component).
But mouseDragged is not available (only mousePressed and mouseClicked…).
Is there a workaround to check if the mouse is dragged inside the canvas?
var sketch = function( p ) {
p.setup = function() {
var cnv = p.createCanvas(700, 410);
cnv.mouseDragged(doStuff);
};
p.draw = function() {
p.rect(50, 50,50,50);
};
function doStuff() {
p.background(p.random(255));
}
};
var myp5 = new p5(sketch);
Log:
TypeError: cnv.mouseDragged is not a function