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

Update OrbitControls.js #16094

Closed
wants to merge 1 commit into from
Closed

Update OrbitControls.js #16094

wants to merge 1 commit into from

Conversation

mtsee
Copy link

@mtsee mtsee commented Mar 29, 2019

Add a seek event, in the execution of drag, zoom, trigger this seek method, eg: do react performance optimization, animating do update() is very bad.
use: this.orbitControls.on('seek', () => { do somthing });

Add a seek event, in the execution of drag, zoom, trigger this seek method, eg: do react performance optimization, animating do update() is very bad. 
use:  this.orbitControls.on('seek', () => {  do somthing });
@gkjohnson
Copy link
Collaborator

What's your goal with "seek"? Does the "change" event let you achieve what you're looking for?

controls.addEventListener('change', () => {
  // controls have been moved
});

@mtsee
Copy link
Author

mtsee commented Apr 2, 2019

When used in react or vue, I want update render() when zooming or dragging, but currently only render when animate does, which can be very expensive.

render() {
    return <div>zooming or dragging will do render()</div>
}

@gkjohnson
Copy link
Collaborator

gkjohnson commented Apr 2, 2019

If I'm understanding correctly and you only want to rerender the scene or your application when the controls are dragged or zoomed then you can achieve that with the change event I listed above:

controls.addEventListener('change', () => {
  // rerender scene or application component
});

You shouldn't need any changes to OrbitControls.

@mtsee
Copy link
Author

mtsee commented Apr 3, 2019

thanks! just this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants