dot now moves inside circle if user clicks outside circle instead of not appearing

This commit is contained in:
neurokitti
2025-02-16 03:03:33 -06:00
parent 8783c469be
commit 944e7cb60a

View File

@@ -474,14 +474,15 @@
return;
}
// Check if the click is within the circle
const distance = Math.sqrt((pixelX - centerX) ** 2 + (pixelY - centerY) ** 2);
if (distance > radius) {
return;
const angle = Math.atan2(pixelY - centerY, pixelX - centerX);
pixelX = centerX + Math.cos(angle) * radius;
pixelY = centerY + Math.sin(angle) * radius;
}
const relativeX = event.clientX - rect.left;
const relativeY = event.clientY - rect.top;
const relativeX = pixelX - rect.left;
const relativeY = pixelY - rect.top;
if (!clickedDot && this.dots.length < 1) {
if (this.dots.length === 0) {