So, I have code like this:
function Shape() {
...
var canvas = document.getElementById('canvas');
...
canvas.onmousedown = handleMouseDown;
}
function handleMouseDown(e) {
this.width // Doesn't refer to the shape
// How do I get a reference to the shape here?
}
Question - how do I get a reference to the Shape in my event handler?