Skip to content

Commit 23c3082

Browse files
committed
removal of TODOs and unnecesary variables
1 parent f68bfc1 commit 23c3082

File tree

1 file changed

+3
-46
lines changed
  • src/components/crystal-toolkit/scene

1 file changed

+3
-46
lines changed

src/components/crystal-toolkit/scene/Scene.ts

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import '../CrystalToolkitScene/CrystalToolkitScene.less';
3232
import { CameraState } from '../CameraContextProvider/camera-reducer';
3333

3434
const POINTER_CLASS = 'show-pointer';
35-
let D;
3635
export default class Scene {
3736
private settings;
3837
private renderer!: THREE.WebGLRenderer | SVGRenderer;
@@ -153,8 +152,6 @@ export default class Scene {
153152
mountNode.appendChild(labelRenderer.domElement);
154153
}
155154

156-
componentDidUpdate = () => {};
157-
158155
mouseMoveListener = (e) => {
159156
if (this.renderer instanceof WebGLRenderer || true) {
160157
// tooltips
@@ -397,7 +394,7 @@ export default class Scene {
397394
size,
398395
padding,
399396
tiling,
400-
maxTiling, // TODO
397+
maxTiling,
401398
clickCallback,
402399
private dispatch: (p: Vector3, r: Quaternion, zoom: number) => void,
403400
private debugDOMElement?,
@@ -508,45 +505,6 @@ export default class Scene {
508505

509506
const objectToAnimate = new Set<string>();
510507

511-
// this is now defunct and should be removed, only included for comparison
512-
// TODO: remove traverse_scene
513-
const traverse_scene = (o: SceneJsonObject, parent: THREE.Object3D, currentId: string) => {
514-
o.contents!.forEach((childObject, idx) => {
515-
if (childObject.type) {
516-
// if object can be made into a ThreeObject, add to scene and end recursion
517-
const object = this.makeObject(childObject);
518-
parent.add(object);
519-
this.threeUUIDTojsonObject[object.uuid] = childObject;
520-
this.computeIdToThree[`${currentId}--${idx}`] = object;
521-
childObject.id = `${currentId}--${idx}`;
522-
if (childObject.animate) {
523-
objectToAnimate.add(`${currentId}--${idx}`);
524-
}
525-
} else {
526-
// if object cannot be made into a ThreeObject, add empty child scene,
527-
// set origin, and recurse
528-
const threeObject = new THREE.Object3D();
529-
threeObject.name = childObject.name!;
530-
this.computeIdToThree[`${currentId}--${threeObject.name}`] = threeObject;
531-
childObject.id = `${currentId}--${threeObject.name}`;
532-
threeObject.visible = childObject.visible === undefined ? true : !!childObject.visible;
533-
if (childObject.origin) {
534-
const translation = new THREE.Matrix4();
535-
// note(chab) have a typedefinition for the JSON
536-
translation.makeTranslation(...(childObject.origin as ThreePosition));
537-
threeObject.applyMatrix4(translation);
538-
}
539-
if (!this.settings.extractAxis || threeObject.name !== 'axes') {
540-
parent.add(threeObject);
541-
}
542-
traverse_scene(childObject, threeObject, `${currentId}--${threeObject.name}`);
543-
if (threeObject.name === 'axes') {
544-
this.axis = threeObject.clone();
545-
this.axisJson = { ...childObject };
546-
}
547-
}
548-
});
549-
};
550508
/*
551509
this function returns an array of tiles based on the tiling array
552510
e.g. _getTiles([0, 1, 1] === [[0,0,0], [0,0,1], [0,1,1], [0,1,0]]
@@ -589,7 +547,6 @@ export default class Scene {
589547
const tileRootObject = new THREE.Object3D();
590548
tileRootObject.name = sceneJson.name!;
591549
sceneJson.visible && (tileRootObject.visible = sceneJson.visible);
592-
console.log(this.arrayOfTileRoots);
593550
root.add(tileRootObject);
594551
const [x, y, z] = tile;
595552
this.arrayOfTileRoots[x][y][z].push(tileRootObject);
@@ -664,7 +621,7 @@ export default class Scene {
664621
});
665622
};
666623

667-
// TODO: does it make sense to split this code into two cases?
624+
// TODO: does it make sense to split this code into two cases? NO!
668625
// set up the threeObjects and containers
669626
const rootObject = new THREE.Object3D();
670627
if (this.maxTiling > 0) {
@@ -684,7 +641,7 @@ export default class Scene {
684641

685642
// can cause memory leak
686643
this.scene.add(rootObject);
687-
this.setupCamera(rootObject); // TODO: this could introduce issues if the new root is not compatible
644+
this.setupCamera(rootObject);
688645

689646
// we try to update the outline from the preceding scene, but if the corresponding
690647
// object is not there, we'll remove the outline

0 commit comments

Comments
 (0)