Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<Select> component breaks if canvas size changes during box select #1960

Open
romankoho opened this issue May 21, 2024 · 0 comments
Open

<Select> component breaks if canvas size changes during box select #1960

romankoho opened this issue May 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@romankoho
Copy link
Contributor

  • three version: 0.152.2
  • @react-three/fiber version: 8.14.3
  • @react-three/drei version: 9.104.1
  • node version: 20.11.1
  • npm (or yarn) version: 10.2.4

Problem description:

I have a layout with two columns. In the left column, I render the three-js scene and in the right column a HTML div that shrinks/expands its width depending on the state of a button.

When clicking a button, box-select of the component gets activated and the right column expands (the scene size.width shrinks respectively). The problem: I have to wait until the right column is fully expanded and the canvas size updated. If I start dragging the selection box too early, the component messes up. A selection box remains on the screen and the orbit controls do not work anymore. See this video of the behavior (the cursor was not recorded, I hope it still helps):

Select_bug.webm

Suggested solution:

I thought of adding an "enabled"-flag to the props. The component would only listen to mouse events if enabled = true. The user could control when to enable (in my case when the layout is ready)

@romankoho romankoho added the bug Something isn't working label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant