INNER CODE UNIT · TypeScript
dx
jamesroutley/24a2 · src/engine.ts:396
const dx = this._dotSize / 2 + x * offset;
const dy = this._dotSize / 2 + y * offset;
const distance = Math.sqrt(
Math.pow(cx - dx, 2) + Math.pow(cy - dy, 2)
);
if (distance < this._dotSize / 2) {
this._dotClicked(x, y);
// We've found the dot, so exit early
return;
}
}
}
}
this._canvas.addEventListener("click", onMouseClick.bind(this));
}