@qy_better_lib/hooks 0.2.23 → 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);
@@ -547,23 +544,12 @@ function use_renderer(current_three) {
547
544
  }
548
545
  }
549
546
  function render(render_action) {
550
- if (current_three.renderer?.xr.enabled) {
551
- current_three.renderer.setAnimationLoop(() => {
552
- if (is_rendering) {
553
- let hasCustomRender = false;
554
- if (render_action) {
555
- render_action();
556
- hasCustomRender = true;
557
- }
558
- current_three.css2Renderer?.render(current_three.scene, current_three.camera);
559
- if (!hasCustomRender) {
560
- current_three.renderer?.render(current_three.scene, current_three.camera);
561
- }
562
- }
563
- });
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));
564
551
  } else {
565
- is_rendering = true;
566
- animation_frame_id = requestAnimationFrame((timestamp) => render_loop(timestamp, render_action));
552
+ current_three.renderer?.setAnimationLoop(() => render(render_action));
567
553
  }
568
554
  }
569
555
  function resize() {
@@ -640,7 +626,7 @@ function use_interaction(current_three) {
640
626
  const y = -((e.clientY - rect.top) / rect.height) * 2 + 1;
641
627
  const raycaster = new Raycaster();
642
628
  raycaster.setFromCamera(new Vector2(x, y), current_three.camera);
643
- const intersects = raycaster.intersectObjects(current_three.scene.children);
629
+ const intersects = raycaster.intersectObjects(current_three.scene.children, true);
644
630
  if (intersects.length > 0) {
645
631
  return intersects[0].object;
646
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.23",
4
+ "version": "0.2.24",
5
5
  "description": "qy better lib hooks",
6
6
  "author": "luhuiming",
7
7
  "license": "MIT",