wnPos.y = event.clientY - rect.top;
			isDragging = false;
		}

		function onCanvasMouseMove(event) {
			if (event.buttons > 0) {
				const rect = canvas.getBoundingClientRect();
				const dx = Math.abs(event.clientX - rect.left - mouseDownPos.x);
				const dy = Math.abs(event.clientY - rect.top - mouseDownPos.y);
		
				// Consider it a drag if mouse moved more than 3 pixels in any direction
				if (dx > 3 || dy > 3) {
					isDragging = true;
				}
			}
		}

		function onCanvasClick(event) {
			event.preve