In threejs, if the size of renderer is not the width and height of window, an error will occur in ray pickup. How to solve this problem?

I want to embed the demo of threejs into a div, and then change the size of the renderer to put it in my other pages. It turns out that after the size of the renderer has changed, the ray pickup seems to have gone wrong.

was originally renderer.setSize (window.innerWidth,window.innerHeight); click events are all normal
later I set renderer.setSize (window.innerWidth/2,window.innerHeight/2) like this, and found that renderer has become smaller, and the objects in it have shrunk accordingly, but there is something wrong with the click event, and the actual position coordinates of the object do not seem to have changed. How should I deal with this?

Oct.12,2021

function initRay() {  
  let getBoundingClientRect = **canvas**.getBoundingClientRect()  //canvasid
  // 
  let x = ((event.clientX - getBoundingClientRect .left) / canvas.offsetWidth) * 2 - 1;// 
  let y = -((event.clientY - getBoundingClientRect .top) / canvas.offsetHeight) * 2 + 1;// 
  let standardVector = new THREE.Vector3(x, y, 1);// 
  // 
  let worldVector = standardVector.unproject(camera);
  // (worldVector)
  let ray = worldVector.sub(camera.position).normalize();
  // 
  let rayCaster = new THREE.Raycaster(camera.position, ray);
  //   false
  let intersects = rayCaster.intersectObjects(scene.children, true);
  if (intersects.length > 0) {
      // console.log(intersects[0].object);
  }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b387ae-2c10c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b387ae-2c10c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?