これは、この問題を説明する必要があると思われるすべてのコードの断片です。マウスダウンがアクティブになったときに連続アクションをオフにしようとしていますが、エラーが発生しています:
Uncaught ReferenceError: e が定義されていません (無名関数)
このエラーは、 findClick(e) を引用符で囲んだ beginAction 関数に起因していると確信しています。どういうわけか、ここで e が正しく渡されているとは思いません。
function Cell(row, column) {
this.row = row;
this.column = column;
}
function foo(bar) {
//do stuff here
gCanvas.addEventListener("mousedown", beginAction, false);
document.addEventListener("mouseup", endAction, false);
}
function beginAction(e) {
findClick(e);
var findClick_timeout = setInterval("findClick(e)", 50);
}
function endAction(e) {
if (typeof(findClick_timeout) != "undefined"){ clearTimeout(findClick_timeout);}
}
function getCursorPosition(e) {
//finds the cell position here... works
var cell = new Cell(Math.floor(y/cellSize), Math.floor(x/cellSize));
return cell;
}
function findClick(e) {
var cell = getCursorPosition(e);
//do stuff with the cell!!!!!!
}