pmndrs / pmndrs/three-stdlib

Issue when chaging the mouse button controls for TrackBallControls

Open
#409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
858
Forks
144
PR merge metrics
No merged PRs in 30d

Description

  • three version:
  • @types/three version:
  • three-stdlib version: 2.35.14
Problem description:

I'm currently writing a mesh viewer using react. I'm using the react-three/drei library https://github.com/pmndrs/drei wich relies on three-stdlib.

I noticed that I could not change the mouseButtons for my TrackballControls, and it seems closely related to this threejs issue:
https://github.com/mrdoob/three.js/issues/26366
Is it possible that it is the same bug ?

Relevant code:

I try to do this to rotate both on the left and right button, but it causes the right button to zoom or dolly instead, it's quite mysterious :S

<TrackballControls
  target={[0, 0, 0]}
  mouseButtons={{
    LEFT: THREE.MOUSE.ROTATE,
    MIDDLE: THREE.MOUSE.PAN,
    RIGHT: THREE.MOUSE.ROTATE
  }}
/>
Suggested solution:

It seems there is a solution described here: https://github.com/mrdoob/three.js/issues/26366

I'm not very good at react and threejs so maybe I got the bug completely wrong, I hope you'll be able to check it ...
I'll try to answer any questions you may have to the best of my abilities.

Thank you for all your work :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TrackballControls entry point and inspect how the mouseButtons mapping handles LEFT, MIDDLE, and RIGHT. Compare the behavior with the linked three.js issue and reproduce the provided React configuration. Done means left and right rotate while middle pans, without right-button zooming or dollying.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, three.js
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.