だから、私は次のようなコードを持っています:
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?
}
質問 - イベント ハンドラーで Shape への参照を取得するにはどうすればよいですか?