How to stop drawing in threejs

good day everyone
I draw the spline using mouse click I don’t know how to stop drawing I tried to use this code

function(e){
e.prevent.Default();

}

I used also This

 e.stopPropagation();

but the spline continue drawing could somebody to fix this please.

Depends on how you start drawing - not possible to help with the current amount of code / information :sweat_smile:

I used This code :grinning:

function createline(){
var vertice=[];
  const customGeometry = new THREE.BufferGeometry().setFromPoints(vertice);
      const customMaterial = new THREE.PointsMaterial({ color: 0x888888, size: 0.3 });
      const points = new THREE.Points(customGeometry, customMaterial);
      const curveObject = new THREE.Line(new THREE.BufferGeometry(), new THREE.LineBasicMaterial({ color: 0xff0000 }));
      function handleClick(event) {
        const x = (event.clientX / window.innerWidth) * 2 - 1;
        const y = -(event.clientY / window.innerHeight) * 2 + 1;
        const vector = new THREE.Vector3(x, y, y);
        vector.unproject(camera);
        const dir = vector.sub(camera.position).normalize();
        const distance = -camera.position.y / dir.y;
        const pos = camera.position.clone().add(dir.multiplyScalar(distance));
        vertice.push(pos);
        const customGeometry = new THREE.BufferGeometry().setFromPoints(vertice);
        points.geometry.dispose(), points.geometry = customGeometry;
        if (vertice.length >= 3) {
          const curve = new THREE.CatmullRomCurve3(vertice);
          const po = curve.getPoints(150);
          const geometry = new THREE.BufferGeometry().setFromPoints(po);
          const material = new THREE.LineBasicMaterial({ color: 0xff0000,size:5 });
          curveObject.geometry.dispose(), curveObject.geometry = geometry, curveObject.material = material;

        }
      }
      function init() {
        scene.add(points);
        scene.add(curveObject);
        window.addEventListener('click', handleClick);
 window.addEventListener('contextmenu', function(){
document.getElementById('dataroad').style.display='block';
});
      }

I got this