question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consolidating MapControls, OrbitControls ans TrackballControls

See original GitHub issue

Continuing the discussion from #18483.

The problem with that approach is that, if we did that, why not also consolidate all loaders into a single file too?

For usability reasons I think it’s better to keep this API:

import { MapControls } from './jsm/controls/MapControls.js';
import { OrbitControls } from './jsm/controls/OrbitControls.js';
import { TrackballControls } from './jsm/controls/TrackballControls.js';

So the proble to solve is how to make these files consolidate code without changing the API.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mrdoobcommented, Jan 30, 2020

The problem is that FirstPersonControls may not reuse the code that MapControls, OrbitControls and TrackballControls aims to reuse.

1reaction
Mugen87commented, Mar 31, 2021

DataParser is essentially a utility class for example loaders, but we can’t serve it on the /examples folder or we’ll have problems “importing” on /js/loaders/.

That is good point. I think we can easier implement such refactoring as soon as exmaples/js is gone. How about waiting with this issue until we git rid of exmaples/js? In this way, we can head for a cleaner solution by utilizing the ES6 module magic.

One additional note: three.min.js is already too big and I really try to avoid code moving to core when possible.

In this case, it seems not appropriate to move CameraControls into the core. However, we might want to investigate if a generic Controls class could be developed which serves as a base class for all controls. A common interface/behavior for stuff like connect(), disconnect(), dispose() and event handling might be interesting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OrbitControls – three.js docs
Orbit controls allow the camera to orbit around a target. ... Enable or disable horizontal and vertical rotation of the camera. Default is...
Read more >
[Solved]-React and Three.js-three.js - appsloveworld.com
React Three Fiber: How to switch between TrackballControls and OrbitControls? ... How to export and then import a scene with Three JS? ......
Read more >
How to limit panning distance in react three fiber MapControls
React Three Fiber: How to switch between TrackballControls and OrbitControls? 2 · Updating OrbitControls rotation when camera is rotated · 2.
Read more >
Untitled
Built using three.js, OrbitControls and autosize JavaScript Updated on Oct 11, ... geometry merging, procedural terrains and shadow mapper research with ...
Read more >
@react-three/drei - npm
Semi-OrbitControls with spring-physics, polar zoom and snap-back, for presentational purposes. These controls do not turn the camera but will ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found