@qy_better_lib/hooks 0.2.22 → 0.2.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -529,10 +529,7 @@ function use_renderer(current_three) {
529
529
  try {
530
530
  if (current_three.scene && current_three.camera && current_three.renderer) {
531
531
  let hasCustomRender = false;
532
- if (render_action) {
533
- render_action();
534
- hasCustomRender = true;
535
- }
532
+ if (render_action) ;
536
533
  current_three.css2Renderer?.render(current_three.scene, current_three.camera);
537
534
  if (!hasCustomRender) {
538
535
  current_three.renderer.render(current_three.scene, current_three.camera);
@@ -542,19 +539,17 @@ function use_renderer(current_three) {
542
539
  console.error("Three.js render error:", error);
543
540
  }
544
541
  }
542
+ if (!current_three.renderer?.xr.enabled) {
543
+ animation_frame_id = requestAnimationFrame((timestamp2) => render_loop(timestamp2, render_action));
544
+ }
545
545
  }
546
546
  function render(render_action) {
547
- if (current_three.renderer?.xr.enabled) {
548
- current_three.renderer.setAnimationLoop(() => {
549
- if (is_rendering) {
550
- render_action && render_action();
551
- current_three.css2Renderer?.render(current_three.scene, current_three.camera);
552
- current_three.renderer?.render(current_three.scene, current_three.camera);
553
- }
554
- });
547
+ render_action && render_action();
548
+ current_three.css2Renderer?.render(current_three.scene, current_three.camera);
549
+ if (!current_three.renderer?.xr.enabled) {
550
+ animation_frame_id = requestAnimationFrame(() => render(render_action));
555
551
  } else {
556
- is_rendering = true;
557
- animation_frame_id = requestAnimationFrame((timestamp) => render_loop(timestamp, render_action));
552
+ current_three.renderer?.setAnimationLoop(() => render(render_action));
558
553
  }
559
554
  }
560
555
  function resize() {
@@ -631,7 +626,7 @@ function use_interaction(current_three) {
631
626
  const y = -((e.clientY - rect.top) / rect.height) * 2 + 1;
632
627
  const raycaster = new Raycaster();
633
628
  raycaster.setFromCamera(new Vector2(x, y), current_three.camera);
634
- const intersects = raycaster.intersectObjects(current_three.scene.children);
629
+ const intersects = raycaster.intersectObjects(current_three.scene.children, true);
635
630
  if (intersects.length > 0) {
636
631
  return intersects[0].object;
637
632
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qy_better_lib/hooks",
3
3
  "private": false,
4
- "version": "0.2.22",
4
+ "version": "0.2.24",
5
5
  "description": "qy better lib hooks",
6
6
  "author": "luhuiming",
7
7
  "license": "MIT",