Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions build/studio/bundle/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,24 +845,13 @@ declare class SceneController {

declare module "three" {
interface Object3D {
vstack(buffer?: number): THREE.Object3D;
vspace(distanceBetween?: number): THREE.Object3D;
setScale(factor: number): THREE.Object3D;
moveNextTo(target: THREE.Object3D, direction: THREE.Vector3, distance?: number): void;
moveToRightOf(target: THREE.Object3D, distance?: number): void;
moveToLeftOf(target: THREE.Object3D, distance?: number): void;
moveAbove(target: THREE.Object3D, distance?: number): void;
moveBelow(target: THREE.Object3D, distance?: number): void;
setOpacity(opacity: number, config?: any): THREE.Object3D;
setInvisible(config?: any): THREE.Object3D;
setVisible(config?: any): THREE.Object3D;
setUpright(): THREE.Object3D;
recenter(center: THREE.Vector3): THREE.Object3D;
reorient(zRotation: number): void;
pointAlongCurve(t: number): THREE.Vector3;
addComponent<T extends THREE.Object3D, K extends string>(name: K, child: T): this & {
[P in K]: T;
};
updateComponent(name: string, child: THREE.Object3D): void;
removeComponent(name: string): THREE.Object3D;
hideComponents(): THREE.Object3D;
Expand Down
96 changes: 0 additions & 96 deletions build/studio/bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57362,17 +57362,9 @@ class SceneController {
}
}

THREE.Object3D.prototype.vstack = function (buffer = 0.2) {
return vstack(this, buffer);
};
THREE.Object3D.prototype.vspace = function (distanceBetween) {
return vspace(this, distanceBetween);
};
THREE.Object3D.prototype.setScale = function (factor) {
this.scale.x = factor;
this.scale.y = factor;
return this;
};
THREE.Object3D.prototype.pointAlongCurve = function (t) {
return pointAlongCurve(this, t);
};
Expand All @@ -57391,23 +57383,6 @@ THREE.Object3D.prototype.moveAbove = function (target, distance) {
THREE.Object3D.prototype.moveBelow = function (target, distance) {
return moveBelow(target, this, distance);
};
THREE.Object3D.prototype.addComponent = function (name, child) {
if (this.components?.has(name)) {
throw new Error(`Failed to add component ${name}: Component or attribute already exists`);
}
if (!this.components) {
this.components = new Map();
}
this.components.set(name, child);
child.parentComponent = this;
this.add(child);
Object.defineProperty(this, name, {
get: () => this.components.get(name),
set: (value) => this.setComponent(name, value),
configurable: true,
});
return this;
};
THREE.Object3D.prototype.updateComponent = (name, child) => {
throw new Error("Not implemented");
};
Expand Down Expand Up @@ -57521,76 +57496,5 @@ function component(_, context) {
},
};
}
THREE.Object3D.prototype.setOpacity = function (opacity, config) {
let family = true;
if (config && config.family === false) {
family = false;
}
if (family) {
this.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.material.opacity = opacity;
}
});
}
else {
[this.stroke, this.fill].forEach((mesh) => {
if (!mesh)
return;
mesh.material.opacity = opacity;
});
}
return this;
};
THREE.Object3D.prototype.setInvisible = function (config) {
let family = true;
if (config && config.family === false) {
family = false;
}
return this.setOpacity(0, { family });
};
THREE.Object3D.prototype.setVisible = function (config) {
let family = true;
if (config && config.family === false) {
family = false;
}
return this.setOpacity(1, { family });
};
THREE.Object3D.prototype.setUpright = function () {
const worldQuaternion = new THREE.Quaternion();
this.getWorldQuaternion(worldQuaternion);
const inverseQuaternion = worldQuaternion.clone().invert();
this.quaternion.copy(inverseQuaternion);
return this;
};
THREE.Object3D.prototype.recenter = function (globalPosition) {
const localPosition = globalPosition.clone();
this.worldToLocal(globalPosition.clone());
const offset = new THREE.Vector3().subVectors(localPosition, this.position);
this.position.add(offset);
if (this.points) {
// Update stroke and fill geometries.
const newPoints = this.points.map((point) => point.clone().sub(offset));
if (this.stroke) {
this.stroke.geometry.setPoints(newPoints);
}
if (this.fill) {
for (let i = 0; i < this.stroke.geometry.points.length - 1; i++) {
const { x, y, z } = newPoints[i];
this.fill.geometry.attributes.position.array[i * 3] = x;
this.fill.geometry.attributes.position.array[i * 3 + 1] = y;
this.fill.geometry.attributes.position.array[i * 3 + 2] = z;
}
}
}
// Update children.
this.children.forEach((child) => {
if (child === this.stroke || child === this.fill)
return;
child.position.sub(offset);
});
return this;
};
THREE.Object3D.prototype.reorient = () => { };

export { index as Animation, constants as Constants, diagram as Diagram, frame as Frame, index$1 as Geometry, graphing as Graphing, MeshLineMaterial, SceneController, text as Text, utils as Utils, component, setCameraDimensions, setCanvasViewport, setupCanvas };
19 changes: 16 additions & 3 deletions build/three/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19193,15 +19193,14 @@ declare module "three" {
rotateZ(angle: number): Vector3;
transformBetweenSpaces(from, to): Vector3;
}

class UpdaterRegistry {
private namedUpdaters: Map<string, () => void>;
private updaters: (() => void)[];
private owner: any;
constructor(owner: any);
register(
nameOrFunc: ((...args: any[]) => any) | string,
func?: (...args: any[]) => any,
func?: (...args: any[]) => any
): void;
unregister(nameOrFunc: ((...args: any[]) => any) | string): boolean;
has(name: string): boolean;
Expand All @@ -19212,9 +19211,23 @@ declare module "three" {
update(dt: number, t: number): void;
addUpdater(
nameOrFunc: ((...args: any[]) => any) | string,
func?: (...args: any[]) => any,
func?: (...args: any[]) => any
): void;
removeUpdater(nameOrFunc: ((...args: any[]) => any) | string): boolean;

vstack(buffer?: number): Object3D;
setScale(factor: number): Object3D;
setOpacity(opacity: number, config?: any): Object3D;
setInvisible(config?: any): Object3D;
setVisible(config?: any): Object3D;
setUpright(): Object3D;
recenter(center: Vector3): Object3D;
reorient(zRotation: number): void;
pointAlongCurve(t: number): Vector3;
addComponent<T extends Object3D, K extends string>(
name: K,
child: T
): this & { [P in K]: T };
}
}

Expand Down
Loading